diff --git a/discord/commands/context.py b/discord/commands/context.py index 87bb89e74b..f20db34e9f 100644 --- a/discord/commands/context.py +++ b/discord/commands/context.py @@ -201,13 +201,13 @@ def message(self) -> Message | None: return self.interaction.message @cached_property - def user(self) -> Member | User | None: + def user(self) -> Member | User: """Returns the user that sent this context's command. Shorthand for :attr:`.Interaction.user`. """ - return self.interaction.user + return self.interaction.user # type: ignore # command user will never be None - author: Member | User | None = user + author = user @property def voice_client(self) -> VoiceProtocol | None: diff --git a/discord/interactions.py b/discord/interactions.py index 0233c88562..462d613374 100644 --- a/discord/interactions.py +++ b/discord/interactions.py @@ -104,7 +104,7 @@ class Interaction: application_id: :class:`int` The application ID that the interaction was for. user: Optional[Union[:class:`User`, :class:`Member`]] - The user or member that sent the interaction. + The user or member that sent the interaction. Will be `None` in PING interactions. message: Optional[:class:`Message`] The message that sent this interaction. token: :class:`str`