Stickers¶
This section documents everything related to stickers.
Discord Models¶
Sticker¶
- class disnake.Sticker[source]¶
- Represents a sticker. - New in version 1.6. - str(x)
- Returns the name of the sticker. 
 - x == y
- Checks if the sticker is equal to another sticker. 
 - x != y
- Checks if the sticker is not equal to another sticker. 
 - format¶
- The format for the sticker’s image. - Type:
 
 - await read()[source]¶
- This function is a coroutine. - Retrieves the content of this sticker as a - bytesobject.- Note - Stickers that use the - StickerFormatType.lottieformat cannot be read.- Raises:
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
- TypeError – The sticker is a lottie type. 
 
- Returns:
- The content of the asset. 
- Return type:
 
 - await save(fp, *, seek_begin=True)[source]¶
- This function is a coroutine. - Saves this asset into a file-like object. - Parameters:
- fp (Union[ - io.BufferedIOBase,- os.PathLike]) – The file-like object to save this asset to or the filename to use. If a filename is passed then a file is created with that filename and used instead.
- seek_begin ( - bool) – Whether to seek to the beginning of the file after saving is successfully done.
 
- Raises:
- DiscordException – There was no internal connection state. 
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
 
- Returns:
- The number of bytes written. 
- Return type:
 
 - await to_file(*, spoiler=False, filename=None, description=None)[source]¶
- This function is a coroutine. - Converts the asset into a - Filesuitable for sending via- abc.Messageable.send().- New in version 2.5. - Changed in version 2.6: Raises - TypeErrorinstead of- InvalidArgument.- Parameters:
- Raises:
- DiscordException – The asset does not have an associated state. 
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
- TypeError – The asset is a unicode emoji or a sticker with lottie type. 
 
- Returns:
- The asset as a file suitable for sending. 
- Return type:
 
 
StandardSticker¶
- class disnake.StandardSticker[source]¶
- Represents a sticker that is found in a standard sticker pack. - New in version 2.0. - str(x)
- Returns the name of the sticker. 
 - x == y
- Checks if the sticker is equal to another sticker. 
 - x != y
- Checks if the sticker is not equal to another sticker. 
 - format¶
- The format for the sticker’s image. - Type:
 
 - await pack()[source]¶
- This function is a coroutine. - Retrieves the sticker pack that this sticker belongs to. - Raises:
- InvalidData – The corresponding sticker pack was not found. 
- HTTPException – Retrieving the sticker pack failed. 
 
- Returns:
- The retrieved sticker pack. 
- Return type:
 
 - await read()[source]¶
- This function is a coroutine. - Retrieves the content of this sticker as a - bytesobject.- Note - Stickers that use the - StickerFormatType.lottieformat cannot be read.- Raises:
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
- TypeError – The sticker is a lottie type. 
 
- Returns:
- The content of the asset. 
- Return type:
 
 - await save(fp, *, seek_begin=True)[source]¶
- This function is a coroutine. - Saves this asset into a file-like object. - Parameters:
- fp (Union[ - io.BufferedIOBase,- os.PathLike]) – The file-like object to save this asset to or the filename to use. If a filename is passed then a file is created with that filename and used instead.
- seek_begin ( - bool) – Whether to seek to the beginning of the file after saving is successfully done.
 
- Raises:
- DiscordException – There was no internal connection state. 
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
 
- Returns:
- The number of bytes written. 
- Return type:
 
 - await to_file(*, spoiler=False, filename=None, description=None)[source]¶
- This function is a coroutine. - Converts the asset into a - Filesuitable for sending via- abc.Messageable.send().- New in version 2.5. - Changed in version 2.6: Raises - TypeErrorinstead of- InvalidArgument.- Parameters:
- Raises:
- DiscordException – The asset does not have an associated state. 
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
- TypeError – The asset is a unicode emoji or a sticker with lottie type. 
 
- Returns:
- The asset as a file suitable for sending. 
- Return type:
 
 
GuildSticker¶
- class disnake.GuildSticker[source]¶
- Represents a sticker that belongs to a guild. - New in version 2.0. - str(x)
- Returns the name of the sticker. 
 - x == y
- Checks if the sticker is equal to another sticker. 
 - x != y
- Checks if the sticker is not equal to another sticker. 
 - format¶
- The format for the sticker’s image. - Type:
 
 - user¶
- The user that created this sticker. This can only be retrieved using - Guild.fetch_sticker()/- Guild.fetch_stickers()while having the- manage_guild_expressionspermission.- Type:
- Optional[ - User]
 
 - guild¶
- The guild that this sticker is from. Could be - Noneif the bot is not in the guild.- New in version 2.0. - Type:
- Optional[ - Guild]
 
 - await edit(*, name=..., description=..., emoji=..., reason=None)[source]¶
- This function is a coroutine. - Edits a - GuildStickerfor the guild.- You must have - manage_guild_expressionspermission to do this.- Parameters:
- name ( - str) – The sticker’s new name. Must be at least 2 characters.
- description (Optional[ - str]) – The sticker’s new description. Can be- None.
- emoji ( - str) – The name of a unicode emoji that represents the sticker’s expression.
- reason (Optional[ - str]) – The reason for editing this sticker. Shows up on the audit log.
 
- Raises:
- Forbidden – You are not allowed to edit this sticker. 
- HTTPException – An error occurred editing the sticker. 
 
- Returns:
- The newly modified sticker. 
- Return type:
 
 - await delete(*, reason=None)[source]¶
- This function is a coroutine. - Deletes the custom - Stickerfrom the guild.- You must have - manage_guild_expressionspermission to do this.- Parameters:
- reason (Optional[ - str]) – The reason for deleting this sticker. Shows up on the audit log.
- Raises:
- Forbidden – You are not allowed to delete this sticker. 
- HTTPException – An error occurred deleting the sticker. 
 
 
 - await read()[source]¶
- This function is a coroutine. - Retrieves the content of this sticker as a - bytesobject.- Note - Stickers that use the - StickerFormatType.lottieformat cannot be read.- Raises:
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
- TypeError – The sticker is a lottie type. 
 
- Returns:
- The content of the asset. 
- Return type:
 
 - await save(fp, *, seek_begin=True)[source]¶
- This function is a coroutine. - Saves this asset into a file-like object. - Parameters:
- fp (Union[ - io.BufferedIOBase,- os.PathLike]) – The file-like object to save this asset to or the filename to use. If a filename is passed then a file is created with that filename and used instead.
- seek_begin ( - bool) – Whether to seek to the beginning of the file after saving is successfully done.
 
- Raises:
- DiscordException – There was no internal connection state. 
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
 
- Returns:
- The number of bytes written. 
- Return type:
 
 - await to_file(*, spoiler=False, filename=None, description=None)[source]¶
- This function is a coroutine. - Converts the asset into a - Filesuitable for sending via- abc.Messageable.send().- New in version 2.5. - Changed in version 2.6: Raises - TypeErrorinstead of- InvalidArgument.- Parameters:
- Raises:
- DiscordException – The asset does not have an associated state. 
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
- TypeError – The asset is a unicode emoji or a sticker with lottie type. 
 
- Returns:
- The asset as a file suitable for sending. 
- Return type:
 
 
StickerItem¶
- class disnake.StickerItem[source]¶
- Represents a sticker item. - New in version 2.0. - str(x)
- Returns the name of the sticker item. 
 - x == y
- Checks if the sticker item is equal to another sticker item. 
 - x != y
- Checks if the sticker item is not equal to another sticker item. 
 - format¶
- The format for the sticker’s image. - Type:
 
 - await fetch()[source]¶
- This function is a coroutine. - Attempts to retrieve the full sticker data of the sticker item. - Raises:
- HTTPException – Retrieving the sticker failed. 
- Returns:
- The retrieved sticker. 
- Return type:
- Union[ - StandardSticker,- GuildSticker]
 
 - await read()[source]¶
- This function is a coroutine. - Retrieves the content of this sticker as a - bytesobject.- Note - Stickers that use the - StickerFormatType.lottieformat cannot be read.- Raises:
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
- TypeError – The sticker is a lottie type. 
 
- Returns:
- The content of the asset. 
- Return type:
 
 - await save(fp, *, seek_begin=True)[source]¶
- This function is a coroutine. - Saves this asset into a file-like object. - Parameters:
- fp (Union[ - io.BufferedIOBase,- os.PathLike]) – The file-like object to save this asset to or the filename to use. If a filename is passed then a file is created with that filename and used instead.
- seek_begin ( - bool) – Whether to seek to the beginning of the file after saving is successfully done.
 
- Raises:
- DiscordException – There was no internal connection state. 
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
 
- Returns:
- The number of bytes written. 
- Return type:
 
 - await to_file(*, spoiler=False, filename=None, description=None)[source]¶
- This function is a coroutine. - Converts the asset into a - Filesuitable for sending via- abc.Messageable.send().- New in version 2.5. - Changed in version 2.6: Raises - TypeErrorinstead of- InvalidArgument.- Parameters:
- Raises:
- DiscordException – The asset does not have an associated state. 
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
- TypeError – The asset is a unicode emoji or a sticker with lottie type. 
 
- Returns:
- The asset as a file suitable for sending. 
- Return type:
 
 
StickerPack¶
- class disnake.StickerPack[source]¶
- Represents a sticker pack. - New in version 2.0. - Changed in version 2.8: - cover_sticker_id,- cover_stickerand- bannerare now optional.- str(x)
- Returns the name of the sticker pack. 
 - x == y
- Checks if the sticker pack is equal to another sticker pack. 
 - x != y
- Checks if the sticker pack is not equal to another sticker pack. 
 - stickers¶
- The stickers of this sticker pack. - Type:
- List[ - StandardSticker]
 
 - cover_sticker_id¶
- The ID of the sticker used for the cover of the sticker pack, if any. - Type:
- Optional[ - int]
 
 - cover_sticker¶
- The sticker used for the cover of the sticker pack, if any. - Type:
- Optional[ - StandardSticker]
 
 
Enumerations¶
StickerType¶
StickerFormatType¶
- class disnake.StickerFormatType[source]¶
- Represents the type of sticker images. - New in version 1.6. - png¶
- Represents a sticker with a png image. 
 - apng¶
- Represents a sticker with an apng image. 
 - lottie¶
- Represents a sticker with a lottie image. 
 - gif¶
- Represents a sticker with a gif image. - New in version 2.8.