This commit is contained in:
cdle
2023-06-07 13:39:32 +08:00
parent 9ed1da2dc1
commit ad6208bc43
+19 -8
View File
@@ -186,26 +186,37 @@ func init() {
return true return true
}) })
adapter.SetReplyHandler(func(msg map[string]string) string { adapter.SetReplyHandler(func(msg map[string]string) string {
if debug {
logs.Debug("QQ发送消息:", string(utils.JsonMarshal(msg)))
}
if utils.IsZeroOrEmpty(msg[core.CHAT_ID]) { if utils.IsZeroOrEmpty(msg[core.CHAT_ID]) {
id, err := qqcon.WriteJSON(CallApi{ params := map[string]interface{}{
Action: "send_private_msg",
Params: map[string]interface{}{
"user_id": msg[core.USER_ID], "user_id": msg[core.USER_ID],
"message": msg[core.CONETNT], "message": msg[core.CONETNT],
}, }
if debug {
logs.Debug("QQ实际私聊:", string(utils.JsonMarshal(params)))
}
id, err := qqcon.WriteJSON(CallApi{
Action: "send_private_msg",
Params: params,
}) })
if err != nil { if err != nil {
core.Logs.Warn("QQ发送私聊消息错误:", err) core.Logs.Warn("QQ发送私聊消息错误:", err)
} }
return id return id
} else { } else {
id, err := qqcon.WriteJSON(CallApi{ params := map[string]interface{}{
Action: "send_group_msg",
Params: map[string]interface{}{
"group_id": msg[core.CHAT_ID], "group_id": msg[core.CHAT_ID],
"user_id": msg[core.USER_ID], "user_id": msg[core.USER_ID],
"message": msg[core.CONETNT], "message": msg[core.CONETNT],
}, }
if debug {
logs.Debug("QQ实际群聊:", string(utils.JsonMarshal(params)))
}
id, err := qqcon.WriteJSON(CallApi{
Action: "send_group_msg",
Params: params,
}) })
if err != nil { if err != nil {
core.Logs.Warn("QQ发送群组消息错误:", err) core.Logs.Warn("QQ发送群组消息错误:", err)