zhenxun_bot/plugins/draw_card/rule.py

38 lines
971 B
Python
Raw Normal View History

2021-05-26 20:08:13 +08:00
from nonebot.rule import Rule
from nonebot.adapters.cqhttp import Bot, MessageEvent
from nonebot.typing import T_State
2021-10-03 14:24:07 +08:00
from .config import (
GENSHIN_FLAG,
PRTS_FLAG,
PRETTY_FLAG,
GUARDIAN_FLAG,
PCR_FLAG,
AZUR_FLAG,
FGO_FLAG,
ONMYOJI_FLAG,
)
2021-05-26 20:08:13 +08:00
def is_switch(game_name: str) -> Rule:
async def _is_switch(bot: Bot, event: MessageEvent, state: T_State) -> bool:
2021-10-03 14:24:07 +08:00
if game_name == "prts":
2021-05-26 20:08:13 +08:00
return PRTS_FLAG
2021-10-03 14:24:07 +08:00
if game_name == "genshin":
2021-05-26 20:08:13 +08:00
return GENSHIN_FLAG
2021-10-03 14:24:07 +08:00
if game_name == "pretty":
2021-05-26 20:08:13 +08:00
return PRETTY_FLAG
2021-10-03 14:24:07 +08:00
if game_name == "guardian":
2021-05-26 20:08:13 +08:00
return GUARDIAN_FLAG
2021-10-03 14:24:07 +08:00
if game_name == "pcr":
2021-05-26 20:08:13 +08:00
return PCR_FLAG
2021-10-03 14:24:07 +08:00
if game_name == "azur":
2021-06-04 18:01:33 +08:00
return AZUR_FLAG
2021-10-03 14:24:07 +08:00
if game_name == "fgo":
2021-06-04 18:01:33 +08:00
return FGO_FLAG
2021-10-03 14:24:07 +08:00
if game_name == "onmyoji":
2021-06-04 18:01:33 +08:00
return ONMYOJI_FLAG
2021-05-26 20:08:13 +08:00
else:
return False
return Rule(_is_switch)