mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
Fixed the issue with responding when he shouldn't be by making try:finally
one fat bastard.
This commit is contained in:
parent
1cb576db03
commit
eeacd8bd22
@ -245,6 +245,7 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp):
|
||||
|
||||
_forceRe = re.compile(r'^no[,: -]+', re.I)
|
||||
def doPrivmsg(self, irc, msg):
|
||||
try:
|
||||
if ircmsgs.isCtcp(msg):
|
||||
return
|
||||
maybeAddressed = callbacks.addressed(irc.nick, msg,
|
||||
@ -259,13 +260,14 @@ 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.
|
||||
# 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),
|
||||
commands = filter(None,
|
||||
map(lambda c, i=irc: getCallback(i, c),
|
||||
tokens))
|
||||
if commands:
|
||||
return
|
||||
@ -278,7 +280,6 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp):
|
||||
payload = payload[:-len(irc.nick)]
|
||||
payload = payload.strip(', ') # Strip punctuation separating nick.
|
||||
payload += '?' # So doUnknown gets called.
|
||||
try:
|
||||
msg = ircmsgs.privmsg(msg.args[0], payload, prefix=msg.prefix)
|
||||
callbacks.PrivmsgCommandAndRegexp.doPrivmsg(self, irc, msg)
|
||||
finally:
|
||||
|
Loading…
Reference in New Issue
Block a user