summaryrefslogtreecommitdiff
path: root/ATRI/plugins/applet/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'ATRI/plugins/applet/__init__.py')
-rw-r--r--ATRI/plugins/applet/__init__.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/ATRI/plugins/applet/__init__.py b/ATRI/plugins/applet/__init__.py
new file mode 100644
index 0000000..d6e2ab6
--- /dev/null
+++ b/ATRI/plugins/applet/__init__.py
@@ -0,0 +1,21 @@
+from nonebot.adapters.onebot.v11 import MessageEvent
+from nonebot.adapters.onebot.v11.helpers import Cooldown
+
+from ATRI.log import logger as log
+from .data_source import Applet
+
+
+bili_applet = Applet().on_message("小程序检测", "小程序爪巴", block=False)
+
+
+@bili_applet.handle([Cooldown(3)])
+async def _fk_bili(event: MessageEvent):
+ msg = str(event.message)
+ try:
+ result, is_ok = await Applet().fk_bili(msg)
+ except Exception:
+ return
+ log.debug(result, is_ok)
+ if not is_ok:
+ return
+ await bili_applet.finish(result)