aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tests/plugins/show.py
diff options
context:
space:
mode:
author简律纯 <i@jyunko.cn>2023-11-03 03:28:35 +0800
committer简律纯 <i@jyunko.cn>2023-11-03 03:28:35 +0800
commit5a2033860a328c4116f0ede2874915315e7487b0 (patch)
treef7b6d88d50ce33bd5fb52fbcfbca906738f412d6 /tests/plugins/show.py
parent4bf6db5200affc2f623aa02301020092c0789d19 (diff)
downloadHydroRoll-5a2033860a328c4116f0ede2874915315e7487b0.tar.gz
HydroRoll-5a2033860a328c4116f0ede2874915315e7487b0.zip
Co-authored-by: HadalFauna <HadalFauna@users.noreply.github.com>
Diffstat (limited to 'tests/plugins/show.py')
-rw-r--r--tests/plugins/show.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/plugins/show.py b/tests/plugins/show.py
new file mode 100644
index 0000000..b99c18c
--- /dev/null
+++ b/tests/plugins/show.py
@@ -0,0 +1,39 @@
+from iamai import Plugin
+from numpy.random import Generator
+from randomgen import AESCounter
+rg = Generator(AESCounter(12345, mode="sequence"))
+
+
+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