From 724e13180ca1cc97077a4323f62ec59245b98369 Mon Sep 17 00:00:00 2001 From: snowy Date: Sun, 31 Mar 2024 09:03:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=BA=86=E5=AF=B9?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=91=BD=E4=BB=A4=E5=89=8D=E7=BC=80?= =?UTF-8?q?=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- liteyuki/plugins/liteyuki_npm/installer.py | 1 - liteyuki/utils/config.py | 8 +++++++- liteyuki/utils/message.py | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/liteyuki/plugins/liteyuki_npm/installer.py b/liteyuki/plugins/liteyuki_npm/installer.py index a7c7792..7a912d1 100644 --- a/liteyuki/plugins/liteyuki_npm/installer.py +++ b/liteyuki/plugins/liteyuki_npm/installer.py @@ -46,7 +46,6 @@ npm_alc = on_alconna( permission=SUPERUSER ) - @npm_alc.handle() async def _(result: Arparma, event: T_MessageEvent, bot: T_Bot): ulang = get_user_lang(str(event.user_id)) diff --git a/liteyuki/utils/config.py b/liteyuki/utils/config.py index 04483ba..ec8e3a2 100644 --- a/liteyuki/utils/config.py +++ b/liteyuki/utils/config.py @@ -24,9 +24,15 @@ def load_from_yaml(file: str) -> dict: yaml.dump(BasicConfig().dict(), f, default_flow_style=False) with open(file, "r", encoding="utf-8") as f: - conf = yaml.load(f, Loader=yaml.FullLoader) + conf = init_conf(yaml.load(f, Loader=yaml.FullLoader)) config = conf if conf is None: nonebot.logger.warning(f"Config file {file} is empty, use default config. please modify it and restart") conf = BasicConfig().dict() return conf + + +def init_conf(conf: dict) -> dict: + if "" not in conf.get("command_start", []): + conf["alconna_use_command_start"] = True + return conf diff --git a/liteyuki/utils/message.py b/liteyuki/utils/message.py index 3985045..fb8ca90 100644 --- a/liteyuki/utils/message.py +++ b/liteyuki/utils/message.py @@ -146,7 +146,7 @@ class Markdown: markdown格式的可点击回调按钮 """ - if "" not in config.get("command_start", ["/"]): + if "" not in config.get("command_start", ["/"]) and config.get("alconna_use_command_start", False): cmd = f"{config['command_start'][0]}{cmd}" return f"[{name}](mqqapi://aio/inlinecmd?command={quote(cmd)}&reply={str(reply).lower()}&enter={str(enter).lower()})"