From f3bea281fbe19f5c8b4fae94b8832eee3ccfcf70 Mon Sep 17 00:00:00 2001 From: 简律纯 Date: Mon, 6 Nov 2023 23:29:40 +0800 Subject: refactor(file tree): `tests` -> `example` --- example/plugins/_bradge-kook-cqhttp.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 example/plugins/_bradge-kook-cqhttp.py (limited to 'example/plugins/_bradge-kook-cqhttp.py') diff --git a/example/plugins/_bradge-kook-cqhttp.py b/example/plugins/_bradge-kook-cqhttp.py new file mode 100644 index 0000000..4b2712d --- /dev/null +++ b/example/plugins/_bradge-kook-cqhttp.py @@ -0,0 +1,25 @@ +from iamai import Plugin + + +class Bradge(Plugin): + async def handle(self) -> None: + if self.event.adapter.name == "kook": + await self.bot.get_adapter("cqhttp").call_api( + "send_group_msg", + group_id=971050440, + message=f"[{self.event.adapter.name} - {self.event.extra.author.username}]\n{self.event.message}" + ) + elif self.event.adapter.name == "cqhttp": + if self.event.group_id == 971050440: + await self.bot.get_adapter("kook").call_api( + api="message/create", + target_id=1661426334688259, + content=f"[{self.event.adapter.name} - {self.event.sender.nickname}]\n{self.event.message}" + ) + + async def rule(self) -> bool: + if self.event.adapter.name not in ["cqhttp","kook"]: + return False + if self.event.type not in ["message","9",9]: + return False + return True \ No newline at end of file -- cgit v1.2.3-70-g09d2