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.prefix = "!"
|
||||||
self.botop = "khuxkm"
|
self.botop = "khuxkm"
|
||||||
super(SOTDBot,self).__init__(*args)
|
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 not text.startswith(self.prefix):
|
||||||
|
if text in ("!botlist","!rollcall"):
|
||||||
|
self.do_botlist()
|
||||||
return
|
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
|
self.sourcenick = nick
|
||||||
args = text[len(self.prefix):].split()
|
args = text[len(self.prefix):].split()
|
||||||
cmd = args.pop(0)
|
cmd = args.pop(0)
|
||||||
|
@ -25,8 +27,6 @@ class SOTDBot(teambot.Handler,teambot.CommandHandlerMixin):
|
||||||
getattr(self,"do_"+cmd.lower())(*args)
|
getattr(self,"do_"+cmd.lower())(*args)
|
||||||
except TypeError as e:
|
except TypeError as e:
|
||||||
self.say(self.target,"{}: Usage: {}".format(nick,USAGE[command.lower()].format(self.prefix)))
|
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):
|
def do_admin(self,*args):
|
||||||
if self.sourcenick!=self.botop:
|
if self.sourcenick!=self.botop:
|
||||||
|
|
Reference in New Issue
Block a user