mirror of
https://github.com/maubot/maubot
synced 2025-08-29 06:40:37 +00:00
Merge ae77f37639
into 905c91c285
This commit is contained in:
commit
e91377c637
1 changed files with 2 additions and 2 deletions
|
@ -173,7 +173,7 @@ class CommandHandler:
|
||||||
remaining_val, call_args[arg.name] = arg.match(
|
remaining_val, call_args[arg.name] = arg.match(
|
||||||
remaining_val.strip(), evt=evt, instance=self.__bound_instance__
|
remaining_val.strip(), evt=evt, instance=self.__bound_instance__
|
||||||
)
|
)
|
||||||
if arg.required and call_args[arg.name] is None:
|
if arg.required and (call_args[arg.name] is None or call_args[arg.name] == ""):
|
||||||
raise ValueError("Argument required")
|
raise ValueError("Argument required")
|
||||||
except ArgumentSyntaxError as e:
|
except ArgumentSyntaxError as e:
|
||||||
await evt.reply(e.message + (f"\n{self.__mb_usage__}" if e.show_usage else ""))
|
await evt.reply(e.message + (f"\n{self.__mb_usage__}" if e.show_usage else ""))
|
||||||
|
@ -392,7 +392,7 @@ class CustomArgument(Argument):
|
||||||
|
|
||||||
def match(self, val: str, **kwargs) -> Tuple[str, Any]:
|
def match(self, val: str, **kwargs) -> Tuple[str, Any]:
|
||||||
if self.pass_raw:
|
if self.pass_raw:
|
||||||
return self.matcher(val)
|
return "", self.matcher(val)
|
||||||
orig_val = val
|
orig_val = val
|
||||||
val = re.split(r"\s", val, 1)[0]
|
val = re.split(r"\s", val, 1)[0]
|
||||||
res = self.matcher(val)
|
res = self.matcher(val)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue