From 2fdfe6513efb98847b01027ae7d32cae43ae77f2 Mon Sep 17 00:00:00 2001 From: Kyomotoi <0w0@imki.moe> Date: Tue, 4 Oct 2022 13:22:25 +0800 Subject: =?UTF-8?q?=E2=9C=A8=20=E6=96=B0=E5=A2=9E=E6=8F=92=E4=BB=B6:=20?= =?UTF-8?q?=E8=B4=B4=E8=B4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/auto_tietie.py | 65 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 ATRI/plugins/auto_tietie.py (limited to 'ATRI') diff --git a/ATRI/plugins/auto_tietie.py b/ATRI/plugins/auto_tietie.py new file mode 100644 index 0000000..1a2c0bc --- /dev/null +++ b/ATRI/plugins/auto_tietie.py @@ -0,0 +1,65 @@ +from random import choice + +from nonebot.permission import SUPERUSER +from nonebot.adapters.onebot.v11 import MessageEvent +from nonebot.adapters.onebot.v11 import MessageSegment +from nonebot.adapters.onebot.v11.helpers import Cooldown + +from ATRI.service import Service +from ATRI.rule import is_in_service + + +_is_tietie = True +_tietie_wd = choice( + [ + "mua!", + "贴贴!", + MessageSegment.image( + file="https://jsd.imki.moe/gh/Kyomotoi/CDN@master/project/ATRI/wife0.jpg" + ), + MessageSegment.image( + file="https://jsd.imki.moe/gh/Kyomotoi/CDN@master/project/ATRI/wife1.jpg" + ), + MessageSegment.image( + file="https://jsd.imki.moe/gh/Kyomotoi/CDN@master/project/ATRI/wife2.jpg" + ), + MessageSegment.image( + file="https://jsd.imki.moe/gh/Kyomotoi/CDN@master/project/ATRI/wife3.jpg" + ), + ] +) + +tt = Service("贴贴", "全自动贴贴机", True, is_in_service("贴贴"), permission=SUPERUSER) + + +auto_tietie = tt.on_message("贴贴w", "只与维护者贴贴w, '不可以贴'以拒绝贴贴~, '来贴贴'以接受贴贴~", block=False, priority=11) + +@auto_tietie.handle([Cooldown(600)]) +async def _(event: MessageEvent): + if not _is_tietie: + await auto_tietie.finish() + + user_id = event.get_user_id() + at = MessageSegment.at(user_id) + result = at + _tietie_wd + await auto_tietie.finish(result) + + +no_tietie = tt.on_command("不可以贴", docs="拒绝贴贴") + + +@no_tietie.handle() +async def _(): + global _is_tietie + _is_tietie = False + await no_tietie.finish("好吧...") + + +yes_tietie = tt.on_command("来贴贴", docs="继续贴贴") + + +@yes_tietie.handle() +async def _(): + global _is_tietie + _is_tietie = True + await yes_tietie.finish("好欸!") -- cgit v1.2.3