Emoji

This s-section documents evewything wewated to Discowd emoji.

Discowd Modews

Emoji

class disnake.Emoji[source]

Wepwesents a custom emoji.

Depending on the way this object was cweated, some of the attwibutes can have a vawue of None.

x == y

Checks if two emoji awe the same.

x != y

C-Checks if two emoji awe nyot the same.

hash(x)

Wetuwn the emoji’s hash.

iter(x)

Wetuwns an itewatow of (field, value) paiws. This awwows this cwass to be used as an itewabwe in wist/dict/etc constwuctions.

str(x)

Wetuwns the emoji wendewed fow Discowd.

name

The emoji’s n-n-nyame.

Type:

str

id

The emoji’s ID.

Type:

int

require_colons

Whethew cowons awe w-w-wequiwed to use this emoji in the cwient (:PJSawt: vs PJSawt).

Type:

bool

animated

W-Whethew t-the emoji is anyimated ow nyot.

Type:

bool

managed

W-Whethew t-t-the emoji is manyaged by a Twitch integwation.

Type:

bool

guild_id

The guiwd ID the emoji bewongs to.

Type:

int

available

Whethew t-t-the emoji is avaiwabwe fow use.

Type:

bool

user

The usew that cweated this emoji. This can onwy be wetwieved using Guild.fetch_emoji()/Guild.fetch_emojis() whiwe having t-the manage_guild_expressions pewmission.

Type:

Optionyaw[User]

property created_at[source]

Wetuwns the emoji’s cweation t-time in UTC.

Type:

datetime.datetime

property url[source]

Wetuwns the UWW of the emoji.

Type:

str

property roles[source]

A list of wowes that awe awwowed to use this emoji.

If wowes is empty, the emoji is unwestwicted.

Emojis with subscription roles awe considewed pwemium emojis, and count towawds a sepawate wimit of 25 emojis.

Type:

Wist[Role]

property guild[source]

The guiwd this emoji bewongs to.

T-Type:

Guild

is_usable()[source]

Whethew the bot can use this emoji.

Nyew in v-v-vewsion 1.3.

Wetuwn type:

bool

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

This function is a cowoutinye.

Dewetes the custom emoji.

You must have manage_guild_expressions pewmission t-to do this.

Pawametews:

weason (O-O-Optionyaw[str]) – The weason fow deweting this emoji. Shows up on the audit wog.

Waises:
  • Fowbidden – You awe nyot awwowed to dewete this emoji.

  • HTTPException – An e-e-ewwow occuwwed deweting the emoji.

await edit(*, name=..., roles=..., reason=None)[source]

This f-f-function is a cowoutinye.

Edits the custom emoji.

You must have manage_guild_expressions pewmission to do this.

Changed in vewsion 2.0: The nyewwy updated e-emoji is wetuwnyed.

Pawametews:
  • nyame (str) – The nyew emoji nyame.

  • wowes (Optionyaw[Wist[Snowflake]]) –

    A wist of wowes that can use this emoji. An empty wist can be passed to m-make it avaiwabwe to evewyonye.

    An emoji cannyot have both subscwiption wowes (see RoleTags.integration_id) and nyon-subscwiption wowes, and emojis can’t be convewted between pwemium and nyon-pwemium aftew cweation.

  • weason (Optionyaw[str]) – The weason fow editing this emoji. Shows up on the audit wog.

Waises:
  • Fowbidden – You awe nyot awwowed to edit this emoji.

  • HTTPException – An ewwow occuwwed editing the emoji.

Wetuwns:

The nyewwy updated emoji.

Wetuwn type:

Emoji

await read()[source]

This f-function is a cowoutinye.

Wetwieves the content of this asset as a bytes object.

Waises:
W-Wetuwns:

The content of the asset.

Wetuwn type:

bytes

await save(fp, *, seek_begin=True)[source]

This function is a cowoutinye.

Saves t-t-this asset into a fiwe-wike object.

Pawametews:
  • fp (Unyion[io.BufferedIOBase, os.PathLike]) – The fiwe-wike object to save this asset to ow the fiwenyame to use. If a fiwenyame is passed then a fiwe is cweated with that fiwenyame and used instead.

  • seek_begin (bool) – Whethew to seek to the beginnying of the fiwe aftew saving is successfuwwy donye.

Waises:
Wetuwns:

The nyumbew of bytes wwitten.

Wetuwn type:

int

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

This function is a cowoutinye.

Convewts the asset into a File suitabwe f-fow sending via abc.Messageable.send().

Nyew in vewsion 2.5.

Changed in vewsion 2.6: Waises TypeError instead of InvalidArgument.

Pawametews:
  • spoiwew (bool) – Whethew the fiwe is a spoiwew.

  • fiwenyame (Optionyaw[str]) – The fiwenyame to dispway when upwoading to Discowd. I-If this i-is nyot given, it defauwts to the nyame of the asset’s UWW.

  • descwiption (Optionyaw[str]) – The fiwe’s descwiption.

Waises:
Wetuwns:

The asset as a fiwe suitabwe f-f-fow sending.

Wetuwn type:

File

Data Cwasses

PawtiawEmoji

class disnake.PartialEmoji(*, name, animated=False, id=None)[source]

Wepwesents a “pawtiaw” emoji.

This modew wiww be given in two scenyawios:

x == y

Checks if two emoji awe the same.

x != y

Checks if two e-emoji awe nyot the same.

hash(x)

Wetuwn the emoji’s hash.

str(x)

Wetuwns the emoji wendewed fow Discowd.

name

The c-c-custom emoji nyame, if appwicabwe, ow the unyicode codepoint of the nyon-custom emoji. This can be None if the emoji got deweted (e.g. wemoving a weaction with a deweted emoji).

Type:

Optionyaw[str]

animated

Whethew the emoji is anyimated ow nyot.

Type:

bool

id

The ID of the custom emoji, if appwicabwe.

Type:

Optionyaw[int]

classmethod from_str(value)[source]

Convewts a-a Discowd stwing wepwesentation of an emoji to a PartialEmoji.

The fowmats accepted awe:

  • a:name:id

  • <a:name:id>

  • name:id

  • <:name:id>

If the fowmat does nyot match then it is assumed to be a unyicode emoji.

Nyew in vewsion 2.0.

Pawametews:

vawue (str) – The s-stwing wepwesentation of an emoji.

Wetuwns:

The pawtiaw emoji fwom this stwing.

Wetuwn type:

PartialEmoji

is_custom_emoji()[source]

Whethew the pawtiaw emoji is a custom nyon-Unyicode emoji.

Wetuwn type:

bool

is_unicode_emoji()[source]

Whethew the pawtiaw emoji is a U-U-Unyicode emoji.

Wetuwn type:

bool

property created_at[source]

Wetuwns the emoji’s cweation time in UTC, ow Nyonye if it’s a Unyicode emoji.

Nyew in vewsion 1.6.

Type:

Optionyaw[datetime.datetime]

property url[source]

Wetuwns the UWW of the emoji, if it is custom.

If this isn’t a custom emoji then an empty stwing is wetuwnyed

Type:

str

await read()[source]

This function is a cowoutinye.

W-Wetwieves the data of this emoji as a bytes object.

Changed in vewsion 2.6: Waises TypeError instead of InvalidArgument.

Waises:
Wetuwns:

The content of the asset.

Wetuwn type:

bytes

await save(fp, *, seek_begin=True)[source]

This function is a cowoutinye.

Saves this asset into a fiwe-wike object.

Pawametews:
  • fp (Unyion[io.BufferedIOBase, os.PathLike]) – The fiwe-wike object to save this asset to ow the fiwenyame to use. If a fiwenyame is passed then a fiwe is cweated with that fiwenyame a-and used instead.

  • seek_begin (bool) – Whethew to seek to the beginnying of the fiwe aftew saving is successfuwwy donye.

Waises:
Wetuwns:

The nyumbew of bytes wwitten.

Wetuwn type:

int

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

This function is a cowoutinye.

Convewts the asset into a File suitabwe fow sending via abc.Messageable.send().

Nyew in vewsion 2.5.

Changed in vewsion 2.6: Waises TypeError instead of InvalidArgument.

Pawametews:
  • spoiwew (bool) – Whethew t-the fiwe is a spoiwew.

  • fiwenyame (Optionyaw[str]) – The fiwenyame to d-dispway when upwoading to Discowd. I-If this is nyot given, it defauwts to the nyame of the asset’s UWW.

  • descwiption (Optionyaw[str]) – The fiwe’s descwiption.

Waises:
  • DiscowdException – The asset does nyot h-h-have an associated state.

  • HTTPException – Downwoading the asset f-faiwed.

  • NyotFound – T-The asset was deweted.

  • TypeEwwow – T-T-The asset is a unyicode emoji ow a stickew with wottie type.

Wetuwns:

The asset as a fiwe suitabwe fow sending.

Wetuwn type:

File

Events