From 133616655fd7bf39f0eea422b5057612cb3cccaa Mon Sep 17 00:00:00 2001 From: Kyomotoi <1172294279@qq.com> Date: Tue, 4 Aug 2020 23:58:43 +0800 Subject: =?UTF-8?q?[Fix]=20=E4=BF=AE=E5=A4=8D=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/setu.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'ATRI/plugins/setu.py') diff --git a/ATRI/plugins/setu.py b/ATRI/plugins/setu.py index 315803b..b178fef 100644 --- a/ATRI/plugins/setu.py +++ b/ATRI/plugins/setu.py @@ -3,6 +3,9 @@ import time import json import nonebot from nonebot import on_command, CommandSession +from nonebot import NLPSession +from nonebot.natural_language import NLPResult +from nonebot.plugin import on_natural_language from ATRI.modules import response # type: ignore @@ -15,17 +18,18 @@ URL = 'https://api.lolicon.app/setu/' SETU_REPLY = """Title: {title} Pid: {pid} -[CQ:image,file={setu}] +{setu} --------------- 完成时间:{time}s""" -@on_command('setu', aliases = ['图来'], only_to_me = False) -async def _(session: CommandSession): - with open(f'ATRI\\plugins\\switch\\switch.json', 'r') as f: +@on_command('setu', aliases = ['图来', '涩图', '涩图来'], only_to_me = False) +async def setu(session: CommandSession): + with open('ATRI/plugins/switch/switch.json', 'r') as f: data = json.load(f) if data["setu"] == 0: + await session.send('别急!正在找图!') start = time.perf_counter() values = { "apikey": apikey, @@ -46,4 +50,8 @@ async def _(session: CommandSession): ) else: - await session.send('该功能已被禁用...') \ No newline at end of file + await session.send('该功能已被禁用...') + +@on_natural_language(['涩图', '色图'], only_to_me = False) +async def _(session: NLPSession): + return NLPResult(60.0, ('setu'), None) \ No newline at end of file -- cgit v1.2.3