1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-05 11:33:48 +08:00

Merge pull request #559 from Ink-33/master

修复codec编译问题
This commit is contained in:
Mrs4s 2021-01-13 08:06:02 +08:00 committed by GitHub
commit 4cb3d8f33e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 38 additions and 9 deletions

View File

@ -16,12 +16,16 @@ jobs:
matrix:
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/amd64
goos: [linux, windows, darwin]
goarch: ["386", amd64, arm]
goarch: ["386", amd64, arm, arm64]
exclude:
- goos: darwin
goarch: arm
- goos: darwin
goarch: arm64
- goos: darwin
goarch: "386"
- goos: windows
goarch: arm64
fail-fast: true
steps:

View File

@ -10,12 +10,16 @@ jobs:
matrix:
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/386, darwin/amd64
goos: [linux, windows, darwin]
goarch: ["386", amd64, arm]
goarch: ["386", amd64, arm, arm64]
exclude:
- goos: darwin
goarch: arm
- goos: darwin
goarch: arm64
- goos: darwin
goarch: "386"
- goos: windows
goarch: arm64
steps:
- uses: actions/checkout@v2
@ -30,4 +34,4 @@ jobs:
goarch: ${{ matrix.goarch }}
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 }}"

View File

@ -303,7 +303,7 @@ func (bot *CQBot) CQSendGroupForwardMessage(groupId int64, m gjson.Result) MSG {
var newElem []message.IMessageElement
for _, elem := range content {
if img, ok := elem.(*LocalImageElement); ok {
gm, err := bot.Client.UploadGroupImage(groupId, img.Stream)
gm, err := bot.UploadLocalImageAsGroup(groupId, img)
if err != nil {
log.Warnf("警告:群 %v 图片上传失败: %v", groupId, err)
continue
@ -311,6 +311,15 @@ func (bot *CQBot) CQSendGroupForwardMessage(groupId int64, m gjson.Result) MSG {
newElem = append(newElem, gm)
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)
}
nodes = append(nodes, &message.ForwardNode{

View File

@ -1039,7 +1039,7 @@ func (bot *CQBot) makeShowPic(elem message.IMessageElement, source string, icon
var suf message.IMessageElement
if i, ok := elem.(*LocalImageElement); ok {
if group == false {
gm, err := bot.Client.UploadPrivateImage(1, i.Stream)
gm, err := bot.UploadLocalImageAsPrivate(1, i)
if err != nil {
log.Warnf("警告: 好友消息 %v 消息图片上传失败: %v", 1, err)
return nil, err
@ -1047,7 +1047,7 @@ func (bot *CQBot) makeShowPic(elem message.IMessageElement, source string, icon
suf = gm
xml = fmt.Sprintf(`<?xml version='1.0' encoding='UTF-8' standalone='yes' ?><msg serviceID="5" templateID="12345" action="" brief="&#91;分享&#93;我看到一张很赞的图片,分享给你,快来看!" 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 {
gm, err := bot.Client.UploadGroupImage(1, i.Stream)
gm, err := bot.UploadLocalImageAsGroup(1, i)
if err != nil {
log.Warnf("警告: 群 %v 消息图片上传失败: %v", 1, err)
return nil, err

View File

@ -1,5 +1,5 @@
// +build linux windows darwin
// +build 386 amd64 arm
// +build 386 amd64 arm arm64
package codec

View 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")
}

View File

@ -1,5 +1,4 @@
// +build !linux,!windows,!darwin
// +build !386,!amd64,!arm
// +build !windows,!linux,!darwin
package codec