Emoji

discord_http.emoji module

class discord_http.emoji.Emoji(*, state: DiscordAPI, data: dict, guild: PartialGuild | None = None)[source]

Bases: PartialEmoji

property url: str

Returns the URL of the emoji

Type:

str

class discord_http.emoji.EmojiParser(emoji: str)[source]

Bases: object

This is 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”)

classmethod from_dict(data: dict) Self[source]
to_dict() dict[source]

dict: Returns a dict representation of the emoji

to_forum_dict() dict[source]

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

to_reaction() str[source]

str: Returns a string representation of the emoji

property url: str | None

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

Type:

str

class discord_http.emoji.PartialEmoji(*, state: DiscordAPI, id: int, guild_id: int | None = None)[source]

Bases: PartialBase

async delete(*, reason: str | None = None) None[source]

Deletes the emoji.

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

Parameters:

reason (Optional[str]) – The reason for deleting the emoji.

async edit(*, name: str | None = <MISSING>, roles: list[~discord_http.role.PartialRole | int] | None = <MISSING>, reason: str | None = None)[source]

Edits the emoji.

Parameters:
  • name (Optional[str]) – The new name of the emoji.

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

  • reason (Optional[str]) – The reason for editing the emoji. (Only for guilds)

Returns:

The edited emoji.

Return type:

Emoji

Raises:

ValueError – Whenever guild_id is not defined

async fetch() Emoji[source]

Emoji: Fetches the emoji.

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

property guild: PartialGuild | None

The guild of the member.

Type:

PartialGuild

property url: str

Returns the URL of the emoji.

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

Type:

str