From 967a0282350855c8874b0a24f9bbbfb4bbbb681a Mon Sep 17 00:00:00 2001 From: shoucandanghehe Date: Tue, 25 Jun 2024 09:24:39 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=20AlconnaMatc?= =?UTF-8?q?her=20=E5=AF=B9=20Alconna=20=E7=9A=84=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E5=8F=98=E6=88=90=E5=BC=B1=E5=BC=95=E7=94=A8=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nonebot_plugin_tetris_stats/games/__init__.py | 18 ++++++++++-------- .../games/tetrio/__init__.py | 4 ++-- .../games/top/__init__.py | 4 ++-- .../games/tos/__init__.py | 4 ++-- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/nonebot_plugin_tetris_stats/games/__init__.py b/nonebot_plugin_tetris_stats/games/__init__.py index ca4ede1..773b856 100644 --- a/nonebot_plugin_tetris_stats/games/__init__.py +++ b/nonebot_plugin_tetris_stats/games/__init__.py @@ -9,15 +9,17 @@ from nonebot_plugin_alconna import AlcMatches, Alconna, At, CommandMeta, on_alco from .. import ns from ..utils.exception import MessageFormatError, NeedCatchError -alc = on_alconna( - Alconna( - ['tetris-stats', 'tstats'], - namespace=ns, - meta=CommandMeta( - description='俄罗斯方块相关游戏数据查询', - fuzzy_match=True, - ), +command: Alconna = Alconna( + ['tetris-stats', 'tstats'], + namespace=ns, + meta=CommandMeta( + description='俄罗斯方块相关游戏数据查询', + fuzzy_match=True, ), +) + +alc = on_alconna( + command=command, skip_for_unmatch=False, auto_send_output=True, use_origin=True, diff --git a/nonebot_plugin_tetris_stats/games/tetrio/__init__.py b/nonebot_plugin_tetris_stats/games/tetrio/__init__.py index 8fb065b..c20f700 100644 --- a/nonebot_plugin_tetris_stats/games/tetrio/__init__.py +++ b/nonebot_plugin_tetris_stats/games/tetrio/__init__.py @@ -3,7 +3,7 @@ from nonebot_plugin_alconna import At from ...utils.exception import MessageFormatError from ...utils.typing import Me -from .. import add_block_handlers, alc +from .. import add_block_handlers, alc, command from .api import Player from .api.typing import ValidRank from .constant import USER_ID, USER_NAME @@ -18,7 +18,7 @@ def get_player(user_id_or_name: str) -> Player | MessageFormatError: return MessageFormatError('用户名/ID不合法') -alc.command.add( +command.add( Subcommand( 'TETR.IO', Subcommand( diff --git a/nonebot_plugin_tetris_stats/games/top/__init__.py b/nonebot_plugin_tetris_stats/games/top/__init__.py index 9dbffbd..72439b2 100644 --- a/nonebot_plugin_tetris_stats/games/top/__init__.py +++ b/nonebot_plugin_tetris_stats/games/top/__init__.py @@ -3,7 +3,7 @@ from nonebot_plugin_alconna import At from ...utils.exception import MessageFormatError from ...utils.typing import Me -from .. import add_block_handlers, alc +from .. import add_block_handlers, alc, command from .api import Player from .constant import USER_NAME @@ -14,7 +14,7 @@ def get_player(name: str) -> Player | MessageFormatError: return MessageFormatError('用户名/ID不合法') -alc.command.add( +command.add( Subcommand( 'TOP', Subcommand( diff --git a/nonebot_plugin_tetris_stats/games/tos/__init__.py b/nonebot_plugin_tetris_stats/games/tos/__init__.py index 0e27025..f986da8 100644 --- a/nonebot_plugin_tetris_stats/games/tos/__init__.py +++ b/nonebot_plugin_tetris_stats/games/tos/__init__.py @@ -3,7 +3,7 @@ from nonebot_plugin_alconna import At from ...utils.exception import MessageFormatError from ...utils.typing import Me -from .. import add_block_handlers, alc +from .. import add_block_handlers, alc, command from .api import Player from .constant import USER_NAME @@ -19,7 +19,7 @@ def get_player(teaid_or_name: str) -> Player | MessageFormatError: return MessageFormatError('用户名/ID不合法') -alc.command.add( +command.add( Subcommand( 'TOS', Subcommand(