Skip to content

Commit

Permalink
refactor: make ApplicationContext.user non-optional (#1647)
Browse files Browse the repository at this point in the history
Co-authored-by: Lala Sabathil <lala@pycord.dev>
Co-authored-by: BobDotCom <71356958+BobDotCom@users.noreply.github.com>
  • Loading branch information
3 people committed Nov 18, 2022
1 parent 5a617ab commit ca7e541
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions discord/commands/context.py
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion discord/interactions.py
Expand Up @@ -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`
Expand Down

0 comments on commit ca7e541

Please sign in to comment.