Skip to content

Commit

Permalink
⚡️ updated PluginMetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
KafCoppelia committed Oct 12, 2023
1 parent 64b7fcf commit 69f9f76
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions nonebot_plugin_tarot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,59 +7,64 @@

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 <[email protected]>",
"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)


@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)

0 comments on commit 69f9f76

Please sign in to comment.