(interactions): Support message response.

This commit is contained in:
2022-04-19 13:46:44 +03:00
parent 035a295962
commit 413b54c5ab
2 changed files with 21 additions and 1 deletions

View File

@@ -9,6 +9,27 @@ class Interaction:
'_state'
)
async def response(self, content=None, embeds=None, components=None, ephemeral=None):
data = {}
if content is not None:
data['content'] = str(content)
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]
if ephemeral is not None:
data['flags'] = 1 << 6
return await self._state.http.interaction_callback(
self.id,
self.token,
InteractionCallback.CHANNEL_MESSAGE_WITH_SOURCE,
data
)
async def response_deferred(self):
return await self._state.http.interaction_callback(
self.id,