Emojis and Reactions

There are two different kinds of emojis in Discord: Unicode emojis and custom emojis.

πŸš΄β€β™‚οΈ 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 Listopen in new window.

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" like you would in the Client:

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 = ...;

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 emojis that 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 JEmojiopen in new window. It enables you to do things like the following: