Browse Source

Add support for interaction followups

pull/6997/head
Rapptz 4 years ago
parent
commit
7b1c57ed60
  1. 13
      discord/interactions.py

13
discord/interactions.py

@ -35,7 +35,7 @@ from .user import User
from .member import Member from .member import Member
from .message import Message, Attachment from .message import Message, Attachment
from .object import Object from .object import Object
from .webhook.async_ import async_context from .webhook.async_ import async_context, Webhook
__all__ = ( __all__ = (
'Interaction', 'Interaction',
@ -100,6 +100,7 @@ class Interaction:
'_state', '_state',
'_session', '_session',
'_cs_response', '_cs_response',
'_cs_followup',
) )
def __init__(self, *, data: InteractionPayload, state: ConnectionState): def __init__(self, *, data: InteractionPayload, state: ConnectionState):
@ -158,6 +159,16 @@ class Interaction:
""":class:`InteractionResponse`: Returns an object responsible for handling responding to the interaction.""" """:class:`InteractionResponse`: Returns an object responsible for handling responding to the interaction."""
return InteractionResponse(self) return InteractionResponse(self)
@utils.cached_slot_property('_cs_followup')
def followup(self) -> Webhook:
""":class:`Webhook`: Returns the follow up webhook for follow up interactions."""
payload = {
'id': self.application_id,
'type': 3,
'token': self.token,
}
return Webhook.from_state(data=payload, state=self._state)
class InteractionResponse: class InteractionResponse:
"""Represents a Discord interaction response. """Represents a Discord interaction response.

Loading…
Cancel
Save