@@ -765,9 +765,9 @@ func (bot *CQBot) CQSendGroupMessage(groupID int64, m gjson.Result, autoEscape b
765765 }
766766 }
767767 fixAt (elem )
768- mid := bot .SendGroupMessage (groupID , & message.SendingMessage {Elements : elem })
769- if mid == - 1 {
770- return Failed (100 , "SEND_MSG_API_ERROR" , "请参考 go-cqhttp 端输出" )
768+ mid , err := bot .SendGroupMessage (groupID , & message.SendingMessage {Elements : elem })
769+ if err != nil {
770+ return Failed (100 , "SEND_MSG_API_ERROR" , err . Error () )
771771 }
772772 log .Infof ("发送群 %v(%v) 的消息: %v (%v)" , group .Name , groupID , limitedString (m .String ()), mid )
773773 return OK (global.MSG {"message_id" : mid })
@@ -836,7 +836,7 @@ func (bot *CQBot) uploadForwardElement(m gjson.Result, target int64, sourceType
836836 if len (bot .Client .GroupList ) == 0 {
837837 groupID = 1
838838 } else {
839- groupID = bot .Client .GroupList [1 ].Uin
839+ groupID = bot .Client .GroupList [0 ].Uin
840840 }
841841 }
842842 builder := bot .Client .NewForwardMessageBuilder (groupID )
@@ -977,8 +977,11 @@ func (bot *CQBot) CQSendGroupForwardMessage(groupID int64, m gjson.Result) globa
977977 log .Warnf ("合并转发(群)消息发送失败: 账号可能被风控." )
978978 return Failed (100 , "SEND_MSG_API_ERROR" , "请参考 go-cqhttp 端输出" )
979979 }
980+ mid := bot .InsertGroupMessage (ret )
981+ log .Infof ("发送群 %v(%v) 的合并转发消息: %v (%v)" , groupID , groupID , limitedString (m .String ()), mid )
980982 return OK (global.MSG {
981- "message_id" : bot .InsertGroupMessage (ret ),
983+ "message_id" : mid ,
984+ "forward_id" : fe .ResId ,
982985 })
983986}
984987
@@ -1000,7 +1003,11 @@ func (bot *CQBot) CQSendPrivateForwardMessage(userID int64, m gjson.Result) glob
10001003 log .Warnf ("合并转发(好友)消息发送失败: 账号可能被风控." )
10011004 return Failed (100 , "SEND_MSG_API_ERROR" , "请参考 go-cqhttp 端输出" )
10021005 }
1003- return OK (global.MSG {"message_id" : mid })
1006+ log .Infof ("发送好友 %v(%v) 的合并转发消息: %v (%v)" , userID , userID , limitedString (m .String ()), mid )
1007+ return OK (global.MSG {
1008+ "message_id" : mid ,
1009+ "forward_id" : fe .ResId ,
1010+ })
10041011}
10051012
10061013// CQSendPrivateMessage 发送私聊消息
@@ -1114,6 +1121,23 @@ func (bot *CQBot) CQSetGroupMemo(groupID int64, msg, img string) global.MSG {
11141121 return Failed (100 , "GROUP_NOT_FOUND" , "群聊不存在" )
11151122}
11161123
1124+ // CQDelGroupMemo 扩展API-删除群公告
1125+ // @route(_del_group_notice)
1126+ // @rename(fid->notice_id)
1127+ func (bot * CQBot ) CQDelGroupMemo (groupID int64 , fid string ) global.MSG {
1128+ if g := bot .Client .FindGroup (groupID ); g != nil {
1129+ if g .SelfPermission () == client .Member {
1130+ return Failed (100 , "PERMISSION_DENIED" , "权限不足" )
1131+ }
1132+ err := bot .Client .DelGroupNotice (groupID , fid )
1133+ if err != nil {
1134+ return Failed (100 , "DELETE_NOTICE_ERROR" , err .Error ())
1135+ }
1136+ return OK (nil )
1137+ }
1138+ return Failed (100 , "GROUP_NOT_FOUND" , "群聊不存在" )
1139+ }
1140+
11171141// CQSetGroupKick 群组踢人
11181142//
11191143// https://git.io/Jtz1V
0 commit comments