mirror of
https://github.com/TriM-Organization/LiteyukiBot-TriM.git
synced 2024-11-28 08:15:03 +08:00
fix: alconna
响应器命令头别名配置错误的问题
This commit is contained in:
parent
d3f3ee6dfa
commit
3065122059
@ -27,22 +27,25 @@ cmd_liteyuki = on_alconna(
|
||||
)
|
||||
|
||||
update_liteyuki = on_alconna(
|
||||
Alconna(
|
||||
["update-liteyuki", "更新轻雪"]
|
||||
aliases={"更新轻雪"},
|
||||
command=Alconna(
|
||||
"update-liteyuki"
|
||||
),
|
||||
permission=SUPERUSER
|
||||
)
|
||||
|
||||
reload_liteyuki = on_alconna(
|
||||
Alconna(
|
||||
["reload-liteyuki", "restart-liteyuki", "重启轻雪"]
|
||||
aliases={"重启轻雪"},
|
||||
command=Alconna(
|
||||
"reload-liteyuki"
|
||||
),
|
||||
permission=SUPERUSER
|
||||
)
|
||||
|
||||
cmd_config = on_alconna(
|
||||
Alconna(
|
||||
["config", "配置"],
|
||||
aliases={"配置"},
|
||||
command=Alconna(
|
||||
"config",
|
||||
Subcommand(
|
||||
"set",
|
||||
Args["key", str]["value", Any],
|
||||
|
@ -9,8 +9,9 @@ from .game import Minesweeper
|
||||
from nonebot_plugin_alconna import Alconna, on_alconna, Subcommand, Args, Arparma
|
||||
|
||||
minesweeper = on_alconna(
|
||||
Alconna(
|
||||
["minesweeper", "扫雷"],
|
||||
aliases={"扫雷"},
|
||||
command=Alconna(
|
||||
"minesweeper",
|
||||
Subcommand(
|
||||
"start",
|
||||
Args["row", int, 8]["col", int, 8]["mines", int, 10],
|
||||
|
@ -8,8 +8,6 @@ from liteyuki.utils.data import Database, LiteModel
|
||||
from liteyuki.utils.data_manager import GlobalPlugin, Group, InstalledPlugin, User, group_db, plugin_db, user_db
|
||||
from liteyuki.utils.ly_typing import T_MessageEvent
|
||||
|
||||
LNPM_COMMAND_START = "lnpm"
|
||||
|
||||
|
||||
class PluginTag(LiteModel):
|
||||
label: str
|
||||
|
@ -18,7 +18,7 @@ from nonebot_plugin_alconna import Alconna, Args, Subcommand, on_alconna
|
||||
|
||||
npm_alc = on_alconna(
|
||||
Alconna(
|
||||
["npm", "插件"],
|
||||
"npm",
|
||||
Subcommand(
|
||||
"update",
|
||||
alias=["u"],
|
||||
@ -43,9 +43,11 @@ npm_alc = on_alconna(
|
||||
alias=["l", "ls", "列表"],
|
||||
)
|
||||
),
|
||||
permission=SUPERUSER
|
||||
aliases={"插件"},
|
||||
permission=SUPERUSER,
|
||||
)
|
||||
|
||||
|
||||
@npm_alc.handle()
|
||||
async def _(result: Arparma, event: T_MessageEvent, bot: T_Bot):
|
||||
ulang = get_user_lang(str(event.user_id))
|
||||
|
@ -23,23 +23,26 @@ from nonebot_plugin_alconna import on_alconna, Alconna, Args, Arparma
|
||||
|
||||
list_plugins = on_alconna(
|
||||
Alconna(
|
||||
["list-plugins", "插件列表", "列出插件"],
|
||||
)
|
||||
"list-plugin",
|
||||
),
|
||||
aliases={"列出插件", "插件列表", "菜单"}
|
||||
)
|
||||
|
||||
toggle_plugin = on_alconna(
|
||||
Alconna(
|
||||
["enable", "disable", "启用", "停用"],
|
||||
"enable",
|
||||
Args["plugin_name", str],
|
||||
)
|
||||
),
|
||||
aliases={"disable", "启用", "停用"}
|
||||
)
|
||||
|
||||
toggle_plugin_global = on_alconna(
|
||||
Alconna(
|
||||
["enable-global", "disable-global", "全局启用", "全局停用"],
|
||||
"enable-global",
|
||||
Args["plugin_name", str],
|
||||
),
|
||||
permission=SUPERUSER
|
||||
permission=SUPERUSER,
|
||||
aliases={"disable-global", "全局启用", "全局停用"}
|
||||
)
|
||||
|
||||
|
||||
@ -117,8 +120,8 @@ async def _(result: Arparma, event: T_MessageEvent, bot: T_Bot):
|
||||
# 判断会话类型
|
||||
ulang = get_user_lang(str(event.user_id))
|
||||
plugin_module_name = result.args.get("plugin_name")
|
||||
|
||||
toggle = result.header_result in ["enable-plugin", "启用"] # 判断是启用还是停用
|
||||
# 支持对自定义command_start的判断
|
||||
toggle = result.header_result in [prefix+header for prefix in bot.config.command_start for header in ["enable-plugin", "启用"]] # 判断是启用还是停用
|
||||
|
||||
session_enable = get_plugin_session_enable(event, plugin_module_name) # 获取插件当前状态
|
||||
|
||||
@ -180,8 +183,8 @@ async def _(result: Arparma, event: T_MessageEvent, bot: T_Bot):
|
||||
# 判断会话类型
|
||||
ulang = get_user_lang(str(event.user_id))
|
||||
plugin_module_name = result.args.get("plugin_name")
|
||||
|
||||
toggle = result.header_result in ["enable-global", "全局启用"]
|
||||
# 支持对自定义command_start的判断
|
||||
toggle = result.header_result in [prefix + header for prefix in bot.config.command_start for header in ["enable-global", "全局启用"]]
|
||||
can_be_toggled = get_plugin_can_be_toggle(plugin_module_name)
|
||||
if not can_be_toggled:
|
||||
await toggle_plugin_global.finish(ulang.get("npm.plugin_cannot_be_toggled", NAME=plugin_module_name))
|
||||
@ -227,7 +230,6 @@ async def pre_handle(event: Event, matcher: Matcher):
|
||||
if not plugin_session_enable:
|
||||
raise IgnoredException("Plugin disabled in session")
|
||||
|
||||
|
||||
# @Bot.on_calling_api
|
||||
# async def _(bot: Bot, api: str, data: dict[str, any]):
|
||||
# nonebot.logger.info(f"Plugin Callapi: {api}: {data}")
|
||||
|
@ -15,7 +15,7 @@ from nonebot_plugin_alconna import Alconna, Args, Arparma, Subcommand, on_alconn
|
||||
|
||||
profile_alc = on_alconna(
|
||||
Alconna(
|
||||
["profile", "个人信息"],
|
||||
"profile",
|
||||
Subcommand(
|
||||
"set",
|
||||
Args["key", str]["value", str, None],
|
||||
@ -26,7 +26,8 @@ profile_alc = on_alconna(
|
||||
Args["key", str],
|
||||
alias=["g", "查询"],
|
||||
),
|
||||
)
|
||||
),
|
||||
aliases={"用户信息"}
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user