mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 19:43:49 +08:00
commit
be47ff3437
12
coolq/bot.go
12
coolq/bot.go
@ -5,6 +5,7 @@ import (
|
||||
"encoding/gob"
|
||||
"fmt"
|
||||
"hash/crc32"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path"
|
||||
"runtime/debug"
|
||||
@ -281,12 +282,21 @@ func (bot *CQBot) SendPrivateMessage(target int64, m *message.SendingMessage) in
|
||||
if i, ok := elem.(*message.VoiceElement); ok {
|
||||
fv, err := bot.Client.UploadPrivatePtt(target, i.Data)
|
||||
if err != nil {
|
||||
log.Warnf("警告: 群 %v 消息语音上传失败: %v", target, err)
|
||||
log.Warnf("警告: 私聊 %v 消息语音上传失败: %v", target, err)
|
||||
continue
|
||||
}
|
||||
newElem = append(newElem, fv)
|
||||
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 {
|
||||
var msgStyle uint32 = 4
|
||||
if i.MusicUrl == "" {
|
||||
|
@ -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)
|
||||
case "video":
|
||||
if !group {
|
||||
return nil, errors.New("unsupported private short video")
|
||||
}
|
||||
cache := d["cache"]
|
||||
if cache == "" {
|
||||
cache = "1"
|
||||
|
Loading…
x
Reference in New Issue
Block a user