use of net.dv8tion.jda.api.EmbedBuilder in project c0debaseBot by Biospheere.
the class RankCommand method execute.
@Override
public void execute(final String[] args, final Message message) {
final Member member = DiscordUtils.getAddressedMember(message);
final EmbedBuilder embedBuilder = getEmbed(message.getGuild(), member.getUser());
final User user = bot.getDatabase().getUserDao().getOrCreateUser(member.getGuild().getId(), member.getUser().getId());
embedBuilder.addField("Level", String.valueOf(user.getLevel()), false);
embedBuilder.addField("Exp", user.getXp() + "/" + (user.getLevel() == 0 ? "1000" : (1000 * user.getLevel() * 1.2)), false);
if (user.getLevel() == 0 || user.getLevel() == 1) {
embedBuilder.addField("Total Exp", String.valueOf(user.getLevel() == 0 ? user.getXp() : user.getXp() + 1000), false);
} else {
embedBuilder.addField("Total Exp", String.valueOf(Double.valueOf(((1000 * (user.getLevel() - 1) * 1.2) * user.getLevel()) / 2 + 1000 + user.getXp())), false);
}
message.getTextChannel().sendMessage(embedBuilder.build()).queue();
}
use of net.dv8tion.jda.api.EmbedBuilder in project Saber-Bot by notem.
the class SchedulesCommand method action.
@Override
public void action(String prefix, String[] args, MessageReceivedEvent event) {
Guild guild = event.getGuild();
List<String> scheduleIds = Main.getScheduleManager().getSchedulesForGuild(guild.getId());
// build output main body
StringBuilder content = new StringBuilder();
for (String sId : scheduleIds) {
content.append("<#").append(sId).append("> - has ").append(Main.getEntryManager().getEntriesFromChannel(sId).size()).append(" events\n");
}
// title for embed
String title = "Schedules on " + guild.getName();
// footer for embed
String footer = scheduleIds.size() + " schedule(s)";
// build embed
MessageEmbed embed = new EmbedBuilder().setDescription(content.toString()).setTitle(title).setFooter(footer, null).build();
// build message
Message message = new MessageBuilder().setEmbed(embed).build();
// send message
MessageUtilities.sendMsg(message, event.getTextChannel(), null);
}
Aggregations