Skip to content
This repository was archived by the owner on Aug 28, 2019. It is now read-only.

Commit e73a805

Browse files
authored
Add missing data to Argument model
1 parent c9f777c commit e73a805

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

discord/app_commands/models.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,14 @@ class Argument:
745745
A list of choices for the command to choose from for this argument.
746746
parent: Union[:class:`AppCommand`, :class:`AppCommandGroup`]
747747
The parent application command that has this argument.
748+
channel_types: List[:class:`~discord.ChannelType`]
749+
The channel types that are allowed for this parameter.
750+
min_value: Optional[Union[:class:`int`, :class:`float`]]
751+
The minimum supported value for this parameter.
752+
max_value: Optional[Union[:class:`int`, :class:`float`]]
753+
The maximum supported value for this parameter.
754+
autocomplete: :class:`bool`
755+
Whether the argument has autocomplete.
748756
"""
749757

750758
__slots__ = (
@@ -753,6 +761,10 @@ class Argument:
753761
'description',
754762
'required',
755763
'choices',
764+
'channel_types',
765+
'min_value',
766+
'max_value',
767+
'autocomplete',
756768
'parent',
757769
'_state',
758770
)
@@ -772,6 +784,10 @@ def _from_data(self, data: ApplicationCommandOption) -> None:
772784
self.name: str = data['name']
773785
self.description: str = data['description']
774786
self.required: bool = data.get('required', False)
787+
self.min_value: Optional[Union[int, float]] = data.get('min_value')
788+
self.max_value: Optional[Union[int, float]] = data.get('max_value')
789+
self.autocomplete: bool = data.get('autocomplete', False)
790+
self.channel_types: List[ChannelType] = [try_enum(ChannelType, d) for d in data.get('channel_types', [])]
775791
self.choices: List[Choice[Union[int, float, str]]] = [
776792
Choice(name=d['name'], value=d['value']) for d in data.get('choices', [])
777793
]
@@ -783,6 +799,10 @@ def to_dict(self) -> ApplicationCommandOption:
783799
'description': self.description,
784800
'required': self.required,
785801
'choices': [choice.to_dict() for choice in self.choices],
802+
'channel_types': [channel_type.value for channel_type in self.channel_types],
803+
'min_value': self.min_value,
804+
'max_value': self.max_value,
805+
'autocomplete': self.autocomplete,
786806
'options': [],
787807
} # type: ignore # Type checker does not understand this literal.
788808

0 commit comments

Comments
 (0)