1
0
mirror of https://github.com/Mrs4s/go-cqhttp.git synced 2025-05-06 03:53:50 +08:00

fix private video

This commit is contained in:
wdvxdr 2021-01-08 22:34:57 +08:00
parent 816c142822
commit a4c3ef8923
2 changed files with 10 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import (
"encoding/gob" "encoding/gob"
"fmt" "fmt"
"hash/crc32" "hash/crc32"
"math/rand"
"os" "os"
"path" "path"
"runtime/debug" "runtime/debug"
@ -287,6 +288,15 @@ func (bot *CQBot) SendPrivateMessage(target int64, m *message.SendingMessage) in
newElem = append(newElem, fv) newElem = append(newElem, fv)
continue continue
} }
if i, ok := elem.(*LocalVideoElement); ok { // todo:cache & multiThread
gv, err := bot.Client.UploadGroupShortVideo(target, i.video, i.thumb)
if err != nil {
log.Warnf("警告: 群 %v 消息短视频上传失败: %v", int64(rand.Uint32()), err)
continue
}
newElem = append(newElem, gv)
continue
}
if i, ok := elem.(*QQMusicElement); ok { if i, ok := elem.(*QQMusicElement); ok {
var msgStyle uint32 = 4 var msgStyle uint32 = 4
if i.MusicUrl == "" { if i.MusicUrl == "" {

View File

@ -784,9 +784,6 @@ func (bot *CQBot) ToElement(t string, d map[string]string, group bool) (m interf
} }
return bot.makeShowPic(img, source, icon, minWidth, minHeight, maxWidth, maxHeight, group) return bot.makeShowPic(img, source, icon, minWidth, minHeight, maxWidth, maxHeight, group)
case "video": case "video":
if !group {
return nil, errors.New("unsupported private short video")
}
cache := d["cache"] cache := d["cache"]
if cache == "" { if cache == "" {
cache = "1" cache = "1"