Skip to content

Commit

Permalink
docs: specifically list attributes with changed annotations in intera…
Browse files Browse the repository at this point in the history
…ction subclasses
  • Loading branch information
shiftinv committed Nov 27, 2024
1 parent 1d949f6 commit 4b87ff5
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions disnake/interactions/application_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,9 @@ class GuildCommandInteraction(ApplicationCommandInteraction[ClientT]):
and :attr:`ApplicationCommand.integration_types` to :attr:`~ApplicationIntegrationTypes.guild` only.
Note that this does not apply to slash subcommands, subcommand groups, or autocomplete callbacks.
Additionally, annotations of some attributes are modified to match the expected types in guilds.
Additionally, the type annotations of :attr:`~Interaction.author`, :attr:`~Interaction.guild`,
:attr:`~Interaction.guild_id`, :attr:`~Interaction.guild_locale`, and :attr:`~Interaction.me`
are modified to match the expected types in guilds.
"""

author: Member
Expand All @@ -174,20 +176,22 @@ class GuildCommandInteraction(ApplicationCommandInteraction[ClientT]):


class UserCommandInteraction(ApplicationCommandInteraction[ClientT]):
"""An :class:`ApplicationCommandInteraction` subclass meant for annotations.
"""An :class:`ApplicationCommandInteraction` subclass meant for annotations
in user context menu commands.
No runtime behavior is changed but annotations are modified
to seem like the interaction is specifically a user command.
No runtime behavior is changed, but the type annotations of :attr:`~ApplicationCommandInteraction.target`
are modified to match the expected type with user commands.
"""

target: Union[User, Member]


class MessageCommandInteraction(ApplicationCommandInteraction[ClientT]):
"""An :class:`ApplicationCommandInteraction` subclass meant for annotations.
"""An :class:`ApplicationCommandInteraction` subclass meant for annotations
in message context menu commands.
No runtime behavior is changed but annotations are modified
to seem like the interaction is specifically a message command.
No runtime behavior is changed, but the type annotations of :attr:`~ApplicationCommandInteraction.target`
are modified to match the expected type with message commands.
"""

target: Message
Expand Down

0 comments on commit 4b87ff5

Please sign in to comment.