Change Interaction.user to not be Optional

This has potential to be a breaking change and Discord could definitely
royally screw this over in the future. However, as far as I can tell
every interaction has either a User or a Member so this change should
be kosher. I'm unaware of any interaction, even in the future, where
this is not true.

I hope these are not my famous last words.
This commit is contained in:
Rapptz 2022-03-02 02:11:04 -05:00
parent 45dc3d3df9
commit 41f2792ed9

View File

@ -94,7 +94,7 @@ class Interaction(Generic[ClientT]):
The channel ID the interaction was sent from.
application_id: :class:`int`
The application ID that the interaction was for.
user: Optional[Union[:class:`User`, :class:`Member`]]
user: Union[:class:`User`, :class:`Member`]
The user or member that sent the interaction.
message: Optional[:class:`Message`]
The message that sent this interaction.
@ -150,7 +150,7 @@ class Interaction(Generic[ClientT]):
except KeyError:
self.message = None
self.user: Optional[Union[User, Member]] = None
self.user: Union[User, Member] = MISSING
self._permissions: int = 0
# TODO: there's a potential data loss here