Stickers

This section documents everything related to stickers.

Discord Models

Sticker

Methods
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.

name

The sticker’s name.

Type:

str

id

The ID of the sticker.

Type:

int

description

The description of the sticker.

Type:

str

pack_id

The ID of the sticker’s pack.

Type:

int

format

The format for the sticker’s image.

Type:

StickerFormatType

property created_at[source]

Returns the sticker’s creation time in UTC.

Type:

datetime.datetime

await read()[source]

This function is a coroutine.

Retrieves the content of this sticker as a bytes object.

Note

Stickers that use the StickerFormatType.lottie format cannot be read.

Raises:
Returns:

The content of the asset.

Return type:

bytes

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:
Returns:

The number of bytes written.

Return type:

int

await to_file(*, spoiler=False, filename=None, description=None)[source]

This function is a coroutine.

Converts the asset into a File suitable for sending via abc.Messageable.send().

New in version 2.5.

Changed in version 2.6: Raises TypeError instead of InvalidArgument.

Parameters:
  • spoiler (bool) – Whether the file is a spoiler.

  • filename (Optional[str]) – The filename to display when uploading to Discord. If this is not given, it defaults to the name of the asset’s URL.

  • description (Optional[str]) – The file’s description.

Raises:
Returns:

The asset as a file suitable for sending.

Return type:

File

property url[source]

The url for the sticker’s image.

Type:

str

StandardSticker

Methods
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.

name

The sticker’s name.

Type:

str

id

The ID of the sticker.

Type:

int

description

The description of the sticker.

Type:

str

pack_id

The ID of the sticker’s pack.

Type:

int

format

The format for the sticker’s image.

Type:

StickerFormatType

tags

A list of tags for the sticker.

Type:

List[str]

sort_value

The sticker’s sort order within its pack.

Type:

int

await pack()[source]

This function is a coroutine.

Retrieves the sticker pack that this sticker belongs to.

Raises:
Returns:

The retrieved sticker pack.

Return type:

StickerPack

property created_at[source]

Returns the sticker’s creation time in UTC.

Type:

datetime.datetime

await read()[source]

This function is a coroutine.

Retrieves the content of this sticker as a bytes object.

Note

Stickers that use the StickerFormatType.lottie format cannot be read.

Raises:
Returns:

The content of the asset.

Return type:

bytes

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:
Returns:

The number of bytes written.

Return type:

int

await to_file(*, spoiler=False, filename=None, description=None)[source]

This function is a coroutine.

Converts the asset into a File suitable for sending via abc.Messageable.send().

New in version 2.5.

Changed in version 2.6: Raises TypeError instead of InvalidArgument.

Parameters:
  • spoiler (bool) – Whether the file is a spoiler.

  • filename (Optional[str]) – The filename to display when uploading to Discord. If this is not given, it defaults to the name of the asset’s URL.

  • description (Optional[str]) – The file’s description.

Raises:
Returns:

The asset as a file suitable for sending.

Return type:

File

property url[source]

The url for the sticker’s image.

Type:

str

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.

name

The sticker’s name.

Type:

str

id

The ID of the sticker.

Type:

int

description

The description of the sticker.

Type:

str

format

The format for the sticker’s image.

Type:

StickerFormatType

available

Whether this sticker is available for use.

Type:

bool

guild_id

The ID of the guild that this sticker is from.

Type:

int

user

The user that created this sticker. This can only be retrieved using Guild.fetch_sticker()/Guild.fetch_stickers() while having the manage_guild_expressions permission.

Type:

Optional[User]

emoji

The name of a unicode emoji that represents this sticker.

Type:

str

guild

The guild that this sticker is from. Could be None if 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 GuildSticker for the guild.

You must have manage_guild_expressions permission 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:

GuildSticker

await delete(*, reason=None)[source]

This function is a coroutine.

Deletes the custom Sticker from the guild.

You must have manage_guild_expressions permission 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.

property created_at[source]

Returns the sticker’s creation time in UTC.

Type:

datetime.datetime

await read()[source]

This function is a coroutine.

Retrieves the content of this sticker as a bytes object.

Note

Stickers that use the StickerFormatType.lottie format cannot be read.

Raises:
Returns:

The content of the asset.

Return type:

bytes

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:
Returns:

The number of bytes written.

Return type:

int

await to_file(*, spoiler=False, filename=None, description=None)[source]

This function is a coroutine.

Converts the asset into a File suitable for sending via abc.Messageable.send().

New in version 2.5.

Changed in version 2.6: Raises TypeError instead of InvalidArgument.

Parameters:
  • spoiler (bool) – Whether the file is a spoiler.

  • filename (Optional[str]) – The filename to display when uploading to Discord. If this is not given, it defaults to the name of the asset’s URL.

  • description (Optional[str]) – The file’s description.

Raises:
Returns:

The asset as a file suitable for sending.

Return type:

File

property url[source]

The url for the sticker’s image.

Type:

str

StickerItem

Attributes
Methods
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.

name

The sticker’s name.

Type:

str

id

The ID of the sticker.

Type:

int

format

The format for the sticker’s image.

Type:

StickerFormatType

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 bytes object.

Note

Stickers that use the StickerFormatType.lottie format cannot be read.

Raises:
Returns:

The content of the asset.

Return type:

bytes

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:
Returns:

The number of bytes written.

Return type:

int

await to_file(*, spoiler=False, filename=None, description=None)[source]

This function is a coroutine.

Converts the asset into a File suitable for sending via abc.Messageable.send().

New in version 2.5.

Changed in version 2.6: Raises TypeError instead of InvalidArgument.

Parameters:
  • spoiler (bool) – Whether the file is a spoiler.

  • filename (Optional[str]) – The filename to display when uploading to Discord. If this is not given, it defaults to the name of the asset’s URL.

  • description (Optional[str]) – The file’s description.

Raises:
Returns:

The asset as a file suitable for sending.

Return type:

File

property url[source]

The url for the sticker’s image.

Type:

str

StickerPack

class disnake.StickerPack[source]

Represents a sticker pack.

New in version 2.0.

Changed in version 2.8: cover_sticker_id, cover_sticker and banner are 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.

name

The name of the sticker pack.

Type:

str

description

The description of the sticker pack.

Type:

str

id

The id of the sticker pack.

Type:

int

stickers

The stickers of this sticker pack.

Type:

List[StandardSticker]

sku_id

The SKU ID of the sticker pack.

Type:

int

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]

property banner[source]

The banner asset of the sticker pack, if any.

Type:

Optional[Asset]

Enumerations

StickerType

class disnake.StickerType[source]

Represents the type of sticker.

New in version 2.0.

standard

Represents a standard sticker that all users can use.

guild

Represents a custom sticker created in a guild.

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.

Events