Package discord4j.core.object.reaction
Class ReactionEmoji
java.lang.Object
discord4j.core.object.reaction.ReactionEmoji
- Direct Known Subclasses:
ReactionEmoji.Custom
,ReactionEmoji.Unicode
An emoji used for
message reactions
, provides factory methods such as unicode(String)
and others to generate reactions.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
static final class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets this emoji as downcasted toa custom reaction emoji
.abstract discord4j.discordjson.json.EmojiData
Converts thisReactionEmoji
to aEmojiData
.abstract String
asFormat()
Gets the formatted version of this emoji (i.e., to display in the client).Gets this emoji downcasted toa unicode reaction emoji
.static ReactionEmoji.Unicode
codepoints
(String... codepoints) Constructs aReactionEmoji
for a unicode emoji.static ReactionEmoji.Custom
Constructs aReactionEmoji
for a custom emoji using the given information.static ReactionEmoji.Custom
custom
(GuildEmoji emoji) Constructs aReactionEmoji
using information from aknown guild emoji
.static ReactionEmoji
of
(discord4j.discordjson.json.EmojiData data) Constructs aReactionEmoji
from aEmojiData
representation.static ReactionEmoji
of
(discord4j.discordjson.json.ReactionData data) Constructs aReactionEmoji
from aReactionData
representation.static ReactionEmoji
Constructs aReactionEmoji
for generic emoji information.static ReactionEmoji.Unicode
Constructs aReactionEmoji
for a unicode emoji.
-
Constructor Details
-
ReactionEmoji
public ReactionEmoji()
-
-
Method Details
-
custom
Constructs aReactionEmoji
using 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
Constructs aReactionEmoji
for 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
Constructs aReactionEmoji
for 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
Constructs aReactionEmoji
for 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
Constructs aReactionEmoji
for 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
Constructs aReactionEmoji
from aReactionData
representation.- Parameters:
data
- theReactionData
wrapper.- Returns:
- a reaction emoji using the given information.
-
of
Constructs aReactionEmoji
from aEmojiData
representation.- Parameters:
data
- theEmojiData
wrapper.- Returns:
- a reaction emoji using the given information.
-
asFormat
Gets the formatted version of this emoji (i.e., to display in the client).- Returns:
- The formatted version of this emoji (i.e., to display in the client).
-
asCustomEmoji
Gets this emoji as downcasted toa custom reaction emoji
.- Returns:
- This emoji downcasted to a custom emoji, if possible.
-
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 thisReactionEmoji
to aEmojiData
.- Returns:
- An
EmojiData
for this emoji.
-