diff --git a/disco/bot/command.py b/disco/bot/command.py index 6623a86..c51069e 100644 --- a/disco/bot/command.py +++ b/disco/bot/command.py @@ -241,8 +241,11 @@ class Command(object): )) try: - args = self.args.parse(event.args, ctx=event) + parsed_args = self.args.parse(event.args, ctx=event) except ArgumentError as e: raise CommandError(e.message) - return self.plugin.dispatch('command', self, event, *args, **self.context) + kwargs = {} + kwargs.update(self.context) + kwargs.update(parsed_args) + return self.plugin.dispatch('command', self, event, **kwargs) diff --git a/disco/bot/parser.py b/disco/bot/parser.py index fab4513..af71337 100644 --- a/disco/bot/parser.py +++ b/disco/bot/parser.py @@ -145,7 +145,7 @@ class ArgumentSet(object): """ Parse a string of raw arguments into this argument specification. """ - parsed = [] + parsed = {} for index, arg in enumerate(self.args): if not arg.required and index + arg.true_count > len(rawargs): @@ -171,7 +171,7 @@ class ArgumentSet(object): if (not arg.types or arg.types == ['str']) and isinstance(raw, list): raw = ' '.join(raw) - parsed.append(raw) + parsed[arg.name] = raw return parsed