diff --git a/commands.py b/commands.py index 768a98c..0f3e532 100644 --- a/commands.py +++ b/commands.py @@ -15,6 +15,9 @@ class Command: def notice(self, msg): self.util.notice(msg) + def action(self, msg): + self.util.action(msg) + def send(self, msg): self.util.send(msg) @@ -95,6 +98,8 @@ class Command: command = "help" elif cmd.startswith("echo "): command = "echo" + elif cmd.startswith("me "): + command = "me" elif cmd == "dbg" or cmd.startswith("dbg "): command = "dbg" elif cmd == "dbg2" or cmd.startswith("dbg2 "): @@ -109,7 +114,7 @@ class Command: ): command = "yt" else: - self.mesg(cmd) + #self.mesg(cmd) return if command not in self.config.cmd.disabled: eval(f"self.{command}()") @@ -157,6 +162,11 @@ class Command: """simple echo command""" mesg(cmd.split(" ", 1)[1]) + @cmd + def me(self, prefix, cmd, pm, line, admin, mesg): + """simple /me command""" + self.action(cmd.split(" ", 1)[1]) + @cmd def help(self, prefix, cmd, pm, line, admin, mesg): global adm_cmds diff --git a/util.py b/util.py index bb7f4af..d2e0f02 100644 --- a/util.py +++ b/util.py @@ -71,6 +71,9 @@ class Util: def mesg(self, msg: str, t=None): t,msg=self._m(msg,t) self.send(irctokens.build("PRIVMSG", [t, str(msg)]).format()) + def action(self, msg: str, t=None): + t,msg=self._m(msg,t) + self.send(irctokens.build("PRIVMSG", [t, "\x01ACTION "+str(msg)+"\x01"]).format()) def notice(self, msg: str, t=None): t,msg=self._m(msg,t) self.send(irctokens.build("NOTICE", [t, str(msg)]).format())