mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-06 09:56:09 +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:
@ -96,7 +96,7 @@ if TYPE_CHECKING:
|
||||
)
|
||||
from .poll import Poll
|
||||
from .threads import Thread
|
||||
from .ui.view import View
|
||||
from .ui.view import BaseView, View, LayoutView
|
||||
from .types.channel import (
|
||||
PermissionOverwrite as PermissionOverwritePayload,
|
||||
Channel as ChannelPayload,
|
||||
@ -1386,6 +1386,38 @@ class Messageable:
|
||||
async def _get_channel(self) -> MessageableChannel:
|
||||
raise NotImplementedError
|
||||
|
||||
@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 = ...,
|
||||
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 = ...,
|
||||
silent: bool = ...,
|
||||
) -> Message:
|
||||
...
|
||||
|
||||
@overload
|
||||
async def send(
|
||||
self,
|
||||
@ -1485,7 +1517,7 @@ class Messageable:
|
||||
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,
|
||||
silent: bool = False,
|
||||
poll: Optional[Poll] = None,
|
||||
@ -1558,7 +1590,7 @@ class Messageable:
|
||||
If set, overrides the :attr:`~discord.AllowedMentions.replied_user` attribute of ``allowed_mentions``.
|
||||
|
||||
.. 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
|
||||
@ -1656,7 +1688,7 @@ class Messageable:
|
||||
data = await state.http.send_message(channel.id, params=params)
|
||||
|
||||
ret = state.create_message(channel=channel, data=data)
|
||||
if view and not view.is_finished():
|
||||
if view and not view.is_finished() and view.is_dispatchable():
|
||||
state.store_view(view, ret.id)
|
||||
|
||||
if poll:
|
||||
|
Reference in New Issue
Block a user