added /me

This commit is contained in:
jan6 2021-10-08 00:22:53 +03:00
parent 0c84a52bc7
commit fcf70d344d
2 changed files with 14 additions and 1 deletions

View File

@ -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

View File

@ -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())