From f5ceb8927f2e7f2a9e29d62c8e4cef876f917249 Mon Sep 17 00:00:00 2001 From: Kyomotoi <1172294279@qq.com> Date: Sat, 6 Feb 2021 00:32:26 +0800 Subject: =?UTF-8?q?=F0=9F=8F=97=20=F0=9F=92=A9=20=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E7=BB=93=E6=9E=84=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=95=A5b=20BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/utils/__init__.py | 76 ------------------------------------------ 1 file changed, 76 deletions(-) (limited to 'ATRI/plugins/utils/__init__.py') diff --git a/ATRI/plugins/utils/__init__.py b/ATRI/plugins/utils/__init__.py index 4204cfb..e69de29 100644 --- a/ATRI/plugins/utils/__init__.py +++ b/ATRI/plugins/utils/__init__.py @@ -1,76 +0,0 @@ -import re -from nonebot.matcher import Matcher -from nonebot.plugin import on_command -from nonebot.adapters.cqhttp import Bot, Event - -from ATRI.config import UTILS_CONFIG -from ATRI.rule import is_in_ban_list, is_in_dormant, is_in_service - -from .data_source import Function - -# ===========================[Begin Command Processing]=========================== - - -__plugin_name_0__ = 'roll' -roll = on_command(UTILS_CONFIG['utils']['roll']['command'][0], - aliases=set(UTILS_CONFIG['utils']['roll']['command']), - rule=is_in_ban_list() & is_in_dormant() - & is_in_service(__plugin_name_0__)) - -__plugin_name_1__ = 'rcnb' -rcnbEncode = on_command( - UTILS_CONFIG['utils']['rcnb']['encode']['command'][0], - aliases=set( - UTILS_CONFIG['utils']['rcnb']['encode']['command']), - rule=is_in_ban_list() & is_in_dormant() - & is_in_service(__plugin_name_1__)) - -rcnbDecode = on_command( - UTILS_CONFIG['utils']['rcnb']['decode']['command'][0], - aliases=set( - UTILS_CONFIG['utils']['rcnb']['decode']['command']), - rule=is_in_ban_list() & is_in_dormant() - & is_in_service(__plugin_name_1__)) - - -@roll.handle() -async def _(bot, event: Event, state: dict) -> None: - args = str(event.get_message()).strip() - print(args) - if args: - state['result'] = args - -@roll.got('result', prompt='roll参数不能为空!..\ndemo: 1d10 或 2d10+3d10') -async def _(matcher: Matcher, bot: Bot, event: Event, state: dict) -> None: - resu = state['result'] - match = re.match(r'^([\dd+\s]+?)$', resu) - print(match) - if not match: - await matcher.reject('格式不-正-确!\ndemo: 1d10 或 2d10+3d10') - await bot.send(event, Function.roll_dice(par=resu)) - - -@rcnbEncode.handle() -async def _(bot, event: Event, state: dict) -> None: - args = str(event.get_message()).strip() - if args: - state['result'] = args - -@rcnbEncode.got('result', prompt='请告诉咱需要加密的字符~!') -async def _(bot: Bot, event: Event, state: dict) -> None: - print(state['result']) - await bot.send(event, Function.RCNB.encode(state['result'])) - - -@rcnbDecode.handle() -async def _(bot, event: Event, state: dict) -> None: - args = str(event.get_message()).strip() - if args: - state['result'] = args - -@rcnbEncode.got('result', prompt='请告诉咱需要解密的字符~!') -async def _(bot: Bot, event: Event, state: dict) -> None: - await bot.send(event, Function.RCNB.decode(state['result'])) - - -# ===========================[End Command Processing]============================= -- cgit v1.2.3