mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-03 08:35:53 +00:00
Add support for components V2
Co-authored-by: Michael H <michael@michaelhall.tech> Co-authored-by: Soheab <33902984+Soheab@users.noreply.github.com> Co-authored-by: owocado <24418520+owocado@users.noreply.github.com> Co-authored-by: Jay3332 <40323796+jay3332@users.noreply.github.com> Co-authored-by: Danny <1695103+Rapptz@users.noreply.github.com>
This commit is contained in:
@ -48,7 +48,7 @@ if TYPE_CHECKING:
|
||||
from discord.mentions import AllowedMentions
|
||||
from discord.sticker import GuildSticker, StickerItem
|
||||
from discord.message import MessageReference, PartialMessage
|
||||
from discord.ui import View
|
||||
from discord.ui.view import BaseView, View, LayoutView
|
||||
from discord.types.interactions import ApplicationCommandInteractionData
|
||||
from discord.poll import Poll
|
||||
|
||||
@ -628,6 +628,40 @@ class Context(discord.abc.Messageable, Generic[BotT]):
|
||||
except CommandError as e:
|
||||
await cmd.on_help_command_error(self, e)
|
||||
|
||||
@overload
|
||||
async def reply(
|
||||
self,
|
||||
*,
|
||||
file: File = ...,
|
||||
delete_after: float = ...,
|
||||
nonce: Union[str, int] = ...,
|
||||
allowed_mentions: AllowedMentions = ...,
|
||||
reference: Union[Message, MessageReference, PartialMessage] = ...,
|
||||
mention_author: bool = ...,
|
||||
view: LayoutView,
|
||||
suppress_embeds: bool = ...,
|
||||
ephemeral: bool = ...,
|
||||
silent: bool = ...,
|
||||
) -> Message:
|
||||
...
|
||||
|
||||
@overload
|
||||
async def reply(
|
||||
self,
|
||||
*,
|
||||
files: Sequence[File] = ...,
|
||||
delete_after: float = ...,
|
||||
nonce: Union[str, int] = ...,
|
||||
allowed_mentions: AllowedMentions = ...,
|
||||
reference: Union[Message, MessageReference, PartialMessage] = ...,
|
||||
mention_author: bool = ...,
|
||||
view: LayoutView,
|
||||
suppress_embeds: bool = ...,
|
||||
ephemeral: bool = ...,
|
||||
silent: bool = ...,
|
||||
) -> Message:
|
||||
...
|
||||
|
||||
@overload
|
||||
async def reply(
|
||||
self,
|
||||
@ -817,6 +851,40 @@ class Context(discord.abc.Messageable, Generic[BotT]):
|
||||
if self.interaction:
|
||||
await self.interaction.response.defer(ephemeral=ephemeral)
|
||||
|
||||
@overload
|
||||
async def send(
|
||||
self,
|
||||
*,
|
||||
file: File = ...,
|
||||
delete_after: float = ...,
|
||||
nonce: Union[str, int] = ...,
|
||||
allowed_mentions: AllowedMentions = ...,
|
||||
reference: Union[Message, MessageReference, PartialMessage] = ...,
|
||||
mention_author: bool = ...,
|
||||
view: LayoutView,
|
||||
suppress_embeds: bool = ...,
|
||||
ephemeral: bool = ...,
|
||||
silent: bool = ...,
|
||||
) -> Message:
|
||||
...
|
||||
|
||||
@overload
|
||||
async def send(
|
||||
self,
|
||||
*,
|
||||
files: Sequence[File] = ...,
|
||||
delete_after: float = ...,
|
||||
nonce: Union[str, int] = ...,
|
||||
allowed_mentions: AllowedMentions = ...,
|
||||
reference: Union[Message, MessageReference, PartialMessage] = ...,
|
||||
mention_author: bool = ...,
|
||||
view: LayoutView,
|
||||
suppress_embeds: bool = ...,
|
||||
ephemeral: bool = ...,
|
||||
silent: bool = ...,
|
||||
) -> Message:
|
||||
...
|
||||
|
||||
@overload
|
||||
async def send(
|
||||
self,
|
||||
@ -920,7 +988,7 @@ class Context(discord.abc.Messageable, Generic[BotT]):
|
||||
allowed_mentions: Optional[AllowedMentions] = None,
|
||||
reference: Optional[Union[Message, MessageReference, PartialMessage]] = None,
|
||||
mention_author: Optional[bool] = None,
|
||||
view: Optional[View] = None,
|
||||
view: Optional[BaseView] = None,
|
||||
suppress_embeds: bool = False,
|
||||
ephemeral: bool = False,
|
||||
silent: bool = False,
|
||||
@ -986,7 +1054,7 @@ class Context(discord.abc.Messageable, Generic[BotT]):
|
||||
This is ignored for interaction based contexts.
|
||||
|
||||
.. versionadded:: 1.6
|
||||
view: :class:`discord.ui.View`
|
||||
view: Union[:class:`discord.ui.View`, :class:`discord.ui.LayoutView`]
|
||||
A Discord UI View to add to the message.
|
||||
|
||||
.. versionadded:: 2.0
|
||||
|
Reference in New Issue
Block a user