aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tests/plugins/e.py
blob: be28e30bd52c5a36ec7910d99222bd15c00cab4d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from iamai import Plugin

class Exec(Plugin):
    async def handle(self) -> None:
        try:
            await self.event.reply(eval(self.event.raw_message[5:]))
        except Exception as e:
            await self.event.reply(f"ERROR:\n\t{e}")
            
    async def rule(self) -> bool:
        if self.event.adapter.name != "cqhttp":
            return False
        try:
            return self.event.message.get_plain_text().startswith(".show")
        except:
            return False