fix: 优化 kwReply 函数的错误处理逻辑,确保在获取关键词失败或结果为空时返回 nil

This commit is contained in:
lixiangwuxian 2025-04-16 00:03:06 +08:00
parent 6ae132a9c5
commit b9e88f8f6b

View File

@ -128,12 +128,8 @@ func unRegKw(keyword string, groupId int64) {
func kwReply(msg model.Message) (reply *model.Reply) {
w, err := kw.GetKW(msg.RawMsg, strconv.Itoa(int(msg.GroupInfo.GroupId)))
if err != nil {
return &model.Reply{
ReplyMsg: "",
ReferOriginMsg: false,
FromMsg: msg,
}
if err != nil || len(w) == 0 {
return nil
}
wlist := []string{}
for _, v := range w {