summaryrefslogtreecommitdiff
path: root/ATRI/plugins/setu/__init__.py
diff options
context:
space:
mode:
authorKyomotoi <[email protected]>2021-02-06 00:32:26 +0800
committerKyomotoi <[email protected]>2021-02-06 00:32:26 +0800
commitf5ceb8927f2e7f2a9e29d62c8e4cef876f917249 (patch)
tree40b9dcd6b7d3db486054e3aa9b5a04d25fa2284e /ATRI/plugins/setu/__init__.py
parenteb52fab79ada7efe6191e3a5f90179766feaded0 (diff)
downloadATRI-f5ceb8927f2e7f2a9e29d62c8e4cef876f917249.tar.gz
ATRI-f5ceb8927f2e7f2a9e29d62c8e4cef876f917249.tar.bz2
ATRI-f5ceb8927f2e7f2a9e29d62c8e4cef876f917249.zip
🏗 💩 更改项目结构,修复啥b BUG
Diffstat (limited to 'ATRI/plugins/setu/__init__.py')
-rw-r--r--ATRI/plugins/setu/__init__.py77
1 files changed, 0 insertions, 77 deletions
diff --git a/ATRI/plugins/setu/__init__.py b/ATRI/plugins/setu/__init__.py
deleted file mode 100644
index 2d630de..0000000
--- a/ATRI/plugins/setu/__init__.py
+++ /dev/null
@@ -1,77 +0,0 @@
-import random
-
-from nonebot.plugin import on_regex, on_command
-from nonebot.adapters.cqhttp.message import MessageSegment, Message
-from nonebot.adapters.cqhttp import Bot
-from nonebot.permission import SUPERUSER
-from nonebot.adapters.cqhttp.event import MessageEvent
-
-from ATRI.service.plugin import Plugin
-from ATRI.config import SETU_CONFIG
-from ATRI.utils import compress_image
-from ATRI.request import Request
-from ATRI.rule import is_in_service, is_in_ban_list, is_in_dormant
-
-from .data_source import setu_port
-
-# ===========================[Begin Command Processing]===========================
-
-resolution = 1
-
-
-__plugin_name__ = 'setu'
-__doc__ = """
-涩图,开冲!
-使用正则匹配
-"""
-Plugin.register(plugin_name=__plugin_name__, _type="func", doc=__doc__, command=SETU_CONFIG['setu']['command'])
-
-setu = on_regex('|'.join(SETU_CONFIG['setu']['command']),
- rule=is_in_service(__plugin_name__) & is_in_ban_list()
- & is_in_dormant())
-
-async def _(bot: Bot, event: MessageEvent) -> None:
- await bot.send(event, SETU_CONFIG['setu']['repo']['waiting'])
- rd = random.randint(1, 2)
-
- if rd == 1:
- data = await setu_port()
- else:
- data = await setu_port()
-
- if resolution == 1:
- img = compress_image(await Request.get_image(data['data'][0]['url']))
- else:
- img = await Request.get_image(data['data'][0]['url'])
-
- msg0 = (
- f"{data['data'][0]['title']}\n"
- f"pid: {data['data'][0]['pid']}\n"
- f"{MessageSegment.image(file=f'file:///{img}')}"
- )
-
- await setu.finish(Message(msg0))
-
-
-setu_resolution = on_command(SETU_CONFIG['admin']['command'][0],
- aliases=set(SETU_CONFIG['admin']['command']),
- permission=SUPERUSER)
-
-@setu_resolution.handle()
-async def _(bot, event: MessageEvent, state: dict) -> None:
- msg = str(event.get_message()).strip()
- if msg:
- state['msg'] = msg
-
-@setu_resolution.got('msg', prompt='请键入正确参数奥')
-async def _(bot, event: MessageEvent, state: dict) -> None:
- global resolution
- resolution = int(state['msg'])
-
- if resolution == 1:
- await setu_resolution.finish('完成~!已启用涩图压缩')
- else:
- await setu_resolution.finish('完成~!已关闭涩图压缩')
-
-# ===========================[End Command Processing]=============================