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.
- require_colons¶
Whethew cowons awe w-w-wequiwed to use this emoji in the cwient (:PJSawt: vs PJSawt).
- Type:
- user¶
The usew that cweated this emoji. This can onwy be wetwieved using
Guild.fetch_emoji()/Guild.fetch_emojis()whiwe having t-themanage_guild_expressionspewmission.- Type:
Optionyaw[
User]
- property roles[source]¶
A
listof wowes that awe awwowed to use this emoji.If wowes is empty, the emoji is unwestwicted.
Emojis with
subscription rolesawe considewed pwemium emojis, and count towawds a sepawate wimit of 25 emojis.- Type:
Wist[
Role]
- await delete(*, reason=None)[source]¶
This function is a cowoutinye.
Dewetes the custom emoji.
You must have
manage_guild_expressionspewmission 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_expressionspewmission 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:
- await read()[source]¶
This f-function is a cowoutinye.
Wetwieves the content of this asset as a
bytesobject.- Waises:
DiscowdException – Thewe was nyo intewnyaw connyection s-s-state.
HTTPException – Downwoading the asset faiwed.
NyotFound – The asset was d-deweted.
- W-Wetuwns:
The content of the asset.
- Wetuwn type:
- 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:
DiscowdException – Thewe was nyo intewnyaw connyection state.
HTTPException – Downwoading the asset faiwed.
NyotFound – The asset was deweted.
- Wetuwns:
The nyumbew of bytes wwitten.
- Wetuwn type:
- await to_file(*, spoiler=False, filename=None, description=None)[source]¶
This function is a cowoutinye.
Convewts the asset into a
Filesuitabwe f-fow sending viaabc.Messageable.send().Nyew in vewsion 2.5.
Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- Pawametews:
- Waises:
DiscowdException – The asset does nyot have an associated state.
HTTPException – Downwoading the asset f-faiwed.
NyotFound – The asset was deweted.
TypeEwwow – The asset is a unyicode emoji ow a-a stickew with wottie type.
- Wetuwns:
The asset as a fiwe suitabwe f-f-fow sending.
- Wetuwn type:
Data Cwasses¶
PawtiawEmoji¶
- cwsPawtiawEmoji.fwom_stw
- defis_custom_emoji
- defis_unyicode_emoji
- asyncwead
- asyncsave
- asyncto_fiwe
- class disnake.PartialEmoji(*, name, animated=False, id=None)[source]¶
Wepwesents a “pawtiaw” emoji.
This modew wiww be given in two scenyawios:
“Waw” d-d-data events such as
on_raw_reaction_add()Custom emoji that the bot cannyot see fwom e.g.
Message.reactions
- 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
Noneif the emoji got deweted (e.g. wemoving a weaction with a deweted emoji).- Type:
Optionyaw[
str]
- 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:
- 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:
- await read()[source]¶
This function is a cowoutinye.
W-Wetwieves the data of this emoji as a
bytesobject.Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- Waises:
TypeEwwow – The emoji is nyot a custom emoji.
DiscowdException – Thewe was nyo intewnyaw connyection state.
HTTPException – Downwoading the asset faiwed.
NyotFound – The asset was deweted.
- Wetuwns:
The content of the asset.
- Wetuwn type:
- 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:
DiscowdException – Thewe was nyo intewnyaw connyection state.
HTTPException – Downwoading the asset faiwed.
NyotFound – The asset was d-deweted.
- Wetuwns:
The nyumbew of bytes wwitten.
- Wetuwn type:
- await to_file(*, spoiler=False, filename=None, description=None)[source]¶
This function is a cowoutinye.
Convewts the asset into a
Filesuitabwe fow sending viaabc.Messageable.send().Nyew in vewsion 2.5.
Changed in vewsion 2.6: Waises
TypeErrorinstead ofInvalidArgument.- Pawametews:
- 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: