use of sx.blah.discord.util.MessageTokenizer 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