aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tests/plugins/Webhook/__init__.py
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2023-08-13 12:23:35 +0800
committer简律纯 <i@jyunko.cn>2023-08-13 12:23:35 +0800
commit5f1c3792cae7ab78e6b85ed69f61534854b633a8 (patch)
tree335f1c73583762e83679aa588a00cc55fdd9ad79 /tests/plugins/Webhook/__init__.py
parentc3508543f1aa6b29a5045bd846408c6141e77eca (diff)
downloadHydroRoll-5f1c3792cae7ab78e6b85ed69f61534854b633a8.tar.gz
HydroRoll-5f1c3792cae7ab78e6b85ed69f61534854b633a8.zip
feat: 优化架构
Diffstat (limited to 'tests/plugins/Webhook/__init__.py')
-rw-r--r--tests/plugins/Webhook/__init__.py32
1 files changed, 0 insertions, 32 deletions
diff --git a/tests/plugins/Webhook/__init__.py b/tests/plugins/Webhook/__init__.py
deleted file mode 100644
index 23f4c3a..0000000
--- a/tests/plugins/Webhook/__init__.py
+++ /dev/null
@@ -1,32 +0,0 @@
-from iamai import Plugin
-from iamai.log import logger as log
-import asyncio
-import aiohttp
-
-payload = None
-
-class Webhook(Plugin):
- async def handle(self) -> None:
- global payload
- if payload:
- log.info(payload[:5])
- await self.bot.get_adapter("cqhttp").call_api(
- "send_group_msg",
- group_id=126211793,
- message=payload
- )
-
- async def rule(self) -> bool:
- global payload
- async with aiohttp.ClientSession() as session:
- try:
- async with session.get('http://localhost:3000') as response:
- try:
- payload = await response.text()
- log.info(payload)
- return True
- except Exception as e:
- log.info(f'Failed to fetch payload: {e}')
- return False
- except Exception as e:
- return False \ No newline at end of file