mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-18 22:51:01 +01:00
Added a raiseError optional argument to getChannel.
This commit is contained in:
parent
6771c24ca6
commit
19a86f3873
@ -50,7 +50,7 @@ import ircutils
|
|||||||
import callbacks
|
import callbacks
|
||||||
import structures
|
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.
|
"""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
|
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]):
|
elif ircutils.isChannel(msg.args[0]):
|
||||||
return msg.args[0]
|
return msg.args[0]
|
||||||
else:
|
else:
|
||||||
raise callbacks.Error, 'Command must be sent in a channel or ' \
|
if raiseError:
|
||||||
'include a channel in its arguments.'
|
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):
|
def getArgs(args, required=1, optional=0):
|
||||||
"""Take the required/optional arguments from args.
|
"""Take the required/optional arguments from args.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user