Further improve exempting commands from prompt input.

This commit is contained in:
Krytarik Raido 2023-04-14 04:56:04 +02:00
parent e5ce04c99b
commit 10a1b41c47

View File

@ -60,12 +60,13 @@ def checkAddressed(irc, text, channel):
return False return False
def isCommand(irc, text): def isCommand(cbs, args):
args = text.lower().split(None, 2) for c in cbs:
for c in irc.callbacks: if args[0] == c.name().lower() and len(args) > 1:
if (args[0] == c.name().lower() and len(args) > 1 return isCommand([c], args[1:])
and c.isCommandMethod(args[1])) \ if c.isCommandMethod(args[0]):
or c.isCommandMethod(args[0]): return True
if isCommand(c.cbs, args):
return True return True
@ -4114,7 +4115,7 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
if message: if message:
self._logChan(irc, channel, message) self._logChan(irc, channel, message)
elif irc.nick == channel and not (checkAddressed(irc, text, channel) elif irc.nick == channel and not (checkAddressed(irc, text, channel)
or isCommand(irc, text)): or isCommand(irc.callbacks, text.lower().split())):
found = self.hasAskedItems(irc, msg.prefix, remove=False, prompt=False) found = self.hasAskedItems(irc, msg.prefix, remove=False, prompt=False)
if found: if found:
tokens = callbacks.tokenize('ChanTracker editAndMark %s %s' % (found[0], text)) tokens = callbacks.tokenize('ChanTracker editAndMark %s %s' % (found[0], text))