Emoji

discord_http.emoji module

class discord_http.emoji.Emoji(*, state, data, guild=None)

Bases: PartialEmoji

Parameters:
property url: str

Returns the URL of the emoji.

class discord_http.emoji.EmojiParser(emoji)

Bases: object

Used to accept any input and convert to either a normal emoji or a Discord emoji automatically.

It is used for things like reactions, forum, components, etc

Examples

  • EmojiParser(”👍”)

  • EmojiParser(“<:name:1234567890>”)

  • EmojiParser(“1234567890”)

Parameters:

emoji (str)

classmethod from_dict(data) Self

Create an emoji from a dictionary.

Parameters:

data (dict) – The dictionary to create the emoji from

Return type:

Self

Returns:

The emoji

to_dict() dict

Returns a dict representation of the emoji.

Return type:

dict

to_forum_dict() dict

Returns a dict representation of emoji to forum/media channel.

Return type:

dict

to_reaction() str

Returns a string representation of the emoji.

Return type:

str

property url: str | None

Returns the URL of the emoji if it’s a Discord emoji.

class discord_http.emoji.PartialEmoji(*, state, id, guild_id=None)

Bases: PartialBase

Parameters:
async delete(*, reason=None) None

Deletes the emoji.

If guild_id is not defined, it will delete the emoji from the application.

Parameters:

reason (str | None) – The reason for deleting the emoji.

Return type:

None

async edit(*, name=<MISSING>, roles=<MISSING>, reason=None) Emoji

Edits the emoji.

Parameters:
  • name (str | None) – The new name of the emoji.

  • roles (list[PartialRole | int] | None) – Roles that are allowed to use the emoji. (Only for guilds)

  • reason (str | None) – The reason for editing the emoji. (Only for guilds)

Return type:

Emoji

Returns:

The edited emoji.

Raises:

ValueError – Whenever guild_id is not defined

async fetch() Emoji

Emoji: Fetches the emoji.

If guild_id is not defined, it will fetch the emoji from the application.

Return type:

Emoji

property guild: Guild | PartialGuild | None

The guild of the member.

property url: str

Returns the URL of the emoji.

It will always be PNG as it’s a partial emoji.

Type:

str