From bfb5cf2cf0eef58daa3359d38d08574d8c637b37 Mon Sep 17 00:00:00 2001 From: snowy Date: Wed, 24 Apr 2024 15:12:26 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20api=E5=91=BD=E4=BB=A4=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2=E9=94=99=E8=AF=AF=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- liteyuki/liteyuki_main/__init__.py | 5 +++-- liteyuki/liteyuki_main/core.py | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/liteyuki/liteyuki_main/__init__.py b/liteyuki/liteyuki_main/__init__.py index b4c4918..9f04f2d 100644 --- a/liteyuki/liteyuki_main/__init__.py +++ b/liteyuki/liteyuki_main/__init__.py @@ -2,7 +2,6 @@ from nonebot.plugin import PluginMetadata from .core import * from .loader import * -from .runtime import * from .dev_tools import * __author__ = "snowykami" @@ -17,6 +16,8 @@ __plugin_meta__ = PluginMetadata( } ) +from ..utils.base.language import Language, get_default_lang_code + print("\033[34m" + r""" __ ______ ________ ________ __ __ __ __ __ __ ______ / | / |/ |/ |/ \ / |/ | / |/ | / |/ | @@ -31,4 +32,4 @@ $$$$$$$$/ $$$$$$/ $$/ $$$$$$$$/ $$/ $$$$$$/ $$/ $$/ $$$$$$/ sys_lang = Language(get_default_lang_code()) nonebot.logger.info(sys_lang.get("main.current_language", LANG=sys_lang.get("language.name"))) -nonebot.logger.info(sys_lang.get("main.enable_webdash", URL=f"http://127.0.0.1:{config.get('port', 20216)}")) +# nonebot.logger.info(sys_lang.get("main.enable_webdash", URL=f"http://127.0.0.1:{config.get('port', 20216)}")) diff --git a/liteyuki/liteyuki_main/core.py b/liteyuki/liteyuki_main/core.py index f5e535e..6407fe6 100644 --- a/liteyuki/liteyuki_main/core.py +++ b/liteyuki/liteyuki_main/core.py @@ -31,11 +31,15 @@ markdown_image = common_db.first(StoredConfig(), default=StoredConfig()).config. @on_alconna( command=Alconna( "liteecho", + Args["text", str], ), permission=SUPERUSER ).handle() -async def _(bot: T_Bot, matcher: Matcher): - await matcher.finish(f"Hello, Liteyuki!\nBot {bot.self_id}") +async def _(bot: T_Bot, matcher: Matcher, result: Arparma): + if result.main_args.get("text"): + await matcher.finish(Message(unescape(result.main_args.get("text")))) + else: + await matcher.finish(f"Hello, Liteyuki!\nBot {bot.self_id}") @on_alconna(