(interactions): Support message response.
This commit is contained in:
@@ -41,7 +41,6 @@ class AwaitableComponent:
|
||||
|
||||
def _check(interaction):
|
||||
valid = True
|
||||
print(interaction.custom_id)
|
||||
valid = valid and interaction.interaction_type == self.interaction_type
|
||||
valid = valid and interaction.custom_id == self.custom_id
|
||||
valid = valid and (check is None or check(interaction))
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user