From 41f2792ed956ecc4a7cd962d6f129a348630ae89 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Wed, 2 Mar 2022 02:11:04 -0500 Subject: [PATCH] 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. --- discord/interactions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/discord/interactions.py b/discord/interactions.py index 8737c2d63..b952cffc6 100644 --- a/discord/interactions.py +++ b/discord/interactions.py @@ -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