diff options
| author | 2023-11-06 23:29:40 +0800 | |
|---|---|---|
| committer | 2023-11-06 23:29:40 +0800 | |
| commit | f3bea281fbe19f5c8b4fae94b8832eee3ccfcf70 (patch) | |
| tree | 90132b80b643cdf5e3295e93dda542c27bb5283a /example/plugins/show.py | |
| parent | 70c118d37cd784861bec712000d7014302591256 (diff) | |
| download | HydroRoll-f3bea281fbe19f5c8b4fae94b8832eee3ccfcf70.tar.gz HydroRoll-f3bea281fbe19f5c8b4fae94b8832eee3ccfcf70.zip | |
refactor(file tree): `tests` -> `example`
Diffstat (limited to 'example/plugins/show.py')
| -rw-r--r-- | example/plugins/show.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/example/plugins/show.py b/example/plugins/show.py new file mode 100644 index 0000000..b99c18c --- /dev/null +++ b/example/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 |
