use of com.vdurmont.emoji.Emoji in project BoltBot by DiscordBolt.
the class ChannelUtil method addReaction.
/**
* Adds a reaction to the message
*
* @param m The message to add to
* @param es2 The reaction list to add
*/
public static void addReaction(IMessage m, Emoji[] es2) {
List<Emoji> es1 = Arrays.asList(es2);
Collections.reverse(es1);
Emoji[] es = (Emoji[]) es1.toArray();
final AtomicInteger i = new AtomicInteger();
RequestBuffer.request(() -> {
for (; i.get() < es.length; i.incrementAndGet()) {
if (es[i.intValue()] != null) {
m.addReaction(es[i.intValue()]);
}
}
});
}
use of com.vdurmont.emoji.Emoji in project DiscordSailv2 by Vaerys-Dawn.
the class SetLevelUpReaction method execute.
@Override
public String execute(String args, CommandObject command) {
MessageTokenizer messageTokenizer = new MessageTokenizer(command.message.get());
Emoji emoji = EmojiManager.getByUnicode(new SplitFirstObject(args).getFirstWord());
IEmoji customEmoji = null;
if (args.equalsIgnoreCase("Remove")) {
command.guild.config.levelUpReaction = "null";
return "> Level Up reaction was removed.";
}
if (messageTokenizer.hasNextEmoji()) {
customEmoji = messageTokenizer.nextEmoji().getEmoji();
}
if (emoji == null && customEmoji == null) {
return "> Not a valid Emoji.";
} else if (emoji != null) {
command.guild.config.levelUpReaction = emoji.getUnicode();
return "> The message a user sent to level up will now be reacted with " + emoji.getUnicode() + ".";
} else {
command.guild.config.levelUpReaction = customEmoji.getStringID();
return "> The message a user sent to level up will now be reacted with " + customEmoji.toString() + ".";
}
}
Aggregations