修复 FullMatchRule 中调用 ctx.NickName() 的 panic 问题 #902
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PrefixRule
的ctx.State
具有"args"
键,而FullMatchRule
并不具有,879948a 之后,ctx.NickName()
调用ctx.State["args"]
时访问了不存在的键,引发panic
。鉴于
name
变量仅用于输出用户的昵称,无需从args
/at
获取昵称,因此使用能够满足需求的ctx.CardOrNickName(ctx.Event.UserID)
来获取用户群昵称或昵称。