Package net.dv8tion.jda.api.entities
Class Emoji
java.lang.Object
net.dv8tion.jda.api.entities.Emoji
- All Implemented Interfaces:
Formattable,IMentionable,ISnowflake,SerializableData
Represents a Discord Emoji.
This can either be
This can either be
unicode or custom.
If this emoji is unicode, then getIdLong() will be 0 and ISnowflake.getTimeCreated() will be constant at 2015.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic EmojifromData(DataObject emoji) Parses the provided JSON representation to an emoji instance.static EmojiCreates an emoji with the provided name.static EmojiCreates an emoji from the providedEmotestatic EmojifromMarkdown(String code) Parses the provided markdown formatting to an Emoji instance.static EmojifromUnicode(String code) Creates an emoji with the provided unicode.Retrieve a Mention for this Entity.longThe Snowflake id of this entity.getName()The name of this emoji.inthashCode()booleanWhether this emote is animated.booleanisCustom()Whether this is a custom emote from a Guild.booleanWhether this emoji is a standard unicode emoji.toData()SerializedDataObjectfor this object.toString()Methods inherited from interface net.dv8tion.jda.api.entities.IMentionable
formatToMethods inherited from interface net.dv8tion.jda.api.entities.ISnowflake
getId, getTimeCreated
-
Method Details
-
getName
The name of this emoji.
This will be the unicode characters if this emoji is notcustom.- Returns:
- The unicode or custom name
-
getIdLong
public long getIdLong()Description copied from interface:ISnowflakeThe Snowflake id of this entity. This is unique to every entity and will never change.- Specified by:
getIdLongin interfaceISnowflake- Returns:
- Long containing the Id.
-
isAnimated
public boolean isAnimated()Whether this emote is animated.- Returns:
- True, if this emote is animated
-
isUnicode
public boolean isUnicode()Whether this emoji is a standard unicode emoji.
This meansgetName()returns the unicode characters of this emoji andISnowflake.getId()returns 0.- Returns:
- True, if this emoji is standard unicode
-
isCustom
public boolean isCustom()Whether this is a custom emote from a Guild.- Returns:
- True, if this is a custom emote
-
fromUnicode
Creates an emoji with the provided unicode.
This has to be the unicode characters rather than the emoji name.- Parameters:
code- The unicode characters, or codepoint notation such as"U+1f649"- Returns:
- The new emoji instance
- Throws:
IllegalArgumentException- If the code is null or empty
-
fromEmote
Creates an emoji with the provided name.- Parameters:
name- The emote nameid- The emote idanimated- Whether this emote is animated- Returns:
- The new emoji instance
- Throws:
IllegalArgumentException- If the name is null or empty
-
fromEmote
Creates an emoji from the providedEmote- Parameters:
emote- The emote instance- Returns:
- The new emoji instance
- Throws:
IllegalArgumentException- If the emote is null
-
fromMarkdown
Parses the provided markdown formatting to an Emoji instance.Example
// animated custom emoji parseMarkdown("<a:dance:123456789123456789>"); // not animated custom emoji parseMarkdown("<:dog:123456789123456789>"); // unicode emoji, escape codes parseMarkdown("😃"); // unicode emoji parseMarkdown("😃");- Parameters:
code- The code to parse- Returns:
- The emoji instance
- Throws:
IllegalArgumentException- If the provided code is null or empty
-
fromData
Parses the provided JSON representation to an emoji instance.- Parameters:
emoji- The emoji json- Returns:
- The emoji instance
- Throws:
ParsingException- If the JSON is not a valid emoji
-
toData
Description copied from interface:SerializableDataSerializedDataObjectfor this object.- Specified by:
toDatain interfaceSerializableData- Returns:
DataObject
-
getAsMention
Description copied from interface:IMentionableRetrieve a Mention for this Entity. For the publicRole(@everyone), this will return the literal string"@everyone".- Specified by:
getAsMentionin interfaceIMentionable- Returns:
- A resolvable mention.
-
hashCode
public int hashCode() -
equals
-
toString
-