Fix the bot not responding to commands

This commit is contained in:
Robert Miles 2018-11-15 16:52:19 -05:00
parent c5c942d0f6
commit b8981c825d
1 changed files with 4 additions and 4 deletions

8
bot.py
View File

@ -13,10 +13,12 @@ class SOTDBot(teambot.Handler,teambot.CommandHandlerMixin):
self.prefix = "!"
self.botop = "khuxkm"
super(SOTDBot,self).__init__(*args)
def handle_command(self,target,nick,text):
def on_pubmsg(self,target,nick,text):
if not text.startswith(self.prefix):
if text in ("!botlist","!rollcall"):
self.do_botlist()
return
self.target = target if target!=self._bot.nick else nick
self.target = target if target!=self._bot.bot_nick else nick
self.sourcenick = nick
args = text[len(self.prefix):].split()
cmd = args.pop(0)
@ -25,8 +27,6 @@ class SOTDBot(teambot.Handler,teambot.CommandHandlerMixin):
getattr(self,"do_"+cmd.lower())(*args)
except TypeError as e:
self.say(self.target,"{}: Usage: {}".format(nick,USAGE[command.lower()].format(self.prefix)))
elif text in ("!botlist","!rollcall"):
self.do_botlist()
def do_admin(self,*args):
if self.sourcenick!=self.botop: