feat: enhance help inform structure and update command descriptions across various handlers

This commit is contained in:
lixiangwuxian
2024-12-26 11:35:34 +08:00
parent 48dd4b17de
commit a79991c4ff
18 changed files with 66 additions and 41 deletions

View File

@@ -4,6 +4,7 @@ import (
"git.lxtend.com/qqbot/constants"
"git.lxtend.com/qqbot/handler"
"git.lxtend.com/qqbot/model"
"git.lxtend.com/qqbot/util"
)
func init() {
@@ -11,9 +12,19 @@ func init() {
}
func help(msg model.Message) (reply model.Reply) {
helpInfo := `以下是支持的功能:`
for k, v := range handler.HelpInforms {
helpInfo += "\n" + k + " : " + v
var helpInfo string
if len(util.SplitN(msg.RawMsg, 2)) == 1 {
helpInfo = `!help [分类] 查看下面的分类功能`
for k := range handler.HelpInforms {
helpInfo += "\n" + k
}
} else {
category := util.SplitN(msg.RawMsg, 2)[1]
helpInfos := handler.HelpInforms[category]
helpInfo = `以下是` + category + `的功能:`
for _, v := range helpInfos {
helpInfo += "\n" + v.Trigger + " : " + v.Inform
}
}
return model.Reply{
ReplyMsg: helpInfo,