aboutsummaryrefslogtreecommitdiff
path: root/src/core_modules
diff options
context:
space:
mode:
authorGravatar jesopo2020-01-24 17:00:55 +0000
committerGravatar jesopo2020-01-24 17:00:55 +0000
commit09fa9363b3ff6ea94f94aa32a3fd2747f71c5f99 (patch)
tree5809e103658fc126b9b0152285c1578c2300a21b /src/core_modules
parentadd some comments about all the command_spec spec types (diff)
signature
support e.g. "!r~channel" spec to change the context of "!cuser"
Diffstat (limited to 'src/core_modules')
-rw-r--r--src/core_modules/command_spec.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/core_modules/command_spec.py b/src/core_modules/command_spec.py
index 3e5d55bb..31370399 100644
--- a/src/core_modules/command_spec.py
+++ b/src/core_modules/command_spec.py
@@ -104,6 +104,8 @@ class Module(ModuleManager.BaseModule):
args = event["args_split"].copy()
out = []
+ kwargs = {"channel": channel}
+
for word in spec.split():
optional = word[0] == "?"
word = word[1:]
@@ -111,7 +113,8 @@ class Module(ModuleManager.BaseModule):
raw_spec_types = word.split("|")
spec_types = [t.replace("~", "", 1) for t in raw_spec_types]
- options = self._spec_chunk(server, channel, user, spec_types, args)
+ options = self._spec_chunk(server, kwargs["channel"], user,
+ spec_types, args)
found = None
first_error = None
@@ -124,7 +127,7 @@ class Module(ModuleManager.BaseModule):
if chunk:
if "~" in raw_spec_type:
- event["kwargs"][raw_spec_type.split("~", 1)[1]] = chunk
+ kwargs[raw_spec_type.split("~", 1)[1]] = chunk
found = True
args = args[n:]
@@ -137,4 +140,6 @@ class Module(ModuleManager.BaseModule):
if not optional and not found:
error = first_error or "Invalid arguments"
return utils.consts.PERMISSION_HARD_FAIL, error
- event["kwargs"]["spec"] = out
+
+ kwargs["spec"] = out
+ event["kwargs"].update(kwargs)