103103def get_help_text (isadmin , isgroup ):
104104 help_text = "通用指令:\n "
105105 for cmd , info in COMMANDS .items ():
106- if cmd == "auth" : # 隐藏认证指令
106+ if cmd == "auth" : #不提示认证指令
107107 continue
108108
109109 alias = ["#" + a for a in info ['alias' ]]
@@ -116,10 +116,11 @@ def get_help_text(isadmin, isgroup):
116116 # 插件指令
117117 plugins = PluginManager ().list_plugins ()
118118 for plugin in plugins :
119- if plugin != 'GODCMD' and plugin != 'BANWORDS' and plugin != 'FINISH' and plugins [plugin ].enabled :
120- print (plugin )
121- help_text += "\n %s:\n " % plugin
122- help_text += "#帮助 %s: 关于%s的详细帮助\n " % (plugin ,plugin )
119+ if plugins [plugin ].enabled and not plugins [plugin ].hidden :
120+ namecn = plugins [plugin ].namecn
121+ print (namecn )
122+ help_text += "\n %s:\n " % namecn
123+ help_text += "#帮助 %s: 关于%s的详细帮助\n " % (namecn ,namecn )
123124 help_text += PluginManager ().instances [plugin ].get_help_text (verbose = False )
124125
125126 if ADMIN_COMMANDS and isadmin :
@@ -130,7 +131,7 @@ def get_help_text(isadmin, isgroup):
130131 help_text += f": { info ['desc' ]} \n "
131132 return help_text
132133
133- @plugins .register (name = "Godcmd" , desc = "为你的机器人添加指令集,有用户和管理员两种角色,加载顺序请放在首位,初次运行后插件目录会生成配置文件, 填充管理员密码后即可认证" , version = "1.0" , author = "lanvent" , desire_priority = 999 )
134+ @plugins .register (name = "Godcmd" , desire_priority = 999 , hidden = True , desc = "为你的机器人添加指令集,有用户和管理员两种角色,加载顺序请放在首位,初次运行后插件目录会生成配置文件, 填充管理员密码后即可认证" , version = "1.0" , author = "lanvent" )
134135class Godcmd (Plugin ):
135136
136137 def __init__ (self ):
@@ -188,12 +189,16 @@ def on_handle_context(self, e_context: EventContext):
188189 if len (args ) == 0 :
189190 ok , result = True , get_help_text (isadmin , isgroup )
190191 elif len (args ) == 1 :
192+ # This can replace the helpp command
191193 plugins = PluginManager ().list_plugins ()
192- name = args [0 ].upper ()
193- if name in plugins and name != 'GODCMD' and name != 'BANWORDS' and plugins [name ].enabled :
194- ok , result = True , PluginManager ().instances [name ].get_help_text (verbose = True )
195- else :
196- ok , result = False , "unknown args"
194+ query_name = args [0 ].upper ()
195+ # search name and namecn
196+ for name , plugincls in plugins .items ():
197+ if query_name == name or query_name == plugincls .namecn :
198+ ok , result = True , PluginManager ().instances [name ].get_help_text (verbose = True )
199+ break
200+ if not ok :
201+ result = "unknown args"
197202 elif cmd == "set_openai_api_key" :
198203 if len (args ) == 1 :
199204 user_data = conf ().get_user_data (user )
@@ -208,18 +213,6 @@ def on_handle_context(self, e_context: EventContext):
208213 except Exception as e :
209214 ok , result = False , "你没有设置私有api_key"
210215 ok , result = True , "你的OpenAI私有api_key已清除"
211- # elif cmd == "helpp":
212- # if len(args) != 1:
213- # ok, result = False, "请提供插件名"
214- # else:
215- # plugins = PluginManager().list_plugins()
216- # name = args[0].upper()
217- # if name in plugins and plugins[name].enabled:
218- # ok, result = True, PluginManager().instances[name].get_help_text(isgroup=isgroup, isadmin=isadmin)
219- # else:
220- # ok, result= False, "插件不存在或未启用"
221- # elif cmd == "id":
222- # ok, result = True, f"用户id=\n{user}"
223216 elif cmd == "reset" :
224217 if bottype in (const .CHATGPT , const .OPEN_AI ):
225218 bot .sessions .clear_session (session_id )
0 commit comments