This commit is contained in:
cdle
2023-06-07 13:39:32 +08:00
parent 9ed1da2dc1
commit ad6208bc43
+20 -9
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]) {
params := map[string]interface{}{
"user_id": msg[core.USER_ID],
"message": msg[core.CONETNT],
}
if debug {
logs.Debug("QQ实际私聊:", string(utils.JsonMarshal(params)))
}
id, err := qqcon.WriteJSON(CallApi{ id, err := qqcon.WriteJSON(CallApi{
Action: "send_private_msg", Action: "send_private_msg",
Params: map[string]interface{}{ Params: params,
"user_id": msg[core.USER_ID],
"message": msg[core.CONETNT],
},
}) })
if err != nil { if err != nil {
core.Logs.Warn("QQ发送私聊消息错误:", err) core.Logs.Warn("QQ发送私聊消息错误:", err)
} }
return id return id
} else { } else {
params := map[string]interface{}{
"group_id": msg[core.CHAT_ID],
"user_id": msg[core.USER_ID],
"message": msg[core.CONETNT],
}
if debug {
logs.Debug("QQ实际群聊:", string(utils.JsonMarshal(params)))
}
id, err := qqcon.WriteJSON(CallApi{ id, err := qqcon.WriteJSON(CallApi{
Action: "send_group_msg", Action: "send_group_msg",
Params: map[string]interface{}{ Params: params,
"group_id": msg[core.CHAT_ID],
"user_id": msg[core.USER_ID],
"message": msg[core.CONETNT],
},
}) })
if err != nil { if err != nil {
core.Logs.Warn("QQ发送群组消息错误:", err) core.Logs.Warn("QQ发送群组消息错误:", err)