From 407ac34e52796c6f2973e5a016bf1c89b7d456e2 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Thu, 25 Sep 2003 08:22:16 +0000 Subject: [PATCH] Fix for RFE #811970, generalized not a command response. --- src/MiscCommands.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/MiscCommands.py b/src/MiscCommands.py index 0c29e9254..6673f3751 100755 --- a/src/MiscCommands.py +++ b/src/MiscCommands.py @@ -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] []