diff options
author | Kyomotoi <1172294279@qq.com> | 2021-02-06 00:32:26 +0800 |
---|---|---|
committer | Kyomotoi <1172294279@qq.com> | 2021-02-06 00:32:26 +0800 |
commit | f5ceb8927f2e7f2a9e29d62c8e4cef876f917249 (patch) | |
tree | 40b9dcd6b7d3db486054e3aa9b5a04d25fa2284e /ATRI/plugins/curse.py | |
parent | eb52fab79ada7efe6191e3a5f90179766feaded0 (diff) | |
download | ATRI-f5ceb8927f2e7f2a9e29d62c8e4cef876f917249.tar.gz ATRI-f5ceb8927f2e7f2a9e29d62c8e4cef876f917249.tar.bz2 ATRI-f5ceb8927f2e7f2a9e29d62c8e4cef876f917249.zip |
🏗 💩 更改项目结构,修复啥b BUG
Diffstat (limited to 'ATRI/plugins/curse.py')
-rw-r--r-- | ATRI/plugins/curse.py | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/ATRI/plugins/curse.py b/ATRI/plugins/curse.py deleted file mode 100644 index 2fa4986..0000000 --- a/ATRI/plugins/curse.py +++ /dev/null @@ -1,55 +0,0 @@ -from random import choice -from nonebot.plugin import on_command -from nonebot.adapters.cqhttp import Bot - -from ATRI.request import Request -from ATRI.utils import count_list, del_list_aim -from ATRI.config import CURSE_CONFIG -from ATRI.exceptions import InvalidRequest -from ATRI.service.plugin import Plugin -from ATRI.rule import is_in_ban_list, is_in_service, is_in_dormant, to_bot - - - -# ===========================[Begin Command Processing]=========================== - - -__plugin_name__ = 'curse' -__doc__ = """口臭一下""" -Plugin.register(__plugin_name__, "func", __doc__, - CURSE_CONFIG['curse']['command']) - -curse = on_command(CURSE_CONFIG['curse']['command'][0], - aliases=set(CURSE_CONFIG['curse']['command']), - rule=is_in_ban_list() & is_in_dormant() - & is_in_service(__plugin_name__) - & to_bot()) - -@curse.handle() -async def _(bot: Bot, event) -> None: - await bot.send( - event, await Function().curse(str(event.get_user_id()))) - - -# ===========================[End Command Processing]============================= - -curse_list = [] - - -class Function: - async def curse(self, user: str): - global curse_list - - if count_list(curse_list, user) == 3: - curse_list.append(user) - return choice(CURSE_CONFIG['curse']['times'][3]['repo']) - elif count_list(curse_list, user) == 6: - curse_list = del_list_aim(curse_list, user) - return choice(CURSE_CONFIG['curse']['times'][6]['repo']) - else: - try: - curse_list.append(user) - return str(await Request.get_text( - url=CURSE_CONFIG['curse']['url'])) - except InvalidRequest: - raise InvalidRequest('请求失败') |