mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 11:33:48 +08:00
commit
4cb3d8f33e
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@ -16,12 +16,16 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/amd64
|
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/amd64
|
||||||
goos: [linux, windows, darwin]
|
goos: [linux, windows, darwin]
|
||||||
goarch: ["386", amd64, arm]
|
goarch: ["386", amd64, arm, arm64]
|
||||||
exclude:
|
exclude:
|
||||||
- goos: darwin
|
- goos: darwin
|
||||||
goarch: arm
|
goarch: arm
|
||||||
|
- goos: darwin
|
||||||
|
goarch: arm64
|
||||||
- goos: darwin
|
- goos: darwin
|
||||||
goarch: "386"
|
goarch: "386"
|
||||||
|
- goos: windows
|
||||||
|
goarch: arm64
|
||||||
fail-fast: true
|
fail-fast: true
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
@ -10,12 +10,16 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/386, darwin/amd64
|
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/386, darwin/amd64
|
||||||
goos: [linux, windows, darwin]
|
goos: [linux, windows, darwin]
|
||||||
goarch: ["386", amd64, arm]
|
goarch: ["386", amd64, arm, arm64]
|
||||||
exclude:
|
exclude:
|
||||||
- goos: darwin
|
- goos: darwin
|
||||||
goarch: arm
|
goarch: arm
|
||||||
|
- goos: darwin
|
||||||
|
goarch: arm64
|
||||||
- goos: darwin
|
- goos: darwin
|
||||||
goarch: "386"
|
goarch: "386"
|
||||||
|
- goos: windows
|
||||||
|
goarch: arm64
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@ -30,4 +34,4 @@ jobs:
|
|||||||
goarch: ${{ matrix.goarch }}
|
goarch: ${{ matrix.goarch }}
|
||||||
goversion: "https://golang.org/dl/go1.15.3.linux-amd64.tar.gz"
|
goversion: "https://golang.org/dl/go1.15.3.linux-amd64.tar.gz"
|
||||||
ldflags: -w -s -X "github.com/Mrs4s/go-cqhttp/coolq.Version=${{ env.RELEASE_VERSION }}"
|
ldflags: -w -s -X "github.com/Mrs4s/go-cqhttp/coolq.Version=${{ env.RELEASE_VERSION }}"
|
||||||
|
|
||||||
|
11
coolq/api.go
11
coolq/api.go
@ -303,7 +303,7 @@ func (bot *CQBot) CQSendGroupForwardMessage(groupId int64, m gjson.Result) MSG {
|
|||||||
var newElem []message.IMessageElement
|
var newElem []message.IMessageElement
|
||||||
for _, elem := range content {
|
for _, elem := range content {
|
||||||
if img, ok := elem.(*LocalImageElement); ok {
|
if img, ok := elem.(*LocalImageElement); ok {
|
||||||
gm, err := bot.Client.UploadGroupImage(groupId, img.Stream)
|
gm, err := bot.UploadLocalImageAsGroup(groupId, img)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("警告:群 %v 图片上传失败: %v", groupId, err)
|
log.Warnf("警告:群 %v 图片上传失败: %v", groupId, err)
|
||||||
continue
|
continue
|
||||||
@ -311,6 +311,15 @@ func (bot *CQBot) CQSendGroupForwardMessage(groupId int64, m gjson.Result) MSG {
|
|||||||
newElem = append(newElem, gm)
|
newElem = append(newElem, gm)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if video, ok := elem.(*LocalVideoElement); ok {
|
||||||
|
gm, err := bot.UploadLocalVideo(groupId, video)
|
||||||
|
if err != nil {
|
||||||
|
log.Warnf("警告:群 %v 视频上传失败: %v", groupId, err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
newElem = append(newElem, gm)
|
||||||
|
continue
|
||||||
|
}
|
||||||
newElem = append(newElem, elem)
|
newElem = append(newElem, elem)
|
||||||
}
|
}
|
||||||
nodes = append(nodes, &message.ForwardNode{
|
nodes = append(nodes, &message.ForwardNode{
|
||||||
|
@ -1039,7 +1039,7 @@ func (bot *CQBot) makeShowPic(elem message.IMessageElement, source string, icon
|
|||||||
var suf message.IMessageElement
|
var suf message.IMessageElement
|
||||||
if i, ok := elem.(*LocalImageElement); ok {
|
if i, ok := elem.(*LocalImageElement); ok {
|
||||||
if group == false {
|
if group == false {
|
||||||
gm, err := bot.Client.UploadPrivateImage(1, i.Stream)
|
gm, err := bot.UploadLocalImageAsPrivate(1, i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("警告: 好友消息 %v 消息图片上传失败: %v", 1, err)
|
log.Warnf("警告: 好友消息 %v 消息图片上传失败: %v", 1, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -1047,7 +1047,7 @@ func (bot *CQBot) makeShowPic(elem message.IMessageElement, source string, icon
|
|||||||
suf = gm
|
suf = gm
|
||||||
xml = fmt.Sprintf(`<?xml version='1.0' encoding='UTF-8' standalone='yes' ?><msg serviceID="5" templateID="12345" action="" brief="[分享]我看到一张很赞的图片,分享给你,快来看!" sourceMsgId="0" url="%s" flag="0" adverSign="0" multiMsgFlag="0"><item layout="0" advertiser_id="0" aid="0"><image uuid="%x" md5="%x" GroupFiledid="0" filesize="%d" local_path="%s" minWidth="%d" minHeight="%d" maxWidth="%d" maxHeight="%d" /></item><source name="%s" icon="%s" action="" appid="-1" /></msg>`, "", gm.Md5, gm.Md5, len(i.Data), "", minWidth, minHeight, maxWidth, maxHeight, source, icon)
|
xml = fmt.Sprintf(`<?xml version='1.0' encoding='UTF-8' standalone='yes' ?><msg serviceID="5" templateID="12345" action="" brief="[分享]我看到一张很赞的图片,分享给你,快来看!" sourceMsgId="0" url="%s" flag="0" adverSign="0" multiMsgFlag="0"><item layout="0" advertiser_id="0" aid="0"><image uuid="%x" md5="%x" GroupFiledid="0" filesize="%d" local_path="%s" minWidth="%d" minHeight="%d" maxWidth="%d" maxHeight="%d" /></item><source name="%s" icon="%s" action="" appid="-1" /></msg>`, "", gm.Md5, gm.Md5, len(i.Data), "", minWidth, minHeight, maxWidth, maxHeight, source, icon)
|
||||||
} else {
|
} else {
|
||||||
gm, err := bot.Client.UploadGroupImage(1, i.Stream)
|
gm, err := bot.UploadLocalImageAsGroup(1, i)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("警告: 群 %v 消息图片上传失败: %v", 1, err)
|
log.Warnf("警告: 群 %v 消息图片上传失败: %v", 1, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// +build linux windows darwin
|
// +build linux windows darwin
|
||||||
// +build 386 amd64 arm
|
// +build 386 amd64 arm arm64
|
||||||
|
|
||||||
package codec
|
package codec
|
||||||
|
|
||||||
|
13
global/codec/codec_unsupportedarch.go
Normal file
13
global/codec/codec_unsupportedarch.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// +build !386,!arm64,!amd64,!arm
|
||||||
|
|
||||||
|
package codec
|
||||||
|
|
||||||
|
import "errors"
|
||||||
|
|
||||||
|
func Init() error {
|
||||||
|
return errors.New("Unsupport arch now")
|
||||||
|
}
|
||||||
|
|
||||||
|
func EncodeToSilk(record []byte, tempName string, useCache bool) ([]byte, error) {
|
||||||
|
return nil, errors.New("Unsupport arch now")
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
// +build !linux,!windows,!darwin
|
// +build !windows,!linux,!darwin
|
||||||
// +build !386,!amd64,!arm
|
|
||||||
|
|
||||||
package codec
|
package codec
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user