Skip to content

Commit 9eb30ae

Browse files
authored
Merge pull request #309 from plun1331/patch-1
Support responding with deferred_channel_message to component interactions.
2 parents 7fbfaeb + be63b41 commit 9eb30ae

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

discord/interactions.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ async def defer(self, *, ephemeral: bool = False) -> None:
408408
-----------
409409
ephemeral: :class:`bool`
410410
Indicates whether the deferred message will eventually be ephemeral.
411-
This only applies for interactions of type :attr:`InteractionType.application_command`.
411+
If ``True`` for interactions of type :attr:`InteractionType.component`, this will defer ephemerally.
412412
413413
Raises
414414
-------
@@ -424,8 +424,12 @@ async def defer(self, *, ephemeral: bool = False) -> None:
424424
data: Optional[Dict[str, Any]] = None
425425
parent = self._parent
426426
if parent.type is InteractionType.component:
427-
defer_type = InteractionResponseType.deferred_message_update.value
428-
elif parent.type is InteractionType.application_command:
427+
if ephemeral:
428+
data = {'flags': 64}
429+
defer_type = InteractionResponseType.deferred_channel_message.value
430+
else:
431+
defer_type = InteractionResponseType.deferred_message_update.value
432+
elif parent.type is InteractionResponseType.application_command:
429433
defer_type = InteractionResponseType.deferred_channel_message.value
430434
if ephemeral:
431435
data = {'flags': 64}

0 commit comments

Comments
 (0)