From e5c58089ceef5db8f76ad71ba7a2d5029e8b293b Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 11 Apr 2003 21:10:17 +0000 Subject: [PATCH] Must've forgotten to commit this earlier. --- src/privmsgs.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/privmsgs.py b/src/privmsgs.py index 202d75da4..8383765c7 100644 --- a/src/privmsgs.py +++ b/src/privmsgs.py @@ -50,14 +50,13 @@ def getChannel(msg, args): If the channel was given in args, args is modified (the channel is removed). """ - if ircutils.isChannel(msg.args[0]): + if args and ircutils.isChannel(args[0]): + return args.pop(0) + elif ircutils.isChannel(msg.args[0]): return msg.args[0] else: - if len(args) > 0: - return args.pop(0) - else: - raise callbacks.Error, 'Command must be sent in a channel or ' \ - 'include a channel in its arguments.' + raise callbacks.Error, 'Command must be sent in a channel or ' \ + 'include a channel in its arguments.' def getArgs(args, needed=1, optional=0): """Take the needed arguments from args.