Made us not respond in invalidCommand if the factoid isn't found.

This commit is contained in:
Jeremy Fincher 2004-02-16 08:30:59 +00:00
parent f752ad5747
commit 2fb2a6e8cd

View File

@ -162,7 +162,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
LIMIT 20""", key) LIMIT 20""", key)
return [t[0] for t in cursor.fetchall()] return [t[0] for t in cursor.fetchall()]
def _replyFactoids(self, irc, key, factoids, number=0): def _replyFactoids(self, irc, key, factoids, number=0, error=False):
if factoids: if factoids:
if number: if number:
try: try:
@ -178,7 +178,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
counter += 1 counter += 1
irc.replies(factoidsS, prefixer='%r could be ' % key, irc.replies(factoidsS, prefixer='%r could be ' % key,
joiner=', or ', onlyPrefixFirst=True) joiner=', or ', onlyPrefixFirst=True)
else: elif error:
irc.error('No factoid matches that key.') irc.error('No factoid matches that key.')
def invalidCommand(self, irc, msg, tokens): def invalidCommand(self, irc, msg, tokens):
@ -187,7 +187,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
if self.registryValue('replyWhenInvalidCommand', channel): if self.registryValue('replyWhenInvalidCommand', channel):
key = ' '.join(tokens) key = ' '.join(tokens)
factoids = self._lookupFactoid(channel, key) factoids = self._lookupFactoid(channel, key)
self._replyFactoids(irc, key, factoids) self._replyFactoids(irc, key, factoids, error=False)
def whatis(self, irc, msg, args): def whatis(self, irc, msg, args):
"""[<channel>] <key> [<number>] """[<channel>] <key> [<number>]