Skip to content

hikari.stickers#

Application and entities that are used to describe stickers on Discord.

GuildSticker #

Bases: PartialSticker

Represents a Discord sticker that belongs to a guild.

description class-attribute instance-attribute #

description: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The description of this sticker.

guild_id class-attribute instance-attribute #

guild_id: Snowflake = attrs.field(eq=False, hash=False)

The guild this sticker belongs to.

is_available class-attribute instance-attribute #

is_available: bool = attrs.field(eq=False, hash=False)

Whether the sticker can be used.

tag class-attribute instance-attribute #

tag: str = attrs.field(eq=False, hash=False)

This sticker's tag.

type class-attribute instance-attribute #

type: StickerType = attrs.field(
    eq=False,
    hash=False,
    repr=False,
    init=False,
    default=StickerType.GUILD,
)

The sticker type.

user class-attribute instance-attribute #

user: User | None = attrs.field(
    eq=False, hash=False, repr=False
)

The user that uploaded this sticker.

This will only be available if you have the hikari.permissions.Permissions.MANAGE_GUILD_EXPRESSIONS permission.

PartialSticker #

Bases: Unique

Represents the partial stickers found attached to messages on Discord.

format_type class-attribute instance-attribute #

format_type: StickerFormatType | int = attrs.field(
    eq=False, hash=False, repr=True
)

The format of this sticker's asset.

id class-attribute instance-attribute #

id: Snowflake = attrs.field(hash=True, repr=True)

The ID of this entity.

name class-attribute instance-attribute #

name: str = attrs.field(eq=False, hash=False, repr=False)

The name of the sticker.

make_url #

make_url(
    *,
    file_format: UndefinedOr[
        Literal[
            "LOTTIE",
            "PNG",
            "JPEG",
            "JPG",
            "WEBP",
            "APNG",
            "AWEBP",
            "GIF",
        ]
    ] = UNDEFINED,
    size: int = 4096,
    lossless: bool = True,
) -> URL

Generate the image URL for this sticker.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports LOTTIE, PNG, JPEG, JPG, WEBP, APNG, AWEBP and GIF.

LOTTIE is only available for hikari.stickers.StickerFormatType.LOTTIE stickers; If not specified, the format will be based on the format type.

TYPE: UndefinedOr[Literal['LOTTIE', 'PNG', 'JPEG', 'JPG', 'WEBP', 'APNG', 'AWEBP', 'GIF']] DEFAULT: UNDEFINED

size

The size to set for the URL; This is ignored for APNG and LOTTIE formats; Can be any power of two between 16 and 4096.

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP or AWEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
URL

The URL of the sticker.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format; If an animated format is requested for a static sticker; If an APNG sticker is requested as AWEBP or GIF; If a GIF sticker is requested as an APNG; If a LOTTIE sticker is requested as anything other than LOTTIE; If a non-LOTTIE sticker is requested in the LOTTIE format.

ValueError

If size is specified but is not a power of two or not between 16 and 4096.

StandardSticker #

Bases: PartialSticker

Represents a standard Discord sticker that belongs to a pack.

description class-attribute instance-attribute #

description: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The description of this sticker.

pack_id class-attribute instance-attribute #

pack_id: Snowflake = attrs.field(
    eq=False, hash=False, repr=True
)

ID of the package this sticker belongs to.

sort_value class-attribute instance-attribute #

sort_value: int = attrs.field(
    eq=False, hash=False, repr=False
)

The sort value for the sticker in its pack.

tags class-attribute instance-attribute #

tags: Sequence[str] = attrs.field(
    eq=False, hash=False, repr=True
)

A sequence of this sticker's tags.

type class-attribute instance-attribute #

type: StickerType = attrs.field(
    eq=False,
    hash=False,
    repr=False,
    init=False,
    default=StickerType.STANDARD,
)

The sticker type.

StickerFormatType #

Bases: int, Enum

The formats types of a sticker's asset.

APNG class-attribute instance-attribute #

APNG = 2

A animated PNG sticker.

GIF class-attribute instance-attribute #

GIF = 4

A GIF sticker.

LOTTIE class-attribute instance-attribute #

LOTTIE = 3

A lottie sticker.

More information can be found here: https://airbnb.io/lottie/

PNG class-attribute instance-attribute #

PNG = 1

A PNG sticker.

StickerPack #

Bases: Unique

Represents a sticker pack on Discord.

banner_asset_id class-attribute instance-attribute #

banner_asset_id: Snowflake | None = attrs.field(
    eq=False, hash=False, repr=False
)

ID of the sticker pack's banner image, if set.

cover_sticker_id class-attribute instance-attribute #

cover_sticker_id: Snowflake | None = attrs.field(
    eq=False, hash=False, repr=False
)

The ID of a sticker in the pack which is shown as the pack's icon.

description class-attribute instance-attribute #

description: str = attrs.field(
    eq=False, hash=False, repr=False
)

The description of the pack.

id class-attribute instance-attribute #

id: Snowflake = attrs.field(hash=True, repr=True)

The ID of this entity.

name class-attribute instance-attribute #

name: str = attrs.field(eq=False, hash=False, repr=False)

The name of the pack.

sku_id class-attribute instance-attribute #

sku_id: Snowflake = attrs.field(
    eq=False, hash=False, repr=False
)

The ID of the packs SKU.

stickers class-attribute instance-attribute #

stickers: Sequence[StandardSticker] = attrs.field(
    eq=False, hash=False, repr=False
)

The stickers that belong to this pack.

make_banner_url #

make_banner_url(
    *,
    file_format: Literal[
        "PNG", "JPEG", "JPG", "WEBP"
    ] = "PNG",
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the pack's banner image URL, if set.

If no banner image is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, and WEBP.

If not specified, the format will be PNG.

TYPE: Literal['PNG', 'JPEG', 'JPG', 'WEBP'] DEFAULT: 'PNG'

size

The size to set for the URL; Can be any power of two between 16 and 4096;

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no banner image is set.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format.

ValueError

If size is specified but is not a power of two or not between 16 and 4096.

StickerType #

Bases: int, Enum

The sticker type.

GUILD class-attribute instance-attribute #

GUILD = 2

A sticker uploaded to a guild.

STANDARD class-attribute instance-attribute #

STANDARD = 1

An official sticker in a pack, part of Nitro or in a removed purchasable pack.