From 7f07551fe81e75866a1a4343d00b218c4fc4095f Mon Sep 17 00:00:00 2001 From: cop <32881179+cop-discord@users.noreply.github.com> Date: Thu, 20 Jun 2024 13:52:04 -0700 Subject: [PATCH] yes --- discord/interactions.py | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/discord/interactions.py b/discord/interactions.py index 4ea2632..aeabd28 100644 --- a/discord/interactions.py +++ b/discord/interactions.py @@ -78,7 +78,6 @@ from .channel import VoiceChannel, StageChannel, TextChannel, ForumChannel, CategoryChannel, DMChannel, GroupChannel from .threads import Thread from .app_commands.commands import Command, ContextMenu - from .poll import Poll InteractionChannel = Union[ VoiceChannel, @@ -763,7 +762,6 @@ async def send_message( suppress_embeds: bool = False, silent: bool = False, delete_after: Optional[float] = None, - poll: Poll = MISSING, ) -> None: """|coro| @@ -807,10 +805,6 @@ async def send_message( then it is silently ignored. .. versionadded:: 2.1 - poll: :class:`~discord.Poll` - The poll to send with this message. - - .. versionadded:: 2.4 Raises ------- @@ -848,7 +842,6 @@ async def send_message( allowed_mentions=allowed_mentions, flags=flags, view=view, - poll=poll, ) http = parent._state.http @@ -956,7 +949,7 @@ async def edit_message( message_id = msg.id # If this was invoked via an application command then we can use its original interaction ID # Since this is used as a cache key for view updates - original_interaction_id = msg.interaction_metadata.id if msg.interaction_metadata is not None else None + original_interaction_id = msg.interaction.id if msg.interaction is not None else None else: message_id = None original_interaction_id = None @@ -1050,6 +1043,38 @@ async def send_modal(self, modal: Modal, /) -> None: self._parent._state.store_view(modal) self._response_type = InteractionResponseType.modal + async def require_premium(self) -> None: + """|coro| + + Sends a message to the user prompting them that a premium purchase is required for this interaction. + + This type of response is only available for applications that have a premium SKU set up. + + Raises + ------- + HTTPException + Sending the response failed. + InteractionResponded + This interaction has already been responded to before. + """ + if self._response_type: + raise InteractionResponded(self._parent) + + parent = self._parent + adapter = async_context.get() + http = parent._state.http + + params = interaction_response_params(InteractionResponseType.premium_required.value) + 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.premium_required + async def autocomplete(self, choices: Sequence[Choice[ChoiceT]]) -> None: """|coro|