summaryrefslogtreecommitdiff
path: root/ATRI/plugins/curse.py
diff options
context:
space:
mode:
authorKyomotoi <[email protected]>2021-07-08 22:09:00 +0800
committerKyomotoi <[email protected]>2021-07-08 22:09:00 +0800
commitbe2747e4d4b820ca0f1f988d3b77a628da26fe7b (patch)
treee1a59dd79ecd973a7d704568dcdc018f1f1b651a /ATRI/plugins/curse.py
parenta4e1b9d1581d756ef79ad063d1c0bd6b2fd13c1d (diff)
downloadATRI-be2747e4d4b820ca0f1f988d3b77a628da26fe7b.tar.gz
ATRI-be2747e4d4b820ca0f1f988d3b77a628da26fe7b.tar.bz2
ATRI-be2747e4d4b820ca0f1f988d3b77a628da26fe7b.zip
🔖♻️🐛🔧🔥📝 更新版本:YHN-001-A03
🔖 更新版本至:YHN-001-A03 ✨ 新增插件: - 涩图 - 闲聊(文爱 ♻️ 重构: - Service - 所有插件 🐛 修复部分小bug 🔧 暂时移除部分设置 🔥 删除: - 插件:nsfw、wife。日后加回 - 插件 essential 中部分内容 📝 更新README
Diffstat (limited to 'ATRI/plugins/curse.py')
-rw-r--r--ATRI/plugins/curse.py57
1 files changed, 57 insertions, 0 deletions
diff --git a/ATRI/plugins/curse.py b/ATRI/plugins/curse.py
new file mode 100644
index 0000000..b2dbc05
--- /dev/null
+++ b/ATRI/plugins/curse.py
@@ -0,0 +1,57 @@
+from random import choice
+
+from nonebot.adapters.cqhttp import Bot, MessageEvent
+
+from ATRI.rule import is_in_service, to_bot
+from ATRI.service import Service
+from ATRI.utils import request
+from ATRI.utils.limit import FreqLimiter
+
+
+URL = "https://zuanbot.com/api.php?level=min&lang=zh_cn"
+
+_curse_flmt = FreqLimiter(3)
+_curse_flmt_notice = choice(["我看你是找🔨是吧", "给我适可而止阿!?", "扎布多得了😅", "z?是m吗?我凑那也太恐怖了", "?"])
+
+
+__doc__ = """
+口臭!你急了你急了!
+"""
+
+
+class Curse(Service):
+
+ def __init__(self):
+ Service.__init__(self, "口臭", __doc__, rule=is_in_service("口臭"))
+
+ @staticmethod
+ async def now() -> str:
+ res = await request.get(URL)
+ result = await res.text # type: ignore
+ return result
+
+
+normal_curse = Curse().on_command("口臭一下", "主命令,骂你一下", aliases={"骂我", "口臭"}, rule=to_bot())
+
+@normal_curse.handle()
+async def _deal_n_curse(bot: Bot, event: MessageEvent):
+ user_id = event.get_user_id()
+ if not _curse_flmt.check(user_id):
+ await normal_curse.finish(_curse_flmt_notice)
+
+ result = await Curse().now()
+ _curse_flmt.start_cd(user_id)
+ await normal_curse.finish(result)
+
+
+super_curse = Curse().on_regex(r"[来求有](.*?)骂我吗?", "有求必应")
+
+@super_curse.handle()
+async def _deal_s_curse(bot: Bot, event: MessageEvent):
+ user_id = event.get_user_id()
+ if not _curse_flmt.check(user_id):
+ await normal_curse.finish(_curse_flmt_notice)
+
+ result = await Curse().now()
+ _curse_flmt.start_cd(user_id)
+ await normal_curse.finish(result)