From ea3de3990b60c40d1117d1738bf7a496c7e066da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=9A=E7=BE=85=E7=8B=BC?= Date: Fri, 29 Sep 2023 10:46:57 +0800 Subject: [PATCH] Update --- modules/core/locales/en_us.json | 1 + modules/core/locales/zh_cn.json | 1 + modules/core/locales/zh_tw.json | 1 + modules/core/modules.py | 25 +++++++++++++++++++++++++ 4 files changed, 28 insertions(+) diff --git a/modules/core/locales/en_us.json b/modules/core/locales/en_us.json index 796e02c4..913d071f 100644 --- a/modules/core/locales/en_us.json +++ b/modules/core/locales/en_us.json @@ -17,6 +17,7 @@ "core.help.module.enable": "Enable single/multiple module(s).", "core.help.module.enable_all": "Enable all modules.", "core.help.module.help": "View help list.", + "core.help.module.help.legacy": "View help list. (Legacy)", "core.help.module.help.detail": "View details of a module.", "core.help.module.list": "View all available modules.", "core.help.module.load": "Load single/multiple module(s)", diff --git a/modules/core/locales/zh_cn.json b/modules/core/locales/zh_cn.json index 98a254d8..f8903371 100644 --- a/modules/core/locales/zh_cn.json +++ b/modules/core/locales/zh_cn.json @@ -17,6 +17,7 @@ "core.help.module.enable": "开启一个/多个模块。", "core.help.module.enable_all": "开启所有模块。", "core.help.module.help": "查看帮助列表。", + "core.help.module.help.legacy": "查看帮助列表。(旧版)", "core.help.module.help.detail": "查看一个模块的详细信息。", "core.help.module.list": "查看所有可用模块。", "core.help.module.load": "加载一个/多个模块。", diff --git a/modules/core/locales/zh_tw.json b/modules/core/locales/zh_tw.json index b05c9c17..c11b7c78 100644 --- a/modules/core/locales/zh_tw.json +++ b/modules/core/locales/zh_tw.json @@ -17,6 +17,7 @@ "core.help.module.enable": "啟用一個/多個模組。", "core.help.module.enable_all": "啟用所有模組。", "core.help.module.help": "檢視說明列表。", + "core.help.module.help.legacy": "檢視說明列表。(舊版)", "core.help.module.help.detail": "檢視一個模組的詳細資訊。", "core.help.module.list": "檢視所有可用模組。", "core.help.module.load": "載入一個/多個模組。", diff --git a/modules/core/modules.py b/modules/core/modules.py index bdb245be..220c44c2 100644 --- a/modules/core/modules.py +++ b/modules/core/modules.py @@ -452,6 +452,31 @@ async def _(msg: Bot.MessageSession): await msg.finish('\n'.join(help_msg)) +@hlp.command('legacy {{core.help.module.help.legacy}}') +async def _(msg: Bot.MessageSession): + module_list = ModulesManager.return_modules_list( + target_from=msg.target.target_from) + target_enabled_list = msg.enabled_modules + help_msg = [msg.locale.t("core.message.module.help.legacy.base")] + essential = [] + for x in module_list: + if module_list[x].base: + essential.append(module_list[x].bind_prefix) + help_msg.append(' | '.join(essential)) + help_msg.append(msg.locale.t("core.message.module.help.legacy.external")) + module_ = [] + for x in module_list: + if x in target_enabled_list: + module_.append(x) + help_msg.append(' | '.join(module_)) + help_msg.append( + msg.locale.t( + "core.message.module.help.legacy.more_information", + prefix=msg.prefixes[0], + help_url=Config('help_url'))) + await msg.finish('\n'.join(help_msg)) + + async def modules_help(msg: Bot.MessageSession): module_list = ModulesManager.return_modules_list( target_from=msg.target.target_from)