diff --git a/nonebot_plugin_tarot/__init__.py b/nonebot_plugin_tarot/__init__.py index 3d2e772..e9bed99 100644 --- a/nonebot_plugin_tarot/__init__.py +++ b/nonebot_plugin_tarot/__init__.py @@ -7,45 +7,49 @@ from .data_source import tarot_manager -__tarot_version__ = "v0.4.0.post4" -__tarot_usages__ = f''' -塔罗牌 {__tarot_version__} +__plugin_version__ = "v0.4.1a1" +__plugin_usages__ = f""" +塔罗牌 {__plugin_version__} [占卜] 随机选取牌阵进行占卜 [塔罗牌] 得到单张塔罗牌回应 -[开启/启用/关闭/禁用]群聊转发 开启或关闭全局群聊转发'''.strip() +[开启/启用/关闭/禁用]群聊转发 开启或关闭全局群聊转发""".strip() __plugin_meta__ = PluginMetadata( name="塔罗牌", description="塔罗牌!魔法占卜🔮", - usage=__tarot_usages__, + usage=__plugin_usages__, + type="application", + homepage="https://github.com/MinatoAquaCrews/nonebot_plugin_tarot", extra={ "author": "KafCoppelia ", - "version": __tarot_version__ - } + "version": __plugin_version__, + }, + supported_adapters={"~onebot.v11"}, ) divine = on_command(cmd="占卜", priority=7) tarot = on_command(cmd="塔罗牌", priority=7) chain_reply_switch = on_regex( - pattern=r"^(开启|启用|关闭|禁用)群聊转发(模式)?$", permission=SUPERUSER, priority=7, block=True) + pattern=r"^(开启|启用|关闭|禁用)群聊转发(模式)?$", permission=SUPERUSER, priority=7, block=True +) @divine.handle() -async def general_divine(bot: Bot, matcher: Matcher, event: MessageEvent): - arg: str = event.get_plaintext() +async def general_divine(bot: Bot, matcher: Matcher, event: MessageEvent) -> None: + arg = event.get_plaintext() if "帮助" in arg[-2:]: - await matcher.finish(__tarot_usages__) + await matcher.finish(__plugin_usages__) await tarot_manager.divine(bot, matcher, event) @tarot.handle() async def _(matcher: Matcher, event: MessageEvent): - arg: str = event.get_plaintext() + arg = event.get_plaintext() if "帮助" in arg[-2:]: - await matcher.finish(__tarot_usages__) + await matcher.finish(__plugin_usages__) msg = await tarot_manager.onetime_divine() await matcher.finish(msg) @@ -53,13 +57,14 @@ async def _(matcher: Matcher, event: MessageEvent): @chain_reply_switch.handle() async def _(event: GroupMessageEvent): - arg: str = event.get_plaintext() + arg = event.get_plaintext() + base = "占卜群聊转发模式已{0}~" if arg[:2] == "开启" or arg[:2] == "启用": - tarot_manager.switch_chain_reply(True) - msg = "占卜群聊转发模式已开启~" + tarot_manager.is_chain_reply = True + msg = base.format("开启") else: - tarot_manager.switch_chain_reply(False) - msg = "占卜群聊转发模式已关闭~" + tarot_manager.is_chain_reply = False + msg = base.format("关闭") await chain_reply_switch.finish(msg)