mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-07-10 20:08:08 +00:00
Add support for launch_activity interaction response
This commit is contained in:
parent
2175bd51c0
commit
59546a4851
@ -621,6 +621,7 @@ class InteractionResponseType(Enum):
|
||||
autocomplete_result = 8
|
||||
modal = 9 # for modals
|
||||
# premium_required = 10 (deprecated)
|
||||
launch_activity = 12
|
||||
|
||||
|
||||
class VideoQualityMode(Enum):
|
||||
|
@ -1296,6 +1296,52 @@ class InteractionResponse(Generic[ClientT]):
|
||||
|
||||
self._response_type = InteractionResponseType.autocomplete_result
|
||||
|
||||
async def launch_activity(self) -> InteractionCallbackResponse[ClientT]:
|
||||
"""|coro|
|
||||
|
||||
Responds to this interaction by launching the activity associated with the app.
|
||||
Only available for apps with activities enabled.
|
||||
|
||||
.. versionadded:: 2.6
|
||||
|
||||
Raises
|
||||
-------
|
||||
HTTPException
|
||||
Launching the activity failed.
|
||||
InteractionResponded
|
||||
This interaction has already been responded to before.
|
||||
|
||||
Returns
|
||||
-------
|
||||
:class:`InteractionCallbackResponse`
|
||||
The interaction callback data.
|
||||
"""
|
||||
if self._response_type:
|
||||
raise InteractionResponded(self._parent)
|
||||
|
||||
parent = self._parent
|
||||
|
||||
adapter = async_context.get()
|
||||
http = parent._state.http
|
||||
|
||||
params = interaction_response_params(InteractionResponseType.launch_activity.value)
|
||||
response = await adapter.create_interaction_response(
|
||||
parent.id,
|
||||
parent.token,
|
||||
session=parent._session,
|
||||
proxy=http.proxy,
|
||||
proxy_auth=http.proxy_auth,
|
||||
params=params,
|
||||
)
|
||||
self._response_type = InteractionResponseType.launch_activity
|
||||
|
||||
return InteractionCallbackResponse(
|
||||
data=response,
|
||||
parent=self._parent,
|
||||
state=self._parent._state,
|
||||
type=self._response_type,
|
||||
)
|
||||
|
||||
|
||||
class _InteractionMessageState:
|
||||
__slots__ = ('_parent', '_interaction')
|
||||
|
Loading…
x
Reference in New Issue
Block a user