Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(typing): update send method types to support StandardSticker #1134

Merged
merged 4 commits into from Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/1134.misc.rst
@@ -0,0 +1 @@
Add :class:`StandardSticker` to ``stickers`` parameter type annotation of :meth:`Messageable.send` and :meth:`ForumChannel.create_thread`.
14 changes: 7 additions & 7 deletions disnake/abc.py
Expand Up @@ -42,7 +42,7 @@
from .partial_emoji import PartialEmoji
from .permissions import PermissionOverwrite, Permissions
from .role import Role
from .sticker import GuildSticker, StickerItem
from .sticker import GuildSticker, StandardSticker, StickerItem
from .ui.action_row import components_to_dict
from .utils import _overload_with_permissions
from .voice_client import VoiceClient, VoiceProtocol
Expand Down Expand Up @@ -1429,7 +1429,7 @@ async def send(
tts: bool = ...,
embed: Embed = ...,
file: File = ...,
stickers: Sequence[Union[GuildSticker, StickerItem]] = ...,
stickers: Sequence[Union[GuildSticker, StandardSticker, StickerItem]] = ...,
delete_after: float = ...,
nonce: Union[str, int] = ...,
suppress_embeds: bool = ...,
Expand All @@ -1450,7 +1450,7 @@ async def send(
tts: bool = ...,
embed: Embed = ...,
files: List[File] = ...,
stickers: Sequence[Union[GuildSticker, StickerItem]] = ...,
stickers: Sequence[Union[GuildSticker, StandardSticker, StickerItem]] = ...,
delete_after: float = ...,
nonce: Union[str, int] = ...,
suppress_embeds: bool = ...,
Expand All @@ -1471,7 +1471,7 @@ async def send(
tts: bool = ...,
embeds: List[Embed] = ...,
file: File = ...,
stickers: Sequence[Union[GuildSticker, StickerItem]] = ...,
stickers: Sequence[Union[GuildSticker, StandardSticker, StickerItem]] = ...,
delete_after: float = ...,
nonce: Union[str, int] = ...,
suppress_embeds: bool = ...,
Expand All @@ -1492,7 +1492,7 @@ async def send(
tts: bool = ...,
embeds: List[Embed] = ...,
files: List[File] = ...,
stickers: Sequence[Union[GuildSticker, StickerItem]] = ...,
stickers: Sequence[Union[GuildSticker, StandardSticker, StickerItem]] = ...,
delete_after: float = ...,
nonce: Union[str, int] = ...,
suppress_embeds: bool = ...,
Expand All @@ -1514,7 +1514,7 @@ async def send(
embeds: Optional[List[Embed]] = None,
file: Optional[File] = None,
files: Optional[List[File]] = None,
stickers: Optional[Sequence[Union[GuildSticker, StickerItem]]] = None,
stickers: Optional[Sequence[Union[GuildSticker, StandardSticker, StickerItem]]] = None,
delete_after: Optional[float] = None,
nonce: Optional[Union[str, int]] = None,
suppress_embeds: Optional[bool] = None,
Expand Down Expand Up @@ -1567,7 +1567,7 @@ async def send(
files: List[:class:`.File`]
A list of files to upload. Must be a maximum of 10.
This cannot be mixed with the ``file`` parameter.
stickers: Sequence[Union[:class:`.GuildSticker`, :class:`.StickerItem`]]
stickers: Sequence[Union[:class:`.GuildSticker`, :class:`.StandardSticker`, :class:`.StickerItem`]]
A list of stickers to upload. Must be a maximum of 3.
.. versionadded:: 2.0
Expand Down
14 changes: 7 additions & 7 deletions disnake/channel.py
Expand Up @@ -74,7 +74,7 @@
from .message import AllowedMentions, Message, PartialMessage
from .role import Role
from .state import ConnectionState
from .sticker import GuildSticker, StickerItem
from .sticker import GuildSticker, StandardSticker, StickerItem
from .threads import AnyThreadArchiveDuration, ThreadType
from .types.channel import (
CategoryChannel as CategoryChannelPayload,
Expand Down Expand Up @@ -3791,7 +3791,7 @@ async def create_thread(
file: File = ...,
suppress_embeds: bool = ...,
flags: MessageFlags = ...,
stickers: Sequence[Union[GuildSticker, StickerItem]] = ...,
stickers: Sequence[Union[GuildSticker, StandardSticker, StickerItem]] = ...,
allowed_mentions: AllowedMentions = ...,
view: View = ...,
components: Components = ...,
Expand All @@ -3812,7 +3812,7 @@ async def create_thread(
files: List[File] = ...,
suppress_embeds: bool = ...,
flags: MessageFlags = ...,
stickers: Sequence[Union[GuildSticker, StickerItem]] = ...,
stickers: Sequence[Union[GuildSticker, StandardSticker, StickerItem]] = ...,
allowed_mentions: AllowedMentions = ...,
view: View = ...,
components: Components = ...,
Expand All @@ -3833,7 +3833,7 @@ async def create_thread(
file: File = ...,
suppress_embeds: bool = ...,
flags: MessageFlags = ...,
stickers: Sequence[Union[GuildSticker, StickerItem]] = ...,
stickers: Sequence[Union[GuildSticker, StandardSticker, StickerItem]] = ...,
allowed_mentions: AllowedMentions = ...,
view: View = ...,
components: Components = ...,
Expand All @@ -3854,7 +3854,7 @@ async def create_thread(
files: List[File] = ...,
suppress_embeds: bool = ...,
flags: MessageFlags = ...,
stickers: Sequence[Union[GuildSticker, StickerItem]] = ...,
stickers: Sequence[Union[GuildSticker, StandardSticker, StickerItem]] = ...,
allowed_mentions: AllowedMentions = ...,
view: View = ...,
components: Components = ...,
Expand All @@ -3876,7 +3876,7 @@ async def create_thread(
files: List[File] = MISSING,
suppress_embeds: bool = MISSING,
flags: MessageFlags = MISSING,
stickers: Sequence[Union[GuildSticker, StickerItem]] = MISSING,
stickers: Sequence[Union[GuildSticker, StandardSticker, StickerItem]] = MISSING,
allowed_mentions: AllowedMentions = MISSING,
view: View = MISSING,
components: Components[MessageUIComponent] = MISSING,
Expand Down Expand Up @@ -3940,7 +3940,7 @@ async def create_thread(
files: List[:class:`.File`]
A list of files to upload. Must be a maximum of 10.
This cannot be mixed with the ``file`` parameter.
stickers: Sequence[Union[:class:`.GuildSticker`, :class:`.StickerItem`]]
stickers: Sequence[Union[:class:`.GuildSticker`, :class:`.StandardSticker`, :class:`.StickerItem`]]
A list of stickers to upload. Must be a maximum of 3.
allowed_mentions: :class:`.AllowedMentions`
Controls the mentions being processed in this message. If this is
Expand Down
6 changes: 3 additions & 3 deletions disnake/webhook/async_.py
Expand Up @@ -63,7 +63,7 @@
from ..mentions import AllowedMentions
from ..message import Attachment
from ..state import ConnectionState
from ..sticker import GuildSticker, StickerItem
from ..sticker import GuildSticker, StandardSticker, StickerItem
from ..types.message import Message as MessagePayload
from ..types.webhook import Webhook as WebhookPayload
from ..ui.action_row import Components
Expand Down Expand Up @@ -491,7 +491,7 @@ def handle_message_parameters_dict(
components: Optional[Components[MessageUIComponent]] = MISSING,
allowed_mentions: Optional[AllowedMentions] = MISSING,
previous_allowed_mentions: Optional[AllowedMentions] = None,
stickers: Sequence[Union[GuildSticker, StickerItem]] = MISSING,
stickers: Sequence[Union[GuildSticker, StandardSticker, StickerItem]] = MISSING,
thread_name: Optional[str] = None,
) -> DictPayloadParameters:
if files is not MISSING and file is not MISSING:
Expand Down Expand Up @@ -578,7 +578,7 @@ def handle_message_parameters(
components: Optional[Components[MessageUIComponent]] = MISSING,
allowed_mentions: Optional[AllowedMentions] = MISSING,
previous_allowed_mentions: Optional[AllowedMentions] = None,
stickers: Sequence[Union[GuildSticker, StickerItem]] = MISSING,
stickers: Sequence[Union[GuildSticker, StandardSticker, StickerItem]] = MISSING,
thread_name: Optional[str] = None,
) -> PayloadParameters:
params = handle_message_parameters_dict(
Expand Down