summaryrefslogtreecommitdiff
path: root/ATRI/plugins/setu.py
diff options
context:
space:
mode:
Diffstat (limited to 'ATRI/plugins/setu.py')
-rw-r--r--ATRI/plugins/setu.py18
1 files changed, 13 insertions, 5 deletions
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