From 60d82cf908e537e4ea5f068a31377452a9d6db3d Mon Sep 17 00:00:00 2001 From: Nadir Chowdhury Date: Sat, 31 Jul 2021 02:25:41 +0100 Subject: implement guild stickers --- discord/abc.py | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'discord/abc.py') diff --git a/discord/abc.py b/discord/abc.py index a2f4a847..2ed7b513 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -31,12 +31,11 @@ from typing import ( Callable, Dict, List, - Mapping, Optional, TYPE_CHECKING, Protocol, + Sequence, Tuple, - Type, TypeVar, Union, overload, @@ -53,6 +52,7 @@ from .role import Role from .invite import Invite from .file import File from .voice_client import VoiceClient, VoiceProtocol +from .sticker import GuildSticker, StickerItem from . import utils __all__ = ( @@ -1164,6 +1164,7 @@ class Messageable: tts: bool = ..., embed: Embed = ..., file: File = ..., + stickers: Sequence[Union[GuildSticker, StickerItem]] = ..., delete_after: float = ..., nonce: Union[str, int] = ..., allowed_mentions: AllowedMentions = ..., @@ -1181,6 +1182,7 @@ class Messageable: tts: bool = ..., embed: Embed = ..., files: List[File] = ..., + stickers: Sequence[Union[GuildSticker, StickerItem]] = ..., delete_after: float = ..., nonce: Union[str, int] = ..., allowed_mentions: AllowedMentions = ..., @@ -1198,6 +1200,7 @@ class Messageable: tts: bool = ..., embeds: List[Embed] = ..., file: File = ..., + stickers: Sequence[Union[GuildSticker, StickerItem]] = ..., delete_after: float = ..., nonce: Union[str, int] = ..., allowed_mentions: AllowedMentions = ..., @@ -1215,6 +1218,7 @@ class Messageable: tts: bool = ..., embeds: List[Embed] = ..., files: List[File] = ..., + stickers: Sequence[Union[GuildSticker, StickerItem]] = ..., delete_after: float = ..., nonce: Union[str, int] = ..., allowed_mentions: AllowedMentions = ..., @@ -1233,6 +1237,7 @@ class Messageable: embeds=None, file=None, files=None, + stickers=None, delete_after=None, nonce=None, allowed_mentions=None, @@ -1304,6 +1309,10 @@ class Messageable: embeds: List[:class:`~discord.Embed`] A list of embeds to upload. Must be a maximum of 10. + .. versionadded:: 2.0 + stickers: Sequence[Union[:class:`GuildSticker`, :class:`StickerItem`]] + A list of stickers to upload. Must be a maximum of 3. + .. versionadded:: 2.0 Raises @@ -1340,6 +1349,9 @@ class Messageable: raise InvalidArgument('embeds parameter must be a list of up to 10 elements') embeds = [embed.to_dict() for embed in embeds] + if stickers is not None: + stickers = [sticker.id for sticker in stickers] + if allowed_mentions is not None: if state.allowed_mentions is not None: allowed_mentions = state.allowed_mentions.merge(allowed_mentions).to_dict() @@ -1384,6 +1396,7 @@ class Messageable: embeds=embeds, nonce=nonce, message_reference=reference, + stickers=stickers, components=components, ) finally: @@ -1406,6 +1419,7 @@ class Messageable: nonce=nonce, allowed_mentions=allowed_mentions, message_reference=reference, + stickers=stickers, components=components, ) finally: @@ -1421,6 +1435,7 @@ class Messageable: nonce=nonce, allowed_mentions=allowed_mentions, message_reference=reference, + stickers=stickers, components=components, ) @@ -1454,7 +1469,7 @@ class Messageable: This means that both ``with`` and ``async with`` work with this. Example Usage: :: - + async with channel.typing(): # simulate something heavy await asyncio.sleep(10) -- cgit v1.2.3