Search in sources :

Example 31 with EmbedBuilder

use of net.dv8tion.jda.api.EmbedBuilder in project c0debaseBot by Biospheere.

the class Pagination method getEmbed.

public EmbedBuilder getEmbed(final Guild guild, final boolean descending) {
    final EmbedBuilder embedBuilder = getEmbed(guild);
    embedBuilder.setFooter("Seite: (1/" + ((guild.getMembers().size() / getPageSize()) + 1) + ") Sortierung: " + (descending ? "absteigend" : "aufsteigend"), guild.getIconUrl());
    return embedBuilder;
}
Also used : EmbedBuilder(net.dv8tion.jda.api.EmbedBuilder)

Example 32 with EmbedBuilder

use of net.dv8tion.jda.api.EmbedBuilder in project c0debaseBot by Biospheere.

the class Pagination method getEmbed.

public EmbedBuilder getEmbed(final Guild guild, final Integer currentPage, final Integer maxPages, final boolean descending) {
    final EmbedBuilder embedBuilder = getEmbed(guild);
    embedBuilder.setFooter("Seite: (" + currentPage + "/" + maxPages + ") Sortierung: " + (descending ? "absteigend" : "aufsteigend"), guild.getIconUrl());
    return embedBuilder;
}
Also used : EmbedBuilder(net.dv8tion.jda.api.EmbedBuilder)

Example 33 with EmbedBuilder

use of net.dv8tion.jda.api.EmbedBuilder in project c0debaseBot by Biospheere.

the class ServerinfoCommand method execute.

@Override
public void execute(final String[] args, final Message message) {
    final EmbedBuilder embedBuilder = getEmbed(message.getGuild(), message.getAuthor());
    final Member oldestMember = DiscordUtils.getOldestMember(message.getGuild());
    embedBuilder.setTitle(message.getGuild().getName(), "https://c0debase.de");
    embedBuilder.setThumbnail(message.getGuild().getIconUrl());
    embedBuilder.addField("Erstellt am", message.getGuild().getTimeCreated().format(DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm")), true);
    embedBuilder.addField("Region", message.getGuild().getRegionRaw(), true);
    embedBuilder.addField("Mitglieder", String.valueOf(message.getGuild().getMemberCount()), true);
    embedBuilder.addField("Boosts", String.valueOf(message.getGuild().getBoostCount()), true);
    embedBuilder.addField("Text Channels", String.valueOf(message.getGuild().getTextChannels().size()), true);
    embedBuilder.addField("Voice Channels", String.valueOf(message.getGuild().getVoiceChannels().size()), true);
    embedBuilder.addField("Rollen", String.valueOf(message.getGuild().getRoles().size()), true);
    embedBuilder.addField("Owner", StringUtils.replaceCharacter(message.getGuild().getOwner().getUser().getName()) + "#" + message.getGuild().getOwner().getUser().getDiscriminator(), true);
    if (oldestMember != null) {
        embedBuilder.addField("Ältestes Mitglied", StringUtils.replaceCharacter(oldestMember.getUser().getName()) + "#" + oldestMember.getUser().getDiscriminator(), true);
    }
    embedBuilder.addField("Erstellt vor", ChronoUnit.DAYS.between(message.getGuild().getTimeCreated(), LocalDateTime.now().atOffset(ZoneOffset.UTC)) + " Tagen", true);
    message.getTextChannel().sendMessage(embedBuilder.build()).queue();
}
Also used : EmbedBuilder(net.dv8tion.jda.api.EmbedBuilder) Member(net.dv8tion.jda.api.entities.Member)

Example 34 with EmbedBuilder

use of net.dv8tion.jda.api.EmbedBuilder in project c0debaseBot by Biospheere.

the class UserinfoCommand method execute.

@Override
public void execute(final String[] args, final Message message) {
    final Member member = DiscordUtils.getAddressedMember(message);
    final EmbedBuilder embedBuilder = getEmbed(message.getMember());
    embedBuilder.setThumbnail(member.getUser().getAvatarUrl());
    embedBuilder.addField("Name", StringUtils.replaceCharacter(member.getUser().getName()), true);
    embedBuilder.addField("Nickname", member.getNickname() == null ? StringUtils.replaceCharacter(member.getUser().getName()) : StringUtils.replaceCharacter(member.getNickname()), true);
    embedBuilder.addField("Status", member.getOnlineStatus().getKey(), true);
    embedBuilder.addField("Spiel", member.getActivities().isEmpty() ? "---" : member.getActivities().get(0).getName(), true);
    embedBuilder.addField("Rollen", String.valueOf(member.getRoles().size()), true);
    embedBuilder.addField("Beitritt", member.getTimeJoined().format(DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm")), true);
    embedBuilder.addField("Erstelldatum: ", member.getUser().getTimeCreated().format(DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm")), true);
    embedBuilder.addField("Standard Avatar: ", String.valueOf(member.getUser().getAvatarUrl() == null), true);
    message.getTextChannel().sendMessage(embedBuilder.build()).queue();
}
Also used : EmbedBuilder(net.dv8tion.jda.api.EmbedBuilder) Member(net.dv8tion.jda.api.entities.Member)

Example 35 with EmbedBuilder

use of net.dv8tion.jda.api.EmbedBuilder in project c0debaseBot by Biospheere.

the class ChangeBannerCommand method execute.

@Override
public void execute(String[] args, Message message) {
    if (this.serverBanner == null) {
        return;
    }
    if (!message.getGuild().getFeatures().contains("BANNER")) {
        message.getTextChannel().sendMessage(new EmbedBuilder().setDescription("Auf diesem Server kann aktuell kein Banner gesetzt werden!").setColor(Color.RED).build()).queue();
        return;
    }
    this.serverBanner.run();
    message.getTextChannel().sendMessage(new EmbedBuilder().setTitle("Erledigt!").setDescription("Force-Update des Banners wurde ausgeführt!").setImage(message.getGuild().getBannerUrl()).setColor(Color.GREEN).build()).queue();
}
Also used : EmbedBuilder(net.dv8tion.jda.api.EmbedBuilder)

Aggregations

EmbedBuilder (net.dv8tion.jda.api.EmbedBuilder)47 Member (net.dv8tion.jda.api.entities.Member)8 TimeUnit (java.util.concurrent.TimeUnit)7 Collectors (java.util.stream.Collectors)7 Message (net.dv8tion.jda.api.entities.Message)7 Context (net.kodehawa.mantarobot.core.modules.commands.base.Context)7 MantaroData (net.kodehawa.mantarobot.data.MantaroData)7 EmoteReference (net.kodehawa.mantarobot.utils.commands.EmoteReference)7 Color (java.awt.Color)6 MessageBuilder (net.dv8tion.jda.api.MessageBuilder)6 MessageEmbed (net.dv8tion.jda.api.entities.MessageEmbed)6 Utils (net.kodehawa.mantarobot.utils.Utils)6 Subscribe (com.google.common.eventbus.Subscribe)5 List (java.util.List)5 Role (net.dv8tion.jda.api.entities.Role)5 CommandCategory (net.kodehawa.mantarobot.core.modules.commands.base.CommandCategory)5 HelpContent (net.kodehawa.mantarobot.core.modules.commands.help.HelpContent)5 I18nContext (net.kodehawa.mantarobot.core.modules.commands.i18n.I18nContext)5 LinkedList (java.util.LinkedList)4 Permission (net.dv8tion.jda.api.Permission)4