From e73a805bd7472f60a285c7a07e814a1d3f3b44cc Mon Sep 17 00:00:00 2001 From: Soheab <33902984+Soheab@users.noreply.github.com> Date: Sun, 12 Jun 2022 21:33:08 +0200 Subject: [PATCH] Add missing data to Argument model --- discord/app_commands/models.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/discord/app_commands/models.py b/discord/app_commands/models.py index 0267911aa..47bbaa1ff 100644 --- a/discord/app_commands/models.py +++ b/discord/app_commands/models.py @@ -745,6 +745,14 @@ class Argument: A list of choices for the command to choose from for this argument. parent: Union[:class:`AppCommand`, :class:`AppCommandGroup`] The parent application command that has this argument. + channel_types: List[:class:`~discord.ChannelType`] + The channel types that are allowed for this parameter. + min_value: Optional[Union[:class:`int`, :class:`float`]] + The minimum supported value for this parameter. + max_value: Optional[Union[:class:`int`, :class:`float`]] + The maximum supported value for this parameter. + autocomplete: :class:`bool` + Whether the argument has autocomplete. """ __slots__ = ( @@ -753,6 +761,10 @@ class Argument: 'description', 'required', 'choices', + 'channel_types', + 'min_value', + 'max_value', + 'autocomplete', 'parent', '_state', ) @@ -772,6 +784,10 @@ class Argument: self.name: str = data['name'] self.description: str = data['description'] self.required: bool = data.get('required', False) + self.min_value: Optional[Union[int, float]] = data.get('min_value') + self.max_value: Optional[Union[int, float]] = data.get('max_value') + self.autocomplete: bool = data.get('autocomplete', False) + self.channel_types: List[ChannelType] = [try_enum(ChannelType, d) for d in data.get('channel_types', [])] self.choices: List[Choice[Union[int, float, str]]] = [ Choice(name=d['name'], value=d['value']) for d in data.get('choices', []) ] @@ -783,6 +799,10 @@ class Argument: 'description': self.description, 'required': self.required, 'choices': [choice.to_dict() for choice in self.choices], + 'channel_types': [channel_type.value for channel_type in self.channel_types], + 'min_value': self.min_value, + 'max_value': self.max_value, + 'autocomplete': self.autocomplete, 'options': [], } # type: ignore # Type checker does not understand this literal.