Skip to content

Instantly share code, notes, and snippets.

@jamietech
Created May 31, 2017 07:21
Show Gist options
  • Save jamietech/7c0b01be2ff6439c97fbec55e82daad5 to your computer and use it in GitHub Desktop.
Save jamietech/7c0b01be2ff6439c97fbec55e82daad5 to your computer and use it in GitHub Desktop.
Add reactions to JDA messages with letters
package emoji;
import net.dv8tion.jda.core.entities.Message;
public class letters {
private final String[] letters = new String[] { "\uD83C\uDDE6", "\uD83C\uDDE7", "\uD83C\uDDE8", "\uD83C\uDDE9", "\uD83C\uDDEA", "\uD83C\uDDEB", "\uD83C\uDDEC", "\uD83C\uDDED", "\uD83C\uDDEE", "\uD83C\uDDEF", "\uD83C\uDDF0", "\uD83C\uDDF1", "\uD83C\uDDF2", "\uD83C\uDDF3", "\uD83C\uDDF4", "\uD83C\uDDF5", "\uD83C\uDDF6", "\uD83C\uDDF7", "\uD83C\uDDF8", "\uD83C\uDDF9", "\uD83C\uDDFA", "\uD83C\uDDFB", "\uD83C\uDDFC", "\uD83C\uDDFD", "\uD83C\uDDFE", "\uD83C\uDDFF" };
public void react(Message message, String reaction) {
for (final char c : reaction.toUpperCase().toCharArray()) {
message.addReaction(this.letters[c - 64 - 1]).queue(); // 64 is char padding, 1 is array starting at 0
}
}
}
@TommyAlmeida
Copy link

Documentation? Maybe explaining what is this supposed to do?

@SadiinsoSnowfall
Copy link

SadiinsoSnowfall commented Mar 6, 2019

If you happen to know Java, JDA and Discord it's simple.
This is a function that convert a string into discord letter emojis, then add them to a message as reactions

@WizardlyBump17
Copy link

react(e.getMessage(), "TOP");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment