Fix the bot not responding to commands
This commit is contained in:
parent
c5c942d0f6
commit
b8981c825d
8
bot.py
8
bot.py
|
@ -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:
|
||||
|
|
Reference in New Issue