mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +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)
|
_forceRe = re.compile(r'^no[,: -]+', re.I)
|
||||||
def doPrivmsg(self, irc, msg):
|
def doPrivmsg(self, irc, msg):
|
||||||
|
if ircmsgs.isAction(msg):
|
||||||
|
return
|
||||||
maybeAddressed = callbacks.addressed(irc.nick, msg,
|
maybeAddressed = callbacks.addressed(irc.nick, msg,
|
||||||
whenAddressedByNick=True)
|
whenAddressedByNick=True)
|
||||||
if maybeAddressed:
|
if maybeAddressed:
|
||||||
@ -258,6 +260,20 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
if maybeForced != payload:
|
if maybeForced != payload:
|
||||||
self.force = True
|
self.force = True
|
||||||
payload = maybeForced
|
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):
|
if payload.endswith(irc.nick):
|
||||||
self.addressed = True
|
self.addressed = True
|
||||||
payload = payload[:-len(irc.nick)]
|
payload = payload[:-len(irc.nick)]
|
||||||
@ -360,7 +376,6 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
utils.nItems('change', self.db.getResponseCount())))
|
utils.nItems('change', self.db.getResponseCount())))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Class = Infobot
|
Class = Infobot
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
Loading…
Reference in New Issue
Block a user