- if msg[0] == '*': # message may be addressed to bot by "*BOTNICK" trigger?
- if pieces[0][1:].lower() == self.nick.lower():
- pieces.pop(0) # command actually starts with next word
- msg = ' '.join(pieces) # command actually starts with next word
- elif not triggerused:
- if self.parent.haschanhook(target.lower()):
- for callback in self.parent.getchanhook(target.lower()):
- try:
- cbret = callback(self, user, chan, *pieces)
- except NotImplementedError:
- self.msg(user, "Command not implemented.")
- except:
- self.msg(user, "Command failed. Code: CBEXC%09.3f" % (time.time() % 100000))
- self.__debug_cbexception("chanhook", user=user, target=target, msg=msg)
- return # not to bot, don't process!
+ if pieces[0][:-1].lower() == self.nick.lower() and (pieces[0][-1] == ":" or pieces[0][-1] == ","):
+ pieces.pop(0) # command actually starts with next word
+ if len(pieces) == 0: # is there still anything left?
+ return
+ msg = ' '.join(pieces)
+ triggerused = True