diff --git a/plugins/Infobot.py b/plugins/Infobot.py index 86a9a7391..f82ad8a27 100755 --- a/plugins/Infobot.py +++ b/plugins/Infobot.py @@ -246,6 +246,8 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp): _forceRe = re.compile(r'^no[,: -]+', re.I) def doPrivmsg(self, irc, msg): + if ircmsgs.isAction(msg): + return maybeAddressed = callbacks.addressed(irc.nick, msg, whenAddressedByNick=True) if maybeAddressed: @@ -258,6 +260,20 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp): if maybeForced != payload: self.force = True payload = maybeForced + # Let's make sure we dump out of Infobot if the privmsg is an actual + # command otherwise we could get multiple responses. + if self.addressed: + try: + tokens = callbacks.tokenize(payload) + getCallback = callbacks.findCallbackForCommand + commands = filter(None, map(lambda c, i=irc: getCallback(i, c), + tokens)) + if commands: + return + else: + payload += '?' + except SyntaxError: + pass if payload.endswith(irc.nick): self.addressed = True payload = payload[:-len(irc.nick)] @@ -360,7 +376,6 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp): utils.nItems('change', self.db.getResponseCount()))) - Class = Infobot # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: