Skip to content

Commit 83091e0

Browse files
authored
Replaced the any with a typing.Literal
1 parent 6648315 commit 83091e0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

discord/interactions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def __init__(self, state, data):
7979
self.channel_id = int(data.get('channel_id', 0))
8080
self.__application_id = int(data.get('application_id'))
8181
self.message: typing.Union[Message, EphemeralMessage] = EphemeralMessage() if self.message_is_hidden else None
82-
self.member: typing.Optional[Member] = None
82+
self.member: typing.Optional[Member] = None
8383
self.user: typing.Optional[User] = None
8484
self.deferred = False
8585
self.deferred_hidden = False
@@ -98,7 +98,7 @@ def __repr__(self):
9898
"""Represents a :class:`discord.Interaction`-object."""
9999
return f'<Interaction {", ".join(["%s=%s" % (a, getattr(self, a)) for a in self.__slots__ if a[0] != "_"])}>'
100100

101-
async def defer(self, response_type: any([InteractionCallbackType.deferred_msg_with_source, InteractionCallbackType.deferred_update_msg, int]) = InteractionCallbackType.deferred_update_msg, hidden: bool = False) -> None:
101+
async def defer(self, response_type: typing.Literal[5, 6] = InteractionCallbackType.deferred_update_msg, hidden: bool = False) -> None:
102102
"""
103103
'Defers' the response.
104104
If :attr:`response_type` is `InteractionCallbackType.deferred_msg_with_source` it shows a loading state to the user.
@@ -107,7 +107,7 @@ async def defer(self, response_type: any([InteractionCallbackType.deferred_msg_w
107107

108108
if isinstance(response_type, int):
109109
response_type = InteractionCallbackType.from_value(response_type)
110-
if not response_type in (InteractionCallbackType.deferred_msg_with_source, InteractionCallbackType.deferred_update_msg):
110+
if response_type not in (InteractionCallbackType.deferred_msg_with_source, InteractionCallbackType.deferred_update_msg):
111111
raise ValueError('response_type has to bee discord.InteractionCallbackType.deferred_msg_with_source or discord.InteractionCallbackType.deferred_update_msg (e.g. 5 or 6), not %s.__class__.__name__' % response_type)
112112
if self.deferred:
113113
return log.warning("\033[91You have already responded to this Interaction!\033[0m")

0 commit comments

Comments
 (0)