fix: 优化 kwReply 函数的错误处理逻辑,确保在获取关键词失败或结果为空时返回 nil
This commit is contained in:
parent
6ae132a9c5
commit
b9e88f8f6b
@ -128,12 +128,8 @@ func unRegKw(keyword string, groupId int64) {
|
|||||||
|
|
||||||
func kwReply(msg model.Message) (reply *model.Reply) {
|
func kwReply(msg model.Message) (reply *model.Reply) {
|
||||||
w, err := kw.GetKW(msg.RawMsg, strconv.Itoa(int(msg.GroupInfo.GroupId)))
|
w, err := kw.GetKW(msg.RawMsg, strconv.Itoa(int(msg.GroupInfo.GroupId)))
|
||||||
if err != nil {
|
if err != nil || len(w) == 0 {
|
||||||
return &model.Reply{
|
return nil
|
||||||
ReplyMsg: "",
|
|
||||||
ReferOriginMsg: false,
|
|
||||||
FromMsg: msg,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
wlist := []string{}
|
wlist := []string{}
|
||||||
for _, v := range w {
|
for _, v := range w {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user