refactor: 优化 MsgInHandler 函数中的触发器匹配逻辑,使用字符串前缀匹配增强代码的灵活性和可读性
This commit is contained in:
parent
38184d91a8
commit
074e7e9ed9
@ -133,7 +133,7 @@ func MsgInHandler(msg model.Message) (reply *model.Reply) {
|
||||
for trigger, handler := range atHandlers {
|
||||
for _, textMsg := range msg.StructuredMsg {
|
||||
if textMsg.GetMessageType() == qq_message.TypeText {
|
||||
if util.SplitN(textMsg.(*qq_message.TextMessage).Data.Text, 2)[0] == trigger {
|
||||
if strings.HasPrefix(util.SplitN(textMsg.(*qq_message.TextMessage).Data.Text, 2)[0], trigger) {
|
||||
return auth.TryExecHandler(msg, handler.Level, handler.Handler)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user