Skip to content

Commit

Permalink
Add support for interaction followups
Browse files Browse the repository at this point in the history
  • Loading branch information
Rapptz committed May 30, 2021
1 parent 2ebd531 commit 7b1c57e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion discord/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from .member import Member
from .message import Message, Attachment
from .object import Object
from .webhook.async_ import async_context
from .webhook.async_ import async_context, Webhook

__all__ = (
'Interaction',
Expand Down Expand Up @@ -100,6 +100,7 @@ class Interaction:
'_state',
'_session',
'_cs_response',
'_cs_followup',
)

def __init__(self, *, data: InteractionPayload, state: ConnectionState):
Expand Down Expand Up @@ -158,6 +159,16 @@ def response(self) -> InteractionResponse:
""":class:`InteractionResponse`: Returns an object responsible for handling responding to the interaction."""
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:
"""Represents a Discord interaction response.
Expand Down

0 comments on commit 7b1c57e

Please sign in to comment.