refactor: modify headmasterHandler to include message origin ID in JSON response and adjust ReferOriginMsg flag for improved message tracking

This commit is contained in:
lixiangwuxian 2025-01-09 02:43:08 +08:00
parent 0a8ec74036
commit d3e9c9b0d6

View File

@ -33,14 +33,14 @@ func headmasterHandler(msg model.Message) (reply model.Reply) {
}
if len(msg.RawMsg) > 7 && msg.RawMsg[0:7] == "校长 " {
return model.Reply{
ReplyMsg: ask(from, fmt.Sprintf("{\"qqid\":%d,\"nickname\":\"%s\",\"msg\":\"%s\"}", msg.UserId, msg.UserNickName, msg.RawMsg[7:])),
ReferOriginMsg: true,
ReplyMsg: ask(from, fmt.Sprintf("{\"qqid\":%d,\"nickname\":\"%s\",\"referid\":%d,\"msg\":\"%s\"}", msg.UserId, msg.UserNickName, msg.OriginMsgId, msg.RawMsg[7:])),
ReferOriginMsg: false,
FromMsg: msg,
}
}
return model.Reply{
ReplyMsg: ask(from, fmt.Sprintf("{\"qqid\":%d,\"nickname\":\"%s\",\"msg\":\"%s\"}", msg.UserId, msg.UserNickName, msg.RawMsg)),
ReferOriginMsg: true,
ReplyMsg: ask(from, fmt.Sprintf("{\"qqid\":%d,\"nickname\":\"%s\",\"referid\":%d,\"msg\":\"%s\"}", msg.UserId, msg.UserNickName, msg.OriginMsgId, msg.RawMsg)),
ReferOriginMsg: false,
FromMsg: msg,
}
}