Emojis and Reactions

There are two different kinds of emojis in Discord:

Unicode Emojis

What are Unicode emojis?

Unicode emojis are “normal” text emojis which are supported by (nearly) all chat clients, including Discord. You can find a list with all Unicode emojis here: Full Emoji List.

How to use them in messages

You can either directly add them in your code, e.g.

channel.sendMessage("Hi! 😃");

or use the normal “tag”:

channel.sendMessage("Hi! :smiley:");

How to use them for reactions

Adding unicode reactions is only possible by using the “real” reaction. It doesn’t support tags like :smiley:

message.addReaction("😃"); // works
message.addReaction(":smiley:"); // doesn't work

Custom Emojis

What are custom emojis?

Custom emojis are emojis that are created in a server. You can get all custom emojis the bot knows by using DiscordApi#getCustomEmojis().

How to use them in messages

To use custom emojis, you have to know its “tag”, which has the format <:name:id>. You can get it by calling CustomEmoji#getMentionTag():

channel.sendMessage("Hi! <:javacord:415465982715494402>");
CustomEmoji emoji = ...;
channel.sendMessage("Hi! " + emoji.getMentionTag());

How to use them for reactions

You can either directly use the custom emoji object or use the tag without the <: > if you don’t have access a custom emoji object (e.g. because it’s from a different shard):

CustomEmoji emoji = ...;
message.addReaction(emoji);
message.addReaction("javacord:415465982715494402");

How to get the tag

Just add a \ in front of the emoji and press Enter

Javacord Emoji “Hierarchy”

In Javacord, all Emojis are a child of the Emoji interface:

What is a KnownCustomEmoji?

Known custom emojis are emoji which the bot knows because it’s a member of the server with this emoji. A custom emoji can be unknown if someone adds a reaction with an unknown emoji for example. A KnownCustomEmoji has additional methods like getServer() or updateName(String).

If you are working a lot with Unicode emojis, it’s recommended to use a library like emoji-java. It enables you to do things like the following:

message.addReaction(EmojiParser.parseToUnicode(":thumbsup:"));


Improve this page