mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
We can respond if we're addressed but there's no terminal question mark. Actions
on the other hand are the DEVIL! They get banished immediately.
This commit is contained in:
parent
3bf798e7a4
commit
c31512da01
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user