Package discord4j.core.object.reaction
Class ReactionEmoji
- java.lang.Object
-
- discord4j.core.object.reaction.ReactionEmoji
-
- Direct Known Subclasses:
ReactionEmoji.Custom,ReactionEmoji.Unicode
public abstract class ReactionEmoji extends Object
An emoji used formessage reactions, provides factory methods such asunicode(String)and others to generate reactions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classReactionEmoji.Customstatic classReactionEmoji.Unicode
-
Constructor Summary
Constructors Constructor Description ReactionEmoji()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Optional<ReactionEmoji.Custom>asCustomEmoji()Gets this emoji as downcasted toa custom reaction emoji.abstract discord4j.discordjson.json.EmojiDataasEmojiData()Converts thisReactionEmojito aEmojiData.Optional<ReactionEmoji.Unicode>asUnicodeEmoji()Gets this emoji downcasted toa unicode reaction emoji.static ReactionEmoji.Unicodecodepoints(String... codepoints)Constructs aReactionEmojifor a unicode emoji.static ReactionEmoji.Customcustom(Snowflake id, String name, boolean isAnimated)Constructs aReactionEmojifor a custom emoji using the given information.static ReactionEmoji.Customcustom(GuildEmoji emoji)Constructs aReactionEmojiusing information from aknown guild emoji.static ReactionEmojiof(discord4j.discordjson.json.EmojiData data)Constructs aReactionEmojifrom aEmojiDatarepresentation.static ReactionEmojiof(discord4j.discordjson.json.ReactionData data)Constructs aReactionEmojifrom aReactionDatarepresentation.static ReactionEmojiof(Long id, String name, boolean isAnimated)Constructs aReactionEmojifor generic emoji information.static ReactionEmoji.Unicodeunicode(String raw)Constructs aReactionEmojifor a unicode emoji.
-
-
-
Method Detail
-
custom
public static ReactionEmoji.Custom custom(GuildEmoji emoji)
Constructs aReactionEmojiusing information from aknown guild emoji.- Parameters:
emoji- The guild emoji from which to take information.- Returns:
- A reaction emoji using information from the given guild emoji.
-
custom
public static ReactionEmoji.Custom custom(Snowflake id, String name, boolean isAnimated)
Constructs aReactionEmojifor a custom emoji using the given information.- Parameters:
id- The ID of the custom emoji.name- The name of the custom emoji.isAnimated- Whether the custom emoji is animated.- Returns:
- A reaction emoji using the given information.
-
unicode
public static ReactionEmoji.Unicode unicode(String raw)
Constructs aReactionEmojifor a unicode emoji.The string argument to this method should be the exact UTF-16 encoded string of the desired emoji. For example,
ReactionEmoji.unicode("\u2764") // "heart" ReactionEmoji.unicode("\uD83D\uDE00") // "grinning face" ReactionEmoji.unicode("\uD83D\uDC68\u200D\uD83E\uDDB0") // "man: red hair"A full list of emoji can be found here.This method does not accept the "U+" notation for codepoints. For that, use
codepoints(String...).- Parameters:
raw- The raw unicode string for the emoji.- Returns:
- A reaction emoji using the given information.
-
codepoints
public static ReactionEmoji.Unicode codepoints(String... codepoints)
Constructs aReactionEmojifor a unicode emoji.The argument(s) to this method should use the "U+" notation for codepoints. For example,
ReactionEmoji.codepoints("U+2764") // "heart" ReactionEmoji.codepoints("U+1F600") // "grinning face" ReactionEmoji.codepoints("U+1F468", "U+200D", "U+1F9B0") // "man: red hair"A full list of emoji can be found here.- Parameters:
codepoints- The codepoints that make up the emoji.- Returns:
- A reaction emoji using the given information.
-
of
public static ReactionEmoji of(@Nullable Long id, String name, boolean isAnimated)
Constructs aReactionEmojifor generic emoji information.- Parameters:
id- The ID of the custom emoji OR null if the emoji is a unicode emoji.name- The name of the custom emoji OR the raw unicode string for the emoji.isAnimated- Whether the emoji is animated OR false if the emoji is a unicode emoji.- Returns:
- A reaction emoji using the given information.
-
of
public static ReactionEmoji of(discord4j.discordjson.json.ReactionData data)
Constructs aReactionEmojifrom aReactionDatarepresentation.- Parameters:
data- theReactionDatawrapper.- Returns:
- a reaction emoji using the given information.
-
of
public static ReactionEmoji of(discord4j.discordjson.json.EmojiData data)
Constructs aReactionEmojifrom aEmojiDatarepresentation.- Parameters:
data- theEmojiDatawrapper.- Returns:
- a reaction emoji using the given information.
-
asCustomEmoji
public Optional<ReactionEmoji.Custom> asCustomEmoji()
Gets this emoji as downcasted toa custom reaction emoji.- Returns:
- This emoji downcasted to a custom emoji, if possible.
-
asUnicodeEmoji
public Optional<ReactionEmoji.Unicode> asUnicodeEmoji()
Gets this emoji downcasted toa unicode reaction emoji.- Returns:
- This emoji downcasted to a unicode emoji, if possible.
-
asEmojiData
public abstract discord4j.discordjson.json.EmojiData asEmojiData()
Converts thisReactionEmojito aEmojiData.- Returns:
- An
EmojiDatafor this emoji.
-
-