diff options
| author | Rapptz <[email protected]> | 2021-04-30 19:40:22 -0400 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2021-05-27 00:53:14 -0400 |
| commit | 7584834dd495689b473a21a29dc9bcfd4fce77bb (patch) | |
| tree | 719393a68ab909fc76edd38ab22adbe7ac2d4961 /discord/ui/view.py | |
| parent | Add support for setting interaction responses (diff) | |
| download | discord.py-7584834dd495689b473a21a29dc9bcfd4fce77bb.tar.xz discord.py-7584834dd495689b473a21a29dc9bcfd4fce77bb.zip | |
Only automatically defer if no response was given in callback
Diffstat (limited to 'discord/ui/view.py')
| -rw-r--r-- | discord/ui/view.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/discord/ui/view.py b/discord/ui/view.py index d263da09..64d9736c 100644 --- a/discord/ui/view.py +++ b/discord/ui/view.py @@ -181,8 +181,9 @@ class View: self.children.append(item) async def _scheduled_task(self, state: Any, item: Item, interaction: Interaction): - await state.http.create_interaction_response(interaction.id, interaction.token, type=6) await item.callback(interaction) + if not interaction.response._responded: + await interaction.response.defer() def dispatch(self, state: Any, item: Item, interaction: Interaction): asyncio.create_task(self._scheduled_task(state, item, interaction), name=f'discord-ui-view-dispatch-{self.id}') |