Fix for RFE #811970, generalized not a command response.

This commit is contained in:
Jeremy Fincher 2003-09-25 08:22:16 +00:00
parent b1f0cb6647
commit 407ac34e52
1 changed files with 14 additions and 6 deletions

View File

@ -53,6 +53,19 @@ import ircutils
import privmsgs
import callbacks
def replyWhenNotCommand(irc, msg, notCommands):
"""This is called when supybot thinks he has received a command but the
apparent command actually isn't a command. Replace it with something that
suits your purposes more, if you want.
"""
if len(notCommands) == 1:
s = '%s is not a command.' % notCommands[0]
else:
s = '%s are not commands' % \
utils.commaAndify(notCommands)
irc.queueMsg(callbacks.reply(msg, s))
class MiscCommands(callbacks.Privmsg):
def doPrivmsg(self, irc, msg):
# This exists to be able to respond to attempts to command the bot
@ -74,12 +87,7 @@ class MiscCommands(callbacks.Privmsg):
if not callbacks.findCallbackForCommand(irc, command):
notCommands.append(repr(command))
if notCommands:
if len(notCommands) == 1:
s = '%s is not a command.' % notCommands[0]
else:
s = '%s are not commands' % \
utils.commaAndify(notCommands)
irc.queueMsg(callbacks.reply(msg, s))
replyWhenNotCommand(irc, msg, notCommands)
def list(self, irc, msg, args):
"""[--private] [<module name>]