From 917f85b7a001ed7773e8095b4389df39890cc2df Mon Sep 17 00:00:00 2001 From: Conatum Date: Tue, 26 Apr 2022 16:16:41 +0300 Subject: [PATCH] (interactions): Support `response_update`. --- bot/meta/interactions/interactions.py | 28 ++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/bot/meta/interactions/interactions.py b/bot/meta/interactions/interactions.py index c1ec18e9..055b577a 100644 --- a/bot/meta/interactions/interactions.py +++ b/bot/meta/interactions/interactions.py @@ -9,11 +9,15 @@ class Interaction: '_state' ) - async def response(self, content=None, embeds=None, components=None, ephemeral=None): + async def response(self, content=None, embed=None, embeds=None, components=None, ephemeral=None): data = {} if content is not None: data['content'] = str(content) + if embed is not None: + embeds = embeds or [] + embeds.append(embed) + if embeds is not None: data['embeds'] = [embed.to_dict() for embed in embeds] @@ -30,6 +34,28 @@ class Interaction: data ) + async def response_update(self, content=None, embed=None, embeds=None, components=None): + data = {} + if content is not None: + data['content'] = str(content) + + if embed is not None: + embeds = embeds or [] + embeds.append(embed) + + if embeds is not None: + data['embeds'] = [embed.to_dict() for embed in embeds] + + if components is not None: + data['components'] = [component.to_dict() for component in components] + + return await self._state.http.interaction_callback( + self.id, + self.token, + InteractionCallback.UPDATE_MESSAGE, + data + ) + async def response_deferred(self): return await self._state.http.interaction_callback( self.id,