use of net.dv8tion.jda.api.EmbedBuilder in project c0debaseBot by Biospheere.
the class GuildMemberJoinListener method sendLogMessage.
private void sendLogMessage(final Member member) {
member.getGuild().getTextChannelsByName("log", true).forEach(channel -> {
final EmbedBuilder logBuilder = DiscordUtils.getDefaultEmbed(member);
logBuilder.setThumbnail(member.getUser().getEffectiveAvatarUrl());
logBuilder.appendDescription("Erstelldatum: " + member.getUser().getTimeCreated().format(DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm")) + "\n");
logBuilder.appendDescription("Standard Avatar: " + (member.getUser().getAvatarUrl() == null) + "\n");
channel.sendMessage(logBuilder.build()).queue();
});
}
use of net.dv8tion.jda.api.EmbedBuilder in project c0debaseBot by Biospheere.
the class GuildMemberJoinListener method sendWelcomeMessage.
private void sendWelcomeMessage(final Member member) {
if (System.getenv("BOTCHANNEL") == null) {
return;
}
final boolean firstJoin = bot.getDatabase().getUserDao().getUser(member.getGuild().getId(), member.getId()) == null;
final EmbedBuilder embedBuilder = DiscordUtils.getDefaultEmbed(member);
embedBuilder.setColor(member.getGuild().getSelfMember().getColor());
embedBuilder.setThumbnail(member.getUser().getEffectiveAvatarUrl());
embedBuilder.appendDescription("Willkommen " + (firstJoin ? "" : "zurück ") + "auf c0debase " + member.getAsMention() + "\n");
embedBuilder.appendDescription("— Weise dir eine Rolle mit !role zu\n");
embedBuilder.appendDescription("— Schaue dir die Regeln in #rules an");
member.getGuild().getTextChannelById(System.getenv("BOTCHANNEL")).sendMessage(embedBuilder.build()).queue();
}
use of net.dv8tion.jda.api.EmbedBuilder in project c0debaseBot by Biospheere.
the class GuildMemberNickChangeListener method onGuildMemberUpdateNickname.
@Override
public void onGuildMemberUpdateNickname(@Nonnull GuildMemberUpdateNicknameEvent event) {
event.getGuild().getTextChannelsByName("log", true).forEach(channel -> {
final EmbedBuilder logBuilder = DiscordUtils.getDefaultEmbed(event.getMember());
logBuilder.setTitle("Nickname geändert");
logBuilder.appendDescription("Neuer Nickname:" + event.getNewNickname() + "\n");
logBuilder.appendDescription("Alter Nickname: " + event.getOldNickname());
channel.sendMessage(logBuilder.build()).queue();
});
}
use of net.dv8tion.jda.api.EmbedBuilder in project c0debaseBot by Biospheere.
the class StatsCommand method execute.
@Override
public void execute(final String[] args, final Message message) {
final JDA jda = message.getJDA();
final long uptime = ManagementFactory.getRuntimeMXBean().getUptime();
final EmbedBuilder embedBuilder = getEmbed(message.getGuild(), message.getAuthor());
embedBuilder.addField("JDA Version", JDAInfo.VERSION, true);
embedBuilder.addField("Ping", jda.getGatewayPing() + "ms", true);
embedBuilder.addField("Uptime", String.valueOf(TimeUnit.MILLISECONDS.toDays(uptime) + "d " + TimeUnit.MILLISECONDS.toHours(uptime) % 24 + "h " + TimeUnit.MILLISECONDS.toMinutes(uptime) % 60 + "m " + TimeUnit.MILLISECONDS.toSeconds(uptime) % 60 + "s"), true);
embedBuilder.addField("Commands", String.valueOf(bot.getCommandManager().getAvailableCommands().size()), true);
embedBuilder.addField("Mitglieder", String.valueOf(jda.getGuilds().stream().mapToInt(Guild::getMemberCount).sum()), true);
embedBuilder.addField("Java Version", System.getProperty("java.runtime.version").replace("+", "_"), true);
embedBuilder.addField("Betriebssystem", ManagementFactory.getOperatingSystemMXBean().getName(), true);
message.getChannel().sendMessage(embedBuilder.build()).queue();
}
use of net.dv8tion.jda.api.EmbedBuilder in project c0debaseBot by Biospheere.
the class YesNoCommand method execute.
@Override
public void execute(final String[] args, final Message message) {
if (args.length > 0) {
final StringJoiner stringJoiner = new StringJoiner(" ");
for (int i = 0; i < args.length; i++) {
stringJoiner.add(args[i]);
}
final boolean yn = Constants.RANDOM.nextBoolean();
message.getTextChannel().sendMessage(new EmbedBuilder().setTitle("Ja oder Nein?").setDescription("Deine Frage: " + stringJoiner.toString() + "\n\n" + "Meine Antwort: " + (yn ? "Ja" : "Nein") + "\n").setColor(yn ? Color.GREEN : Color.RED).setImage(yn ? yesGifs.get(Constants.RANDOM.nextInt(yesGifs.size())) : noGifs.get(Constants.RANDOM.nextInt(noGifs.size()))).build()).queue();
} else {
message.getTextChannel().sendMessage(getEmbed(message.getGuild(), message.getAuthor()).setDescription("!yn [Deine Frage]").build()).queue();
}
}
Aggregations