From a150bdd0279542116d3ec309d6cc39104e812610 Mon Sep 17 00:00:00 2001 From: Dusty Pianalto Date: Tue, 5 Nov 2019 21:08:30 -0900 Subject: [PATCH] Fix bug when commands with no params are given a param --- morpheus/exts/command.py | 2 +- morpheus/exts/context.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/morpheus/exts/command.py b/morpheus/exts/command.py index 096ce2f..31e1d35 100644 --- a/morpheus/exts/command.py +++ b/morpheus/exts/command.py @@ -70,7 +70,7 @@ class Command: args = [] kwargs = {} if args_list: - params = self.parser.parse_args(args_list) + params, ctx.extra_params = self.parser.parse_known_args(args_list) for key, value in iterator: value: inspect.Parameter diff --git a/morpheus/exts/context.py b/morpheus/exts/context.py index e999d66..4e8f8ae 100644 --- a/morpheus/exts/context.py +++ b/morpheus/exts/context.py @@ -14,6 +14,7 @@ class Context: self.content: ContentBase = content self.called_with: str = called_with self.body: str = body + self.extra_params: list = [] async def send_text(self, body: str, formatted_body: str = None, format_type: str = 'org.matrix.custom.html'): await self.client.send_text(self.room, body, formatted_body, format_type)