aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tests/plugins/_show.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/_show.py
parentc3508543f1aa6b29a5045bd846408c6141e77eca (diff)
downloadHydroRoll-5f1c3792cae7ab78e6b85ed69f61534854b633a8.tar.gz
HydroRoll-5f1c3792cae7ab78e6b85ed69f61534854b633a8.zip
feat: 优化架构
Diffstat (limited to 'tests/plugins/_show.py')
-rw-r--r--tests/plugins/_show.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/plugins/_show.py b/tests/plugins/_show.py
new file mode 100644
index 0000000..d009760
--- /dev/null
+++ b/tests/plugins/_show.py
@@ -0,0 +1,36 @@
+from iamai import Plugin
+import json
+
+class Exec(Plugin):
+
+ priority = 1
+
+ async def handle(self) -> None:
+ try:
+ content = [
+ {
+ "type": "node",
+ "data": {
+ "name": f"{self.event.sender.nickname}",
+ "uin": f"{self.event.sender.user_id}",
+ "content": [
+ {
+ "type": "text",
+ "data": {
+ "text": f"{eval(self.event.message.get_plain_text()[6:])}"
+ }
+ }
+ ]
+ }
+ }
+ ]
+ res = await self.event.adapter.send_group_forward_msg(group_id=int(self.event.group_id), messages=content)
+ except Exception as e:
+ await self.event.reply(f"ERROR!{e!r}")
+
+ async def rule(self) -> bool:
+ return (
+ self.event.type == "message"
+ and
+ self.event.message.get_plain_text().startswith(".show")
+ ) \ No newline at end of file