Skip to main content

Emoji

Pycord provides two main emoji classes: GuildEmoji (aliased as Emoji) for custom guild emojis and PartialEmoji for emoji references.

GuildEmoji

Represents a custom emoji in a guild.

Attributes

id
int
The emoji’s ID.
name
str
The name of the emoji.
require_colons
bool
If colons are required to use this emoji in the client (:PJSalt: vs PJSalt).
animated
bool
Whether an emoji is animated or not.
managed
bool
If this emoji is managed by a Twitch integration.
guild_id
int
The guild ID the emoji belongs to.
available
bool
Whether the emoji is available for use.
user
User | None
The user that created the emoji. This can only be retrieved using Guild.fetch_emoji() and having the manage_emojis permission.
roles
list[Role]
A list of roles that is allowed to use this emoji. If roles is empty, the emoji is unrestricted.
guild
Guild
The guild this emoji belongs to.
created_at
datetime
Returns the emoji’s creation time in UTC.
url
str
Returns the URL of the emoji.
mention
str
Return a string that allows you to mention the emoji in a message.

Methods

Whether the bot can use this emoji.Returns: bool - True if the bot can use this emoji.Example:
if emoji.is_usable():
    await message.add_reaction(emoji)
Edits the custom emoji.
You must have manage_emojis permission to do this.
name
str
The new emoji name.
roles
list[Snowflake]
A list of roles that can use this emoji. An empty list can be passed to make it available to everyone.
reason
str
The reason for editing this emoji. Shows up on the audit log.
Returns: GuildEmoji - The newly updated emoji.Example:
await emoji.edit(name="new_name", roles=[moderator_role])
Deletes the custom emoji.
You must have manage_emojis permission to do this.
reason
str
The reason for deleting this emoji. Shows up on the audit log.
Example:
await emoji.delete(reason="No longer needed")

PartialEmoji

Represents a partial emoji. This is useful for when you need to reference an emoji but don’t need all the information about it.

Attributes

name
str
The emoji name.
id
int | None
The emoji’s ID. None if this is a unicode emoji.
animated
bool
Whether the emoji is animated.
url
str
Returns the URL of the emoji, if it is a custom emoji.
is_custom_emoji
bool
Checks whether this emoji is a custom emoji.
is_unicode_emoji
bool
Checks whether this emoji is a unicode emoji.
created_at
datetime | None
Returns the emoji’s creation time in UTC, if it is a custom emoji.

Class Methods

Converts an emoji string to a PartialEmoji.
value
str
required
The emoji string to convert. Can be a unicode emoji or a custom emoji format like <:name:id> or <a:name:id>.
Returns: PartialEmoji - The partial emoji.Example:
emoji = discord.PartialEmoji.from_str("<:python:123456789>")
await message.add_reaction(emoji)

unicode_emoji = discord.PartialEmoji.from_str("👍")
await message.add_reaction(unicode_emoji)

AppEmoji

Represents a custom emoji from an application.

Attributes

id
int
The emoji’s ID.
name
str
The name of the emoji.
require_colons
bool
If colons are required to use this emoji in the client.
animated
bool
Whether an emoji is animated or not.
managed
bool
If this emoji is managed by a Twitch integration.
application_id
int | None
The application ID the emoji belongs to, if available.
available
bool
Whether the emoji is available for use.
user
User | None
The user that created the emoji.

Methods

Whether the bot can use this emoji.Returns: bool - True if the application ID matches the bot’s application ID.
Edits the application emoji.
You must own the emoji to do this.
name
str
required
The new emoji name.
Returns: AppEmoji - The newly updated emoji.Example:
await app_emoji.edit(name="new_name")
Deletes the application emoji.
You must own the emoji to do this.
Example:
await app_emoji.delete()

Build docs developers (and LLMs) love