Browse Source
Add support for launch_activity interaction response
master
Joosemi02
3 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
47 additions and
0 deletions
-
discord/enums.py
-
discord/interactions.py
|
|
@ -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') |
|
|
|