@@ -945,9 +945,7 @@ def command(self) -> Optional[Union['SlashCommand', 'MessageCommand', 'UserComma
945945 @property
946946 def focused_option (self ) -> 'InteractionDataOption' :
947947 """:class:`~discord.InteractionDataOption`: Returns the currently focused option."""
948- for option in self .data .options :
949- if option .focused :
950- return option
948+ return self .focused
951949
952950 @property
953951 def focused_option_name (self ) -> str :
@@ -1120,6 +1118,18 @@ def __new__(cls, *args, **kwargs):
11201118
11211119
11221120class InteractionDataOption :
1121+ """
1122+ Represents a slash-command option passed via a command.
1123+ By default, you only get in contact with this using :attr:`~discord.AutoCompleteInteraction.focused_option`.
1124+
1125+ Attributes
1126+ -----------
1127+ name: :class:`str`
1128+ The name of the option
1129+ type: :class:`~discord.OptionType`
1130+ The type of the option
1131+
1132+ """
11231133 def __init__ (self , * , state , data , guild = None , ** kwargs ):
11241134 self ._state = state
11251135 self ._data = data
@@ -1130,6 +1140,7 @@ def __init__(self, *, state, data, guild=None, **kwargs):
11301140
11311141 @property
11321142 def value (self ) -> Optional [Union [str , int , float ]]:
1143+ """Union[:class:`str`, :class:`int`, :class:`float`]: Returns the value of the option (what the user passed)"""
11331144 value = self ._data .get ('value' , None )
11341145 if value :
11351146 if isinstance (value , bool ): # because booleans are integers too
@@ -1144,10 +1155,12 @@ def value(self) -> Optional[Union[str, int, float]]:
11441155
11451156 @property
11461157 def focused (self ) -> bool :
1147- return bool (self ._data .get ('focused' , False ))
1158+ """:class:`bool`: Whether this option is currently focused (for autocomplete)"""
1159+ return self ._data .get ('focused' , False )
11481160
11491161 @property
11501162 def options (self ) -> Optional [List ['InteractionDataOption' ]]:
1163+ """Optional[List[:class:`InteractionDataOption`]]: For sub-command (groups) the sub-command or the actual options"""
11511164 options = self ._data .get ('options' , [])
11521165 return [InteractionDataOption (state = self ._state , data = option , guild = self ._guild ) for option in options ]
11531166
0 commit comments