fix support for non-consuming command spec args
This commit is contained in:
parent
c831984e20
commit
f3c31ec3c1
1 changed files with 10 additions and 9 deletions
|
@ -89,11 +89,11 @@ class Module(ModuleManager.BaseModule):
|
||||||
value = server.get_user(args[0], create=True)
|
value = server.get_user(args[0], create=True)
|
||||||
n = 1
|
n = 1
|
||||||
elif argument_type.type == "channelonly":
|
elif argument_type.type == "channelonly":
|
||||||
if not channel == None:
|
value = not channel == None
|
||||||
n = 0
|
n = 0
|
||||||
error = "Command not valid in private message"
|
error = "Command not valid in private message"
|
||||||
elif argument_type.type == "privateonly":
|
elif argument_type.type == "privateonly":
|
||||||
if channel == None:
|
value = channel == None
|
||||||
n = 0
|
n = 0
|
||||||
error = "Command not valid in private message"
|
error = "Command not valid in private message"
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
current_error = error
|
current_error = error
|
||||||
elif n > len(args):
|
elif n > len(args):
|
||||||
current_error = "Not enough arguments"
|
current_error = "Not enough arguments"
|
||||||
return [argument_type, -1, current_error or "Invalid arguments"]
|
return [None, -1, current_error or "Invalid arguments"]
|
||||||
|
|
||||||
@utils.hook("preprocess.command")
|
@utils.hook("preprocess.command")
|
||||||
@utils.kwarg("priority", EventManager.PRIORITY_HIGH)
|
@utils.kwarg("priority", EventManager.PRIORITY_HIGH)
|
||||||
|
@ -153,6 +153,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
else:
|
else:
|
||||||
value = None
|
value = None
|
||||||
|
|
||||||
|
if not argument_type == None and spec_argument.consume:
|
||||||
out[i] = value
|
out[i] = value
|
||||||
argument_type_name = argument_type.name()
|
argument_type_name = argument_type.name()
|
||||||
if argument_type_name:
|
if argument_type_name:
|
||||||
|
|
Loading…
Reference in a new issue