This commit is contained in:
parent
a16bf8cd84
commit
136102d1cf
4 changed files with 23 additions and 30 deletions
|
@ -114,12 +114,16 @@ async def parser(msg: Bot.MessageSession, require_enable_modules: bool = True, p
|
|||
if msg.target.sender_info.query.isInBlockList and not msg.target.sender_info.query.isInAllowList and not msg.target.sender_info.query.isSuperUser \
|
||||
or msg.target.sender_id in msg.options.get('ban', []):
|
||||
return
|
||||
msg.prefixes = command_prefix.copy() # 复制一份作为基础命令前缀
|
||||
|
||||
get_custom_alias = msg.options.get('command_alias')
|
||||
command_split: list = msg.trigger_msg.split(' ') # 切割消息
|
||||
if get_custom_alias:
|
||||
get_display_alias = get_custom_alias.get(msg.trigger_msg)
|
||||
get_display_alias = get_custom_alias.get(command_split[0])
|
||||
if get_display_alias:
|
||||
msg.trigger_msg = get_display_alias
|
||||
command_split[0] = get_display_alias # 将自定义别名替换为命令
|
||||
msg.trigger_msg = ' '.join(command_split) # 重新连接消息
|
||||
|
||||
msg.prefixes = command_prefix.copy() # 复制一份作为基础命令前缀
|
||||
get_custom_prefix = msg.options.get('command_prefix') # 获取自定义命令前缀
|
||||
if get_custom_prefix:
|
||||
msg.prefixes = get_custom_prefix + msg.prefixes # 混合
|
||||
|
@ -158,19 +162,19 @@ async def parser(msg: Bot.MessageSession, require_enable_modules: bool = True, p
|
|||
else:
|
||||
return await msg.send_message(msg.locale.t("parser.command.running.prompt"))
|
||||
|
||||
no_alias = False
|
||||
not_alias = False
|
||||
for moduleName in modules:
|
||||
if command.startswith(moduleName): # 判断此命令是否匹配一个实际的模块
|
||||
no_alias = True
|
||||
if not no_alias:
|
||||
not_alias = True
|
||||
if not not_alias:
|
||||
for um in current_unloaded_modules:
|
||||
if command.startswith(um):
|
||||
no_alias = True
|
||||
if not no_alias:
|
||||
not_alias = True
|
||||
if not not_alias:
|
||||
for em in err_modules:
|
||||
if command.startswith(em):
|
||||
no_alias = True
|
||||
if not no_alias: # 如果没有匹配到模块,则判断是否匹配命令别名
|
||||
not_alias = True
|
||||
if not not_alias: # 如果没有匹配到模块,则判断是否匹配命令别名
|
||||
alias_list = []
|
||||
for alias in ModulesManager.modules_aliases:
|
||||
if command.startswith(alias) and not command.startswith(ModulesManager.modules_aliases[alias]):
|
||||
|
@ -182,17 +186,9 @@ async def parser(msg: Bot.MessageSession, require_enable_modules: bool = True, p
|
|||
msg.trigger_msg = command # 触发该命令的消息,去除消息前缀
|
||||
command_first_word = command_split[0].lower()
|
||||
|
||||
sudo = False
|
||||
mute = False
|
||||
if command_first_word == 'mute':
|
||||
mute = True
|
||||
if command_first_word == 'sudo':
|
||||
if not msg.check_super_user():
|
||||
return await msg.send_message(msg.locale.t("parser.superuser.permission.denied"))
|
||||
sudo = True
|
||||
del command_split[0]
|
||||
command_first_word = command_split[0].lower()
|
||||
msg.trigger_msg = ' '.join(command_split)
|
||||
|
||||
in_mute = msg.muted
|
||||
if in_mute and not mute:
|
||||
|
@ -227,7 +223,7 @@ async def parser(msg: Bot.MessageSession, require_enable_modules: bool = True, p
|
|||
await msg.send_message(msg.locale.t("parser.superuser.permission.denied"))
|
||||
return
|
||||
elif not module.base:
|
||||
if command_first_word not in msg.enabled_modules and not sudo and require_enable_modules: # 若未开启
|
||||
if command_first_word not in msg.enabled_modules and require_enable_modules: # 若未开启
|
||||
await msg.send_message(
|
||||
msg.locale.t("parser.module.disabled.prompt", module=command_first_word,
|
||||
prefix=msg.prefixes[0]))
|
||||
|
|
|
@ -16,12 +16,11 @@
|
|||
"maimai.help.id": "根据 ID 查询歌曲或谱面信息。",
|
||||
"maimai.help.info": "查询歌曲的相关谱面成绩,ID 需要加入前缀“id”,空格用“_”替代。",
|
||||
"maimai.help.level": "根据等级搜索歌曲。",
|
||||
"maimai.help.maimai_regex.alias": "<ID> 有什么别名 查询歌曲的别名",
|
||||
"maimai.help.maimai_regex.alias": "<ID>有什么别名 查询歌曲的别名",
|
||||
"maimai.help.maimai_regex.desc": "更方便地使用 Maimai 相关命令。",
|
||||
"maimai.help.maimai_regex.grade": "<段位>段位认定表 输入段位名查询段位认定列表。",
|
||||
"maimai.help.maimai_regex.grade": "<段位>段位表 输入段位名查询段位认定列表。",
|
||||
"maimai.help.maimai_regex.info": "<ID 或别名>有什么分 [<用户名>] 输入 ID 或别名查询歌曲的相关谱面成绩,ID 需要加入前缀“id”。",
|
||||
"maimai.help.maimai_regex.plate": "<名牌板>进度 [<用户名>] 查看用户的名牌板完成进度",
|
||||
"maimai.help.maimai_regex.process": "<难度> <目标>进度 [<用户名>] 查看用户在对应等级的评价完成进度",
|
||||
"maimai.help.maimai_regex.random": "Maimai什么 随机一首歌曲",
|
||||
"maimai.help.maimai_regex.song": "<ID 或别名>是什么歌 输入 ID 或别名查询歌曲信息",
|
||||
"maimai.help.new": "查看当前版本最新歌曲。",
|
||||
|
|
|
@ -16,12 +16,11 @@
|
|||
"maimai.help.id": "根据 ID 查询歌曲或谱面信息。",
|
||||
"maimai.help.info": "查询歌曲的相关谱面成绩,ID 需要加入前缀“id”,空格用下划线替代。",
|
||||
"maimai.help.level": "根据等级搜索歌曲。",
|
||||
"maimai.help.maimai_regex.alias": "<ID> 有什么别名 查询歌曲的别名。",
|
||||
"maimai.help.maimai_regex.alias": "<ID>有什么别名 查询歌曲的别名。",
|
||||
"maimai.help.maimai_regex.desc": "更方便地使用 Maimai 相关命令。",
|
||||
"maimai.help.maimai_regex.grade": "<段位>段位认定表 输入段位名查询段位认定列表。",
|
||||
"maimai.help.maimai_regex.info": "<ID 或别名>有什么分 [<用户名>] 输入 ID 或别名查询歌曲的相关谱面成绩,ID 需要加入前缀“id”,空格用下划线替代。",
|
||||
"maimai.help.maimai_regex.grade": "<段位>段位表 输入段位名查询段位认定列表。",
|
||||
"maimai.help.maimai_regex.info": "<ID 或别名>有什么分 [<用户名>] 输入 ID 或别名查询歌曲的相关谱面成绩,ID 需要加入前缀“id”。",
|
||||
"maimai.help.maimai_regex.plate": "<名牌板>进度 [<用户名>] 查看用户的名牌板完成进度。",
|
||||
"maimai.help.maimai_regex.process": "<难度> <目标>进度 [<用户名>] 查看用户在对应等级的评价完成进度。",
|
||||
"maimai.help.maimai_regex.random": "随个[dx|标准][绿黄红紫白]<难度> 随机一首指定条件的歌曲。",
|
||||
"maimai.help.maimai_regex.song": "<ID 或别名>是什么歌 输入 ID 或别名查询歌曲信息,ID 需要加入前缀“id”。",
|
||||
"maimai.help.new": "查看当前版本最新歌曲。",
|
||||
|
|
|
@ -16,12 +16,11 @@
|
|||
"maimai.help.id": "依據 ID 查詢歌曲或譜面資訊。",
|
||||
"maimai.help.info": "查詢歌曲的相關譜面成績,ID 需要加入前綴「id」,空白用下橫線取代。",
|
||||
"maimai.help.level": "依據等級搜尋歌曲。",
|
||||
"maimai.help.maimai_regex.alias": "<ID> 有什麼別名 查詢歌曲的別名。",
|
||||
"maimai.help.maimai_regex.alias": "<ID>有什麼別名 查詢歌曲的別名。",
|
||||
"maimai.help.maimai_regex.desc": "更方便地使用 Maimai 相關指令。",
|
||||
"maimai.help.maimai_regex.grade": "<段位>段位認定表 輸入段位名查詢段位認定列表。",
|
||||
"maimai.help.maimai_regex.info": "<ID 或別名>有什麼分 [<使用者名稱>] 輸入 ID 或別名查詢歌曲相關譜面成績,ID 需要加入前綴「id」,空白用下橫線取代。",
|
||||
"maimai.help.maimai_regex.grade": "<段位>段位表 輸入段位名查詢段位認定列表。",
|
||||
"maimai.help.maimai_regex.info": "<ID 或別名>有什麼分 [<使用者名稱>] 輸入 ID 或別名查詢歌曲相關譜面成績,ID 需要加入前綴「id」。",
|
||||
"maimai.help.maimai_regex.plate": "<名牌板>進度 [<使用者名稱>] 查看使用者的名牌板完成進度。",
|
||||
"maimai.help.maimai_regex.process": "<難度> <目標>進度 [<使用者名稱>] 查看使用者在對應等級的評價完成進度。",
|
||||
"maimai.help.maimai_regex.random": "隨個[dx|標準][綠黃紅紫白]<難度> 隨機一首指定條件的歌曲。",
|
||||
"maimai.help.maimai_regex.song": "<ID 或別名>是什麼歌 輸入 ID 或別名查詢歌曲資訊,ID 需要加入前綴「id」。",
|
||||
"maimai.help.new": "查看目前版本最新歌曲。",
|
||||
|
|
Reference in a new issue