From 19a86f3873e5f86f716b1906d71bff8a66ea050a Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Thu, 5 Feb 2004 07:17:11 +0000 Subject: [PATCH] Added a raiseError optional argument to getChannel. --- src/privmsgs.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/privmsgs.py b/src/privmsgs.py index f96a08817..39c6d425f 100644 --- a/src/privmsgs.py +++ b/src/privmsgs.py @@ -50,7 +50,7 @@ import ircutils import callbacks import structures -def getChannel(msg, args): +def getChannel(msg, args, raiseError=True): """Returns the channel the msg came over or the channel given in args. If the channel was given in args, args is modified (the channel is @@ -70,8 +70,11 @@ def getChannel(msg, args): elif ircutils.isChannel(msg.args[0]): return msg.args[0] else: - raise callbacks.Error, 'Command must be sent in a channel or ' \ - 'include a channel in its arguments.' + if raiseError: + raise callbacks.Error, 'Command must be sent in a channel or ' \ + 'include a channel in its arguments.' + else: + return None def getArgs(args, required=1, optional=0): """Take the required/optional arguments from args.