(interactions): Support response_update.
This commit is contained in:
@@ -9,11 +9,15 @@ class Interaction:
|
|||||||
'_state'
|
'_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 = {}
|
data = {}
|
||||||
if content is not None:
|
if content is not None:
|
||||||
data['content'] = str(content)
|
data['content'] = str(content)
|
||||||
|
|
||||||
|
if embed is not None:
|
||||||
|
embeds = embeds or []
|
||||||
|
embeds.append(embed)
|
||||||
|
|
||||||
if embeds is not None:
|
if embeds is not None:
|
||||||
data['embeds'] = [embed.to_dict() for embed in embeds]
|
data['embeds'] = [embed.to_dict() for embed in embeds]
|
||||||
|
|
||||||
@@ -30,6 +34,28 @@ class Interaction:
|
|||||||
data
|
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):
|
async def response_deferred(self):
|
||||||
return await self._state.http.interaction_callback(
|
return await self._state.http.interaction_callback(
|
||||||
self.id,
|
self.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user