mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-05 03:23:49 +08:00
fix #107.
This commit is contained in:
parent
22d9ddb4ea
commit
00d80d5dfc
@ -124,7 +124,13 @@ func (bot *CQBot) CQSendGroupMessage(groupId int64, i interface{}) MSG {
|
||||
// fix at display
|
||||
for _, e := range elem {
|
||||
if at, ok := e.(*message.AtElement); ok && at.Target != 0 {
|
||||
at.Display = "@" + bot.Client.FindGroup(groupId).FindMember(at.Target).DisplayName()
|
||||
at.Display = "@" + func() string {
|
||||
mem := bot.Client.FindGroup(groupId).FindMember(at.Target)
|
||||
if mem != nil {
|
||||
return mem.DisplayName()
|
||||
}
|
||||
return strconv.FormatInt(at.Target, 10)
|
||||
}()
|
||||
}
|
||||
}
|
||||
mid := bot.SendGroupMessage(groupId, &message.SendingMessage{Elements: elem})
|
||||
|
@ -95,7 +95,7 @@ func (bot *CQBot) SendGroupMessage(groupId int64, m *message.SendingMessage) int
|
||||
var newElem []message.IMessageElement
|
||||
for _, elem := range m.Elements {
|
||||
if i, ok := elem.(*message.ImageElement); ok {
|
||||
_, _ = bot.Client.UploadGroupImage(int64(rand.Intn(11451419198)), i.Data)
|
||||
_, _ = bot.Client.UploadGroupImage(int64(rand.Intn(11451419)), i.Data)
|
||||
gm, err := bot.Client.UploadGroupImage(groupId, i.Data)
|
||||
if err != nil {
|
||||
log.Warnf("警告: 群 %v 消息图片上传失败: %v", groupId, err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user