Skip to content

Commit

Permalink
yes
Browse files Browse the repository at this point in the history
  • Loading branch information
cop-discord committed Jun 20, 2024
1 parent b47dedb commit 7f07551
Showing 1 changed file with 33 additions and 8 deletions.
41 changes: 33 additions & 8 deletions discord/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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|
Expand Down Expand Up @@ -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
-------
Expand Down Expand Up @@ -848,7 +842,6 @@ async def send_message(
allowed_mentions=allowed_mentions,
flags=flags,
view=view,
poll=poll,
)

http = parent._state.http
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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|
Expand Down

0 comments on commit 7f07551

Please sign in to comment.