Search in sources :

Example 26 with WebhookEmbedBuilder

use of club.minnced.discord.webhook.send.WebhookEmbedBuilder in project Appenders by Taucher2003.

the class AbstractDiscordAppender method createEmbed.

protected WebhookEmbed createEmbed(LogEntry logEntry) {
    WebhookEmbedBuilder builder = new WebhookEmbedBuilder().setTitle(new WebhookEmbed.EmbedTitle(logEntry.getLevel().toString(), null)).setTimestamp(Instant.ofEpochMilli(logEntry.getTimestamp())).setColor(getColor(logEntry.getLevel()).getRGB()).setFooter(new WebhookEmbed.EmbedFooter(logEntry.getLoggerName() + "@" + logEntry.getThreadName(), null));
    String description = Utilities.shortenWithEndCut(logEntry.getFormattedMessage(), maxTextSize());
    Throwable throwable = logEntry.getThrowable();
    if (throwable != null) {
        int remainingCharacters = maxTextSize() - description.length();
        remainingCharacters -= "\n\n```\n```".length();
        if (remainingCharacters > 0) {
            String stacktraceFormatted = Utilities.getExceptionStacktrace(throwable, remainingCharacters);
            description += String.format("\n\n```\n%s```", stacktraceFormatted);
        }
    }
    builder.setDescription(description);
    return builder.build();
}
Also used : WebhookEmbed(club.minnced.discord.webhook.send.WebhookEmbed) WebhookEmbedBuilder(club.minnced.discord.webhook.send.WebhookEmbedBuilder)

Example 27 with WebhookEmbedBuilder

use of club.minnced.discord.webhook.send.WebhookEmbedBuilder in project Ree6 by Ree6-Applications.

the class LoggerQueue method add.

/**
 * Add a Logging Message into the List.
 *
 * @param loggerMessage the logging message.
 */
public void add(LoggerMessage loggerMessage) {
    if (!logs.contains(loggerMessage)) {
        logs.add(loggerMessage);
        // Creating a new Webhook Message with an Embed.
        WebhookMessageBuilder webhookMessageBuilder = new WebhookMessageBuilder().setAvatarUrl(BotInfo.botInstance.getSelfUser().getAvatarUrl()).setUsername("Ree6Logs");
        WebhookEmbedBuilder webhookEmbedBuilder = new WebhookEmbedBuilder().setColor(Color.BLACK.getRGB()).setFooter(new WebhookEmbed.EmbedFooter(loggerMessage.getGuild().getName() + " - " + Data.ADVERTISEMENT, (loggerMessage.getGuild().getIconUrl() != null ? loggerMessage.getGuild().getIconUrl() : null))).setTimestamp(Instant.now());
        // For later to check if it has been modified or not.
        boolean modified = false;
        // Stop if the Guild is null.
        if (loggerMessage.getGuild() == null)
            return;
        // Check if it's a VoiceChannel Join log.
        if (loggerMessage.getType() == LoggerMessage.LogTyp.VC_JOIN) {
            if (logs.stream().filter(loggerMessages -> loggerMessages != loggerMessage && loggerMessages.getId() == loggerMessage.getId() && loggerMessages.getVoiceData() != null && loggerMessages.getVoiceData().getMember() == loggerMessage.getVoiceData().getMember() && !loggerMessages.isCanceled()).anyMatch(loggerMessages -> loggerMessages.getType() == LoggerMessage.LogTyp.VC_LEAVE)) {
                // Cancel every Log-Message which indicates that the person left.
                logs.stream().filter(loggerMessages -> loggerMessages != loggerMessage && loggerMessages.getId() == loggerMessage.getId() && !loggerMessages.isCanceled() && loggerMessages.getVoiceData() != null && loggerMessages.getVoiceData().getMember() == loggerMessage.getVoiceData().getMember() && loggerMessages.getType() == LoggerMessage.LogTyp.VC_LEAVE).forEach(loggerMessages -> loggerMessages.setCanceled(true));
                // Set the new Webhook Message.
                webhookEmbedBuilder.setAuthor(new WebhookEmbed.EmbedAuthor(loggerMessage.getVoiceData().getMember().getUser().getAsTag(), loggerMessage.getVoiceData().getMember().getUser().getAvatarUrl(), null));
                webhookEmbedBuilder.setDescription(loggerMessage.getVoiceData().getMember().getAsMention() + " **rejoined the Voice-channel** " + loggerMessage.getVoiceData().getCurrentVoiceChannel().getAsMention());
                modified = true;
            }
        } else // Check if it's a VoiceChannel Move log.
        if (loggerMessage.getType() == LoggerMessage.LogTyp.VC_MOVE) {
            if (logs.stream().filter(loggerMessages -> loggerMessages != loggerMessage && loggerMessages.getId() == loggerMessage.getId() && loggerMessages.getVoiceData() != null && loggerMessages.getVoiceData().getMember() == loggerMessage.getVoiceData().getMember() && !loggerMessages.isCanceled()).anyMatch(loggerMessages -> loggerMessages.getType() == LoggerMessage.LogTyp.VC_MOVE)) {
                // Cancel every Log-Message which indicates that the person moved.
                logs.stream().filter(loggerMessages -> loggerMessages.getId() == loggerMessage.getId() && loggerMessages != loggerMessage && loggerMessages.getVoiceData() != null && loggerMessages.getVoiceData().getMember() == loggerMessage.getVoiceData().getMember() && !loggerMessages.isCanceled() && loggerMessages.getType() == LoggerMessage.LogTyp.VC_MOVE).forEach(loggerMessages -> loggerMessages.setCanceled(true));
                // Set the new Webhook Message.
                webhookEmbedBuilder.setAuthor(new WebhookEmbed.EmbedAuthor(loggerMessage.getVoiceData().getMember().getUser().getAsTag(), loggerMessage.getVoiceData().getMember().getUser().getAvatarUrl(), null));
                webhookEmbedBuilder.setDescription(loggerMessage.getVoiceData().getMember().getUser().getAsMention() + " **moved through many Voice-channels and is now in** " + loggerMessage.getVoiceData().getCurrentVoiceChannel().getAsMention());
                modified = true;
            }
        } else // Check if it's a VoiceChannel Leave log.
        if (loggerMessage.getType() == LoggerMessage.LogTyp.VC_LEAVE) {
            if (logs.stream().filter(loggerMessages -> loggerMessages != loggerMessage && loggerMessages.getId() == loggerMessage.getId() && loggerMessages.getVoiceData() != null && loggerMessages.getVoiceData().getMember() == loggerMessage.getVoiceData().getMember() && !loggerMessages.isCanceled()).anyMatch(loggerMessages -> loggerMessages.getType() == LoggerMessage.LogTyp.VC_JOIN)) {
                // Cancel every Log-Message which indicates that the person joined.
                logs.stream().filter(loggerMessages -> loggerMessages != loggerMessage && loggerMessages.getId() == loggerMessage.getId() && loggerMessages.getVoiceData() != null && loggerMessages.getVoiceData().getMember() == loggerMessage.getVoiceData().getMember() && !loggerMessages.isCanceled() && loggerMessages.getType() == LoggerMessage.LogTyp.VC_JOIN).forEach(loggerMessages -> loggerMessages.setCanceled(true));
                // Set the new Webhook Message.
                webhookEmbedBuilder.setAuthor(new WebhookEmbed.EmbedAuthor(loggerMessage.getVoiceData().getMember().getUser().getAsTag(), loggerMessage.getVoiceData().getMember().getUser().getAvatarUrl(), null));
                webhookEmbedBuilder.setDescription(loggerMessage.getVoiceData().getMember().getUser().getAsMention() + " **joined and left the Voice-channel** " + loggerMessage.getVoiceData().getPreviousVoiceChannel().getAsMention());
                modified = true;
            }
        } else // Check if it's a Nickname Change Log.
        if (loggerMessage.getType() == LoggerMessage.LogTyp.NICKNAME_CHANGE) {
            if (logs.stream().filter(loggerMessages -> loggerMessages != loggerMessage && loggerMessages.getId() == loggerMessage.getId() && loggerMessages.getMemberData() != null && loggerMessages.getMemberData().getMember() == loggerMessage.getMemberData().getMember() && !loggerMessages.isCanceled()).anyMatch(loggerMessages -> loggerMessages.getType() == LoggerMessage.LogTyp.NICKNAME_CHANGE)) {
                // Get the latest previous UserData.
                LoggerMemberData memberData = logs.stream().filter(loggerMessages -> loggerMessages != loggerMessage && loggerMessages.getId() == loggerMessage.getId() && loggerMessages.getMemberData().getMember() == loggerMessage.getMemberData().getMember() && !loggerMessages.isCanceled() && loggerMessages.getType() == LoggerMessage.LogTyp.NICKNAME_CHANGE).findFirst().orElseThrow().getMemberData();
                // Cancel every Log-Message which indicates that the person changed their name.
                logs.stream().filter(loggerMessages -> loggerMessages != loggerMessage && loggerMessages.getId() == loggerMessage.getId() && loggerMessages.getMemberData().getMember() == loggerMessage.getMemberData().getMember() && !loggerMessages.isCanceled() && loggerMessages.getType() == LoggerMessage.LogTyp.NICKNAME_CHANGE).forEach(loggerMessages -> loggerMessages.setCanceled(true));
                // Change the current previous Nickname to the old one.
                loggerMessage.getMemberData().setPreviousName(memberData.getPreviousName());
                // Set the new Webhook Message.
                webhookEmbedBuilder.setAuthor(new WebhookEmbed.EmbedAuthor(loggerMessage.getVoiceData().getMember().getUser().getAsTag(), loggerMessage.getMemberData().getMember().getUser().getAvatarUrl(), null));
                webhookEmbedBuilder.setDescription("The Nickname of " + loggerMessage.getMemberData().getMember().getAsMention() + " has been changed.\n**New Nickname:**\n" + loggerMessage.getMemberData().getCurrentName() + "\n**Old Nickname:**\n" + (memberData.getPreviousName() != null ? memberData.getPreviousName() : loggerMessage.getMemberData().getMember().getUser().getName()));
                modified = true;
            }
        } else // Check if it's a Member Role Change log.
        if (loggerMessage.getType() == LoggerMessage.LogTyp.MEMBERROLE_CHANGE) {
            if (logs.stream().filter(loggerMessages -> loggerMessages != loggerMessage && loggerMessages.getMemberData() != null && loggerMessages.getMemberData().getMember() == loggerMessage.getMemberData().getMember() && loggerMessages.getId() == loggerMessage.getId() && !loggerMessages.isCanceled()).anyMatch(loggerMessages -> loggerMessages.getType() == LoggerMessage.LogTyp.MEMBERROLE_CHANGE)) {
                // Get the latest MemberData.
                LoggerMemberData memberData = logs.stream().filter(loggerMessages -> loggerMessages != loggerMessage && loggerMessages.getId() == loggerMessage.getId() && loggerMessages.getMemberData() != null && loggerMessages.getMemberData().getMember() == loggerMessage.getMemberData().getMember() && !loggerMessages.isCanceled() && loggerMessages.getType() == LoggerMessage.LogTyp.MEMBERROLE_CHANGE).findFirst().orElseThrow().getMemberData();
                // Cancel every other LogEvent of that Typ.
                logs.stream().filter(loggerMessages -> loggerMessages != loggerMessage && loggerMessages.getId() == loggerMessage.getId() && loggerMessages.getMemberData() != null && loggerMessages.getMemberData().getMember() == loggerMessage.getMemberData().getMember() && !loggerMessages.isCanceled() && loggerMessages.getType() == LoggerMessage.LogTyp.MEMBERROLE_CHANGE).forEach(loggerMessages -> loggerMessages.setCanceled(true));
                // Check if the RemoveRoles is null or empty.
                if ((loggerMessage.getMemberData().getRemovedRoles() == null || loggerMessage.getMemberData().getRemovedRoles().isEmpty()) && memberData.getRemovedRoles() != null && !memberData.getRemovedRoles().isEmpty()) {
                    // Set the current removed Roles to the one from the latest.
                    loggerMessage.getMemberData().setRemovedRoles(memberData.getRemovedRoles());
                }
                // Check if the AddedRoles is null or empty.
                if ((loggerMessage.getMemberData().getAddedRoles() == null || loggerMessage.getMemberData().getAddedRoles().isEmpty()) && memberData.getAddedRoles() != null && !memberData.getAddedRoles().isEmpty()) {
                    // Set the current added Roles to the one from the latest.
                    loggerMessage.getMemberData().setAddedRoles(memberData.getAddedRoles());
                }
                // Check if the addedRoles and removeRoles are null if so create new List.
                if (loggerMessage.getMemberData().getAddedRoles() == null)
                    loggerMessage.getMemberData().setAddedRoles(new ArrayList<>());
                if (loggerMessage.getMemberData().getRemovedRoles() == null)
                    loggerMessage.getMemberData().setRemovedRoles(new ArrayList<>());
                // Check if the Lists are Empty if not remove duplicated entries.
                if (!loggerMessage.getMemberData().getRemovedRoles().isEmpty() && !loggerMessage.getMemberData().getAddedRoles().isEmpty()) {
                    loggerMessage.getMemberData().getRemovedRoles().removeIf(role -> role == null || loggerMessage.getMemberData().getAddedRoles().contains(role));
                }
                // Merge both lists with the current List.
                if (memberData != null && memberData.getRemovedRoles() != null && !memberData.getRemovedRoles().isEmpty() && memberData.getRemovedRoles().stream().anyMatch(role -> role != null && loggerMessage.getMemberData().getAddedRoles().contains(role) && !loggerMessage.getMemberData().getRemovedRoles().contains(role))) {
                    try {
                        memberData.getRemovedRoles().stream().filter(role -> role != null && !loggerMessage.getMemberData().getAddedRoles().contains(role) && !loggerMessage.getMemberData().getRemovedRoles().contains(role)).forEach(role -> loggerMessage.getMemberData().getRemovedRoles().add(role));
                    } catch (Exception ignore) {
                    }
                }
                if (memberData != null && memberData.getAddedRoles() != null && !memberData.getAddedRoles().isEmpty() && memberData.getAddedRoles().stream().anyMatch(role -> role != null && loggerMessage.getMemberData().getAddedRoles().contains(role) && !loggerMessage.getMemberData().getRemovedRoles().contains(role))) {
                    try {
                        memberData.getAddedRoles().stream().filter(role -> role != null && !loggerMessage.getMemberData().getAddedRoles().contains(role) && !loggerMessage.getMemberData().getRemovedRoles().contains(role)).forEach(role -> loggerMessage.getMemberData().getAddedRoles().add(role));
                    } catch (Exception ignore) {
                    }
                }
                // StringBuilder to convert the List into a single String.
                StringBuilder stringBuilder = new StringBuilder();
                // Add the Entries into the String.
                loggerMessage.getMemberData().getAddedRoles().forEach(role -> stringBuilder.append(":white_check_mark:").append(" ").append(role.getName()).append("\n"));
                loggerMessage.getMemberData().getRemovedRoles().forEach(role -> stringBuilder.append(":no_entry:").append(" ").append(role.getName()).append("\n"));
                // Set Embed Elements.
                webhookEmbedBuilder.setAuthor(new WebhookEmbed.EmbedAuthor(loggerMessage.getMemberData().getMember().getUser().getAsTag(), loggerMessage.getMemberData().getMember().getUser().getAvatarUrl(), null));
                webhookEmbedBuilder.setThumbnailUrl(loggerMessage.getMemberData().getMember().getUser().getAvatarUrl());
                webhookEmbedBuilder.setDescription(":writing_hand: " + loggerMessage.getMemberData().getMember().getAsMention() + " **has been updated.**");
                if (!loggerMessage.getMemberData().getAddedRoles().isEmpty() || !loggerMessage.getMemberData().getRemovedRoles().isEmpty())
                    webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "**Roles:**", stringBuilder.toString()));
                modified = true;
            }
        } else // Check if it's a Role Update log.
        if (loggerMessage.getType() == LoggerMessage.LogTyp.ROLEDATA_CHANGE) {
            if (logs.stream().filter(loggerMessages -> loggerMessages != loggerMessage && loggerMessages.getId() == loggerMessage.getId() && loggerMessages.getRoleData() != null && !loggerMessages.isCanceled()).anyMatch(loggerMessages -> loggerMessages.getType() == LoggerMessage.LogTyp.ROLEDATA_CHANGE)) {
                // Get the latest RoleData.
                LoggerRoleData roleData = logs.stream().filter(loggerMessages -> loggerMessages != loggerMessage && loggerMessages.getId() == loggerMessage.getId() && loggerMessages.getRoleData() != null && !loggerMessages.isCanceled() && loggerMessages.getType() == LoggerMessage.LogTyp.ROLEDATA_CHANGE).findFirst().orElseThrow().getRoleData();
                // Cancel every Log-Message which indicates that the person changed their name.
                logs.stream().filter(loggerMessages -> loggerMessages != loggerMessage && loggerMessages.getId() == loggerMessage.getId() && !loggerMessages.isCanceled() && loggerMessages.getType() == LoggerMessage.LogTyp.ROLEDATA_CHANGE).forEach(loggerMessages -> loggerMessages.setCanceled(true));
                // Start merging the Role Permissions
                if (roleData != null) {
                    // Check if the latest Role Data has a previous Name.
                    if (roleData.getPreviousName() != null && !roleData.getPreviousName().isEmpty()) {
                        // Set the previous Name of the current Role Data to the latest one.
                        loggerMessage.getRoleData().setPreviousName(roleData.getPreviousName());
                    }
                    // Check if the latest Role Data has a current Name.
                    if ((loggerMessage.getRoleData().getCurrentName() == null || loggerMessage.getRoleData().getCurrentName().isEmpty()) && roleData.getCurrentName() != null && !roleData.getCurrentName().isEmpty()) {
                        // Set the current Name of the current Role Data to the latest one.
                        loggerMessage.getRoleData().setCurrentName(roleData.getCurrentName());
                    }
                    // Check if the latest Role Data has previous Permissions.
                    if (roleData.getPreviousPermission() != null && !roleData.getPreviousPermission().isEmpty()) {
                        // Set the previous Permissions.
                        loggerMessage.getRoleData().setPreviousPermission(roleData.getPreviousPermission());
                    }
                    // Check if the latest Role Data has current Permissions.
                    if ((loggerMessage.getRoleData().getCurrentPermission() == null || loggerMessage.getRoleData().getCurrentPermission().isEmpty()) && roleData.getCurrentPermission() != null && !roleData.getCurrentPermission().isEmpty()) {
                        // Set the current Permissions.
                        loggerMessage.getRoleData().setCurrentPermission(roleData.getCurrentPermission());
                    }
                    // Check if the latest Role Data has a previous Color.
                    if (roleData.getPreviousColor() != null) {
                        // Set the previous Color.
                        loggerMessage.getRoleData().setPreviousColor(roleData.getPreviousColor());
                    }
                    // Check if the latest Role Data has a current Color.
                    if (loggerMessage.getRoleData().getCurrentColor() == null && roleData.getCurrentColor() != null) {
                        // Set the current Color.
                        loggerMessage.getRoleData().setCurrentColor(roleData.getCurrentColor());
                    }
                    // Check if the latest has another value for Hoisted and if the current Value is the default Value or not.
                    if (!loggerMessage.getRoleData().isChangedHoisted() && roleData.isChangedHoisted()) {
                        // Set the current Value to the one from the latest.
                        loggerMessage.getRoleData().setChangedHoisted(roleData.isChangedHoisted());
                    }
                    // Check if the latest has another value for Mentioned and if the current Value is the default Value or not.
                    if (!loggerMessage.getRoleData().isChangedMentioned() && roleData.isChangedMentioned()) {
                        // Set the current Value to the one from the latest.
                        loggerMessage.getRoleData().setChangedMentioned(roleData.isChangedMentioned());
                    }
                }
                // Set the author of the WebhookMessage.
                webhookEmbedBuilder.setAuthor(new WebhookEmbed.EmbedAuthor(loggerMessage.getGuild().getName(), loggerMessage.getGuild().getIconUrl(), null));
                // Check if it isn't a new created or deleted Role.
                if (!loggerMessage.getRoleData().isCreated() && !loggerMessage.getRoleData().isDeleted()) {
                    // Set update as Description
                    webhookEmbedBuilder.setDescription(":family_mmb: ``" + loggerMessage.getRoleData().getCurrentName() + "`` **has been updated.**");
                    // Check if there is a previous and current Name.
                    if (loggerMessage.getRoleData().getPreviousName() != null && loggerMessage.getRoleData().getCurrentName() != null) {
                        // Add new Fields with Information.
                        webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "**Old name**", loggerMessage.getRoleData().getPreviousName()));
                        webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "**New name**", loggerMessage.getRoleData().getCurrentName()));
                        webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "** **", "** **"));
                    }
                    // Check if the Mentioned has been changed or not.
                    if (loggerMessage.getRoleData().isChangedMentioned()) {
                        // Add new Fields with Information.
                        webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "**Old mentionable**", !loggerMessage.getRoleData().isMentioned() + ""));
                        webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "**New mentionable**", loggerMessage.getRoleData().isMentioned() + ""));
                        webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "** **", "** **"));
                    }
                    // Check if the Hoisted has been changed or not.
                    if (loggerMessage.getRoleData().isChangedHoisted()) {
                        // Add new Fields with Information.
                        webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "**Old hoist**", !loggerMessage.getRoleData().isHoisted() + ""));
                        webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "**New hoist**", loggerMessage.getRoleData().isHoisted() + ""));
                        webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "** **", "** **"));
                    }
                    // Check if a new Color has been added or changed.
                    if (loggerMessage.getRoleData().getPreviousColor() != null || loggerMessage.getRoleData().getCurrentColor() != null) {
                        // Add new Fields with Information.
                        webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "**Old color**", (loggerMessage.getRoleData().getPreviousColor() != null ? loggerMessage.getRoleData().getPreviousColor() : Color.gray).getRGB() + ""));
                        webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "**New color**", (loggerMessage.getRoleData().getCurrentColor() != null ? loggerMessage.getRoleData().getCurrentColor() : Color.gray).getRGB() + ""));
                        webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "** **", "** **"));
                    }
                    // Create empty lists in case of them being null
                    if (loggerMessage.getRoleData().getPreviousPermission() == null)
                        loggerMessage.getRoleData().setPreviousPermission(EnumSet.noneOf(Permission.class));
                    if (loggerMessage.getRoleData().getCurrentPermission() == null)
                        loggerMessage.getRoleData().setCurrentPermission(EnumSet.noneOf(Permission.class));
                    // Create StringBuilder for Permission diff.
                    StringBuilder stringBuilder = new StringBuilder(loggerMessage.getRoleData().getCurrentPermission().stream().anyMatch(permission -> !loggerMessage.getRoleData().getPreviousPermission().contains(permission)) ? ":white_check_mark:" : ":no_entry:").append(" ");
                    // Go through every message in currentPermission and add them to the String.
                    for (Permission permission : loggerMessage.getRoleData().getCurrentPermission().stream().filter(permission -> !loggerMessage.getRoleData().getPreviousPermission().contains(permission)).toList()) {
                        if (stringBuilder.length() >= 22) {
                            stringBuilder.append("\n:white_check_mark: ").append(permission.getName());
                        } else {
                            stringBuilder.append(permission.getName());
                        }
                    }
                    // Go through every message in previousPermission and add them to the String.
                    for (Permission permission : loggerMessage.getRoleData().getPreviousPermission().stream().filter(permission -> !loggerMessage.getRoleData().getCurrentPermission().contains(permission)).toList()) {
                        if (stringBuilder.length() >= 11) {
                            stringBuilder.append("\n:no_entry: ").append(permission.getName());
                        } else {
                            stringBuilder.append(permission.getName());
                        }
                    }
                    // Add the String from the StringBuilder as Embed to the Message
                    if (!stringBuilder.toString().isEmpty())
                        webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "**New permissions**", stringBuilder.toString()));
                } else {
                    // Check if the Role has been created.
                    if (loggerMessage.getRoleData().isCreated()) {
                        // Set description to new Role created.
                        webhookEmbedBuilder.setDescription(":family_mmb: ``" + loggerMessage.getRoleData().getCurrentName() + "`` **has been created.**");
                    } else {
                        // Set description to Role deleted.
                        webhookEmbedBuilder.setDescription(":family_mmb: ``" + loggerMessage.getRoleData().getCurrentName() + "`` **has been deleted.**");
                    }
                }
                // Set the new Webhook Message.
                modified = true;
            }
        } else // Check if it's a User leave log.
        if (loggerMessage.getType() == LoggerMessage.LogTyp.SERVER_LEAVE) {
            if (logs.stream().filter(loggerMessages -> loggerMessages != loggerMessage && loggerMessages.getId() == loggerMessage.getId() && loggerMessages.getUserData() != null && loggerMessages.getUserData().getUser().getIdLong() == loggerMessage.getUserData().getUser().getIdLong() && !loggerMessages.isCanceled()).anyMatch(loggerMessages -> loggerMessages.getType() == LoggerMessage.LogTyp.SERVER_JOIN || loggerMessages.getType() == LoggerMessage.LogTyp.USER_BAN)) {
                // Cancel every Log-Message which indicates that the person joined the Server or got banned.
                logs.stream().filter(loggerMessages -> loggerMessages != loggerMessage && loggerMessages.getId() == loggerMessage.getId() && loggerMessages.getUserData() != null && loggerMessages.getUserData().getUser().getIdLong() == loggerMessage.getUserData().getUser().getIdLong() && !loggerMessages.isCanceled() && (loggerMessages.getType() == LoggerMessage.LogTyp.SERVER_JOIN || loggerMessages.getType() == LoggerMessage.LogTyp.USER_BAN)).forEach(loggerMessages -> loggerMessages.setCanceled(true));
                // Set the new Webhook Message.
                webhookEmbedBuilder.setAuthor(new WebhookEmbed.EmbedAuthor(loggerMessage.getUserData().getUser().getAsTag(), loggerMessage.getUserData().getUser().getAvatarUrl(), null));
                if (logs.stream().filter(loggerMessages -> loggerMessages != loggerMessage && loggerMessages.getId() == loggerMessage.getId() && loggerMessages.getUserData() != null && loggerMessages.getUserData().getUser().getIdLong() == loggerMessage.getUserData().getUser().getIdLong()).anyMatch(loggerMessages -> loggerMessages.getType() == LoggerMessage.LogTyp.USER_BAN)) {
                    webhookEmbedBuilder.setDescription(loggerMessage.getUserData().getUser().getAsMention() + " **has been banned.** ");
                } else {
                    webhookEmbedBuilder.setDescription(loggerMessage.getUserData().getUser().getAsMention() + " **joined and left this Server.** ");
                }
                modified = true;
            }
        }
        // add the created WebhookEmbedBuilder as WebhookEmbed to the WebhookMessage Builder.
        webhookMessageBuilder.addEmbeds(webhookEmbedBuilder.build());
        // If the message has been modified change the WebhookMessage.
        if (modified) {
            loggerMessage.setWebhookMessage(webhookMessageBuilder.build());
        }
        // Create new Thread for Log-Message to send.
        new Thread(() -> {
            // Let it wait for 10 seconds.
            try {
                Thread.sleep(10000);
            } catch (InterruptedException ignored) {
            }
            // If not canceled send it.
            if (!loggerMessage.isCanceled()) {
                Webhook.sendWebhook(loggerMessage, loggerMessage.getWebhookMessage(), loggerMessage.getId(), loggerMessage.getAuthCode(), true);
            }
            // Remove it from the list.
            logs.remove(loggerMessage);
        }).start();
    }
}
Also used : WebhookMessageBuilder(club.minnced.discord.webhook.send.WebhookMessageBuilder) java.awt(java.awt) BotInfo(de.presti.ree6.bot.BotInfo) Webhook(de.presti.ree6.bot.Webhook) WebhookEmbedBuilder(club.minnced.discord.webhook.send.WebhookEmbedBuilder) WebhookEmbed(club.minnced.discord.webhook.send.WebhookEmbed) Permission(net.dv8tion.jda.api.Permission) Data(de.presti.ree6.main.Data) Instant(java.time.Instant) EnumSet(java.util.EnumSet) ArrayList(java.util.ArrayList) WebhookMessageBuilder(club.minnced.discord.webhook.send.WebhookMessageBuilder) ArrayList(java.util.ArrayList) WebhookEmbed(club.minnced.discord.webhook.send.WebhookEmbed) Permission(net.dv8tion.jda.api.Permission) WebhookEmbedBuilder(club.minnced.discord.webhook.send.WebhookEmbedBuilder)

Example 28 with WebhookEmbedBuilder

use of club.minnced.discord.webhook.send.WebhookEmbedBuilder in project Ree6 by Ree6-Applications.

the class Notifier method registerTwitchEventHandler.

// region Twitch
/**
 * Register a EventHandler for the Twitch Livestream Event.
 */
public void registerTwitchEventHandler() {
    getTwitchClient().getEventManager().onEvent(ChannelGoLiveEvent.class, channelGoLiveEvent -> {
        // Go through every Webhook that is registered for the Twitch Channel
        for (String[] credits : Main.getInstance().getSqlConnector().getSqlWorker().getTwitchWebhooksByName(channelGoLiveEvent.getStream().getUserName().toLowerCase())) {
            // Create Webhook Message.
            WebhookMessageBuilder wmb = new WebhookMessageBuilder();
            wmb.setAvatarUrl(BotInfo.botInstance.getSelfUser().getAvatarUrl());
            wmb.setUsername("Ree6");
            WebhookEmbedBuilder webhookEmbedBuilder = new WebhookEmbedBuilder();
            webhookEmbedBuilder.setTitle(new WebhookEmbed.EmbedTitle(channelGoLiveEvent.getStream().getUserName(), null));
            webhookEmbedBuilder.setAuthor(new WebhookEmbed.EmbedAuthor("Twitch Notifier", BotInfo.botInstance.getSelfUser().getAvatarUrl(), null));
            // Try getting the User.
            Optional<User> twitchUserRequest = getTwitchClient().getHelix().getUsers(null, null, Collections.singletonList(channelGoLiveEvent.getStream().getUserName())).execute().getUsers().stream().findFirst();
            if (getTwitchClient().getHelix().getUsers(null, null, Collections.singletonList(channelGoLiveEvent.getStream().getUserName())).execute().getUsers().stream().findFirst().isPresent()) {
                webhookEmbedBuilder.setImageUrl(twitchUserRequest.orElseThrow().getProfileImageUrl());
            } else {
                webhookEmbedBuilder.setImageUrl(channelGoLiveEvent.getStream().getThumbnailUrl());
            }
            // Set rest of the Information.
            webhookEmbedBuilder.setDescription(channelGoLiveEvent.getStream().getUserName() + " is now Live on Twitch! Come and join the Stream <https://twitch.tv/" + channelGoLiveEvent.getChannel().getName() + "> !");
            webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "**Title**", channelGoLiveEvent.getStream().getTitle()));
            webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "**Game**", channelGoLiveEvent.getStream().getGameName()));
            webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "**Viewer**", "" + channelGoLiveEvent.getStream().getViewerCount()));
            webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(Data.ADVERTISEMENT, BotInfo.botInstance.getSelfUser().getAvatarUrl()));
            webhookEmbedBuilder.setColor(Color.MAGENTA.getRGB());
            wmb.addEmbeds(webhookEmbedBuilder.build());
            Webhook.sendWebhook(null, wmb.build(), Long.parseLong(credits[0]), credits[1], false);
        }
    });
}
Also used : WebhookEmbed(club.minnced.discord.webhook.send.WebhookEmbed) User(com.github.twitch4j.helix.domain.User) WebhookMessageBuilder(club.minnced.discord.webhook.send.WebhookMessageBuilder) WebhookEmbedBuilder(club.minnced.discord.webhook.send.WebhookEmbedBuilder)

Example 29 with WebhookEmbedBuilder

use of club.minnced.discord.webhook.send.WebhookEmbedBuilder in project Ree6 by Ree6-Applications.

the class Notifier method registerTwitterUser.

/**
 * Used to Register a Tweet Event for the given Twitter User
 *
 * @param twitterUser the Name of the Twitter User.
 * @return true, if everything worked out.
 */
public boolean registerTwitterUser(String twitterUser) {
    if (getTwitterClient() == null)
        return false;
    twitterUser = twitterUser.toLowerCase();
    twitter4j.User user;
    try {
        user = getTwitterClient().showUser(twitterUser);
        if (user.isProtected())
            return false;
    } catch (Exception ignore) {
        return false;
    }
    FilterQuery filterQuery = new FilterQuery();
    filterQuery.follow(user.getId());
    twitter4j.User finalUser = user;
    TwitterStream twitterStream = new TwitterStreamFactory(getTwitterClient().getConfiguration()).getInstance().addListener(new StatusListener() {

        /**
         * Override the onStatus method to inform about a new status.
         * @param status the new Status.
         */
        @Override
        public void onStatus(Status status) {
            WebhookMessageBuilder webhookMessageBuilder = new WebhookMessageBuilder();
            webhookMessageBuilder.setUsername("Ree6");
            webhookMessageBuilder.setAvatarUrl(BotInfo.botInstance.getSelfUser().getAvatarUrl());
            WebhookEmbedBuilder webhookEmbedBuilder = new WebhookEmbedBuilder();
            webhookEmbedBuilder.setTitle(new WebhookEmbed.EmbedTitle(status.getUser().getName() + " (@" + status.getUser().getScreenName() + ")", null));
            webhookEmbedBuilder.setAuthor(new WebhookEmbed.EmbedAuthor("Twitter Notifier", BotInfo.botInstance.getSelfUser().getAvatarUrl(), null));
            webhookEmbedBuilder.setThumbnailUrl(status.getUser().getBiggerProfileImageURLHttps());
            webhookEmbedBuilder.setDescription(status.getQuotedStatus() != null && !status.isRetweet() ? "**Quoted  " + status.getQuotedStatus().getUser().getScreenName() + "**: " + status.getText() + "\n" : status.getInReplyToScreenName() != null ? "**Reply to " + status.getInReplyToScreenName() + "**: " + status.getText() + "\n" : status.isRetweet() ? "**Retweeted from " + status.getRetweetedStatus().getUser().getScreenName() + "**: " + status.getText().split(": ")[1] + "\n" : "**" + status.getText() + "**\n");
            if (status.getMediaEntities().length > 0 && status.getMediaEntities()[0].getType().equalsIgnoreCase("photo")) {
                webhookEmbedBuilder.setImageUrl(status.getMediaEntities()[0].getMediaURLHttps());
            }
            webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(Data.ADVERTISEMENT, BotInfo.botInstance.getSelfUser().getAvatarUrl()));
            webhookEmbedBuilder.setTimestamp(Instant.now());
            webhookEmbedBuilder.setColor(Color.CYAN.getRGB());
            webhookMessageBuilder.addEmbeds(webhookEmbedBuilder.build());
            Main.getInstance().getSqlConnector().getSqlWorker().getTwitterWebhooksByName(finalUser.getScreenName()).forEach(strings -> Webhook.sendWebhook(null, webhookMessageBuilder.build(), Long.parseLong(strings[0]), strings[1], false));
        }

        /**
         * No need for this, so just ignore it.
         * @param statusDeletionNotice Data Object.
         */
        @Override
        public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice) {
        // Unused
        }

        /**
         * No need for this, so just ignore it.
         * @param numberOfLimitedStatuses Data Object.
         */
        @Override
        public void onTrackLimitationNotice(int numberOfLimitedStatuses) {
        // Unused
        }

        /**
         * No need for this, so just ignore it.
         * @param userId Data Object.
         * @param upToStatusId Data Object.
         */
        @Override
        public void onScrubGeo(long userId, long upToStatusId) {
        // Unused
        }

        /**
         * No need for this, so just ignore it.
         * @param warning Data Object.
         */
        @Override
        public void onStallWarning(StallWarning warning) {
        // Unused
        }

        /**
         * Inform about an exception.
         * @param ex the Exception
         */
        @Override
        public void onException(Exception ex) {
            Main.getInstance().getLogger().error("[Notifier] Encountered an error, while trying to get the Status update!", ex);
        }
    }).filter(filterQuery);
    if (!isTwitterRegistered(twitterUser))
        registeredTwitterUsers.put(twitterUser, twitterStream);
    return true;
}
Also used : WebhookMessageBuilder(club.minnced.discord.webhook.send.WebhookMessageBuilder) twitter4j(twitter4j) WebhookEmbed(club.minnced.discord.webhook.send.WebhookEmbed) WebhookEmbedBuilder(club.minnced.discord.webhook.send.WebhookEmbedBuilder)

Example 30 with WebhookEmbedBuilder

use of club.minnced.discord.webhook.send.WebhookEmbedBuilder in project Sx4 by sx4-discord-bot.

the class LoggerHandler method onGuildMemberRoleRemove.

public void onGuildMemberRoleRemove(GuildMemberRoleRemoveEvent event) {
    Guild guild = event.getGuild();
    Member member = event.getMember();
    User user = event.getUser();
    List<Role> roles = event.getRoles();
    Role firstRole = roles.get(0);
    // Ensure role delete event has been sent just in case
    this.delay(() -> {
        StringBuilder description = new StringBuilder();
        boolean multiple = roles.size() > 1;
        LoggerEvent loggerEvent = LoggerEvent.MEMBER_ROLE_REMOVE;
        LoggerContext loggerContext = new LoggerContext().setRole(multiple ? 0L : firstRole.getIdLong()).setUser(user);
        WebhookEmbedBuilder embed = new WebhookEmbedBuilder();
        embed.setColor(this.bot.getConfig().getRed());
        embed.setTimestamp(Instant.now());
        embed.setAuthor(new EmbedAuthor(user.getAsTag(), user.getEffectiveAvatarUrl(), null));
        boolean deleted;
        if (multiple) {
            StringBuilder builder = new StringBuilder();
            /* Make sure there is always enough space to write all the components to it */
            int maxLength = MessageEmbed.DESCRIPTION_MAX_LENGTH - 32 - /* Max nickname length */
            32 - /* Result String overhead */
            16 - /* " and x more" overhead */
            3;
            for (int i = 0; i < roles.size(); i++) {
                Role role = roles.get(i);
                String entry = (i == roles.size() - 1 ? " and " : i != 0 ? ", " : "") + role.getAsMention();
                if (builder.length() + entry.length() < maxLength) {
                    builder.append(entry);
                } else {
                    builder.append(String.format(" and **%s** more", roles.size() - i));
                    break;
                }
            }
            description.append(String.format("The roles %s have been removed from `%s`", builder, member.getEffectiveName()));
            deleted = false;
        } else {
            deleted = guild.getRoleById(firstRole.getIdLong()) == null;
            description.append(String.format("The role %s has been removed from `%s`", deleted ? "`" + firstRole.getName() + "`" : firstRole.getAsMention(), member.getEffectiveName()));
            embed.setFooter(new EmbedFooter(String.format("Role ID: %s", firstRole.getId()), null));
            if (deleted) {
                description.append(" by **role deletion**");
            }
        }
        this.bot.getMongo().aggregateLoggers(this.getPipeline(guild.getIdLong())).whenComplete((documents, exception) -> {
            if (ExceptionUtility.sendErrorMessage(exception)) {
                return;
            }
            if (documents.isEmpty()) {
                return;
            }
            Document data = documents.get(0);
            List<Document> loggers = LoggerUtility.getValidLoggers(data.getList("loggers", Document.class), loggerEvent, loggerContext);
            if (loggers.isEmpty()) {
                return;
            }
            if (!deleted && !firstRole.isManaged() && guild.getSelfMember().hasPermission(Permission.VIEW_AUDIT_LOGS)) {
                this.retrieveAuditLogs(guild, ActionType.MEMBER_ROLE_UPDATE).whenComplete((logs, auditException) -> {
                    User moderator = logs == null ? null : logs.stream().filter(e -> Duration.between(e.getTimeCreated(), ZonedDateTime.now(ZoneOffset.UTC)).toSeconds() <= 5).filter(e -> e.getTargetIdLong() == member.getUser().getIdLong()).filter(e -> {
                        AuditLogChange change = e.getChangeByKey(AuditLogKey.MEMBER_ROLES_REMOVE);
                        if (change == null) {
                            return false;
                        }
                        List<Map<String, String>> roleEntries = change.getNewValue();
                        List<String> roleIds = roleEntries.stream().map(roleEntry -> roleEntry.get("id")).collect(Collectors.toList());
                        for (Role role : roles) {
                            if (!roleIds.contains(role.getId())) {
                                return false;
                            }
                        }
                        return true;
                    }).map(AuditLogEntry::getUser).findFirst().orElse(null);
                    if (moderator != null) {
                        loggerContext.setModerator(moderator);
                        description.append(String.format(" by **%s**", moderator.getAsTag()));
                    }
                    embed.setDescription(description.toString());
                    this.queue(guild, loggers, loggerEvent, loggerContext, embed.build());
                });
            } else {
                embed.setDescription(description.toString());
                this.queue(guild, loggers, loggerEvent, loggerContext, embed.build());
            }
        });
    });
}
Also used : MessageBulkDeleteEvent(net.dv8tion.jda.api.events.message.MessageBulkDeleteEvent) Document(org.bson.Document) PermissionOverrideCreateEvent(net.dv8tion.jda.api.events.guild.override.PermissionOverrideCreateEvent) RoleCreateEvent(net.dv8tion.jda.api.events.role.RoleCreateEvent) StoreChannelDeleteEvent(net.dv8tion.jda.api.events.channel.store.StoreChannelDeleteEvent) Permission(net.dv8tion.jda.api.Permission) ZonedDateTime(java.time.ZonedDateTime) Aggregates(com.mongodb.client.model.Aggregates) EmoteUpdateRolesEvent(net.dv8tion.jda.api.events.emote.update.EmoteUpdateRolesEvent) AuditLogChange(net.dv8tion.jda.api.audit.AuditLogChange) CategoryCreateEvent(net.dv8tion.jda.api.events.channel.category.CategoryCreateEvent) LoggerManager(com.sx4.bot.managers.LoggerManager) ColourUtility(com.sx4.bot.utility.ColourUtility) TextChannelDeleteEvent(net.dv8tion.jda.api.events.channel.text.TextChannelDeleteEvent) EmoteAddedEvent(net.dv8tion.jda.api.events.emote.EmoteAddedEvent) TextChannelUpdateNameEvent(net.dv8tion.jda.api.events.channel.text.update.TextChannelUpdateNameEvent) TextChannelCreateEvent(net.dv8tion.jda.api.events.channel.text.TextChannelCreateEvent) Duration(java.time.Duration) GenericEvent(net.dv8tion.jda.api.events.GenericEvent) ZoneOffset(java.time.ZoneOffset) LoggerContext(com.sx4.bot.entities.management.LoggerContext) LoggerEvent(com.sx4.bot.entities.management.LoggerEvent) AuditLogKey(net.dv8tion.jda.api.audit.AuditLogKey) PermissionOverrideDeleteEvent(net.dv8tion.jda.api.events.guild.override.PermissionOverrideDeleteEvent) EmbedFooter(club.minnced.discord.webhook.send.WebhookEmbed.EmbedFooter) GuildMessageUpdateEvent(net.dv8tion.jda.api.events.message.guild.GuildMessageUpdateEvent) java.util.concurrent(java.util.concurrent) EmoteUpdateNameEvent(net.dv8tion.jda.api.events.emote.update.EmoteUpdateNameEvent) CategoryDeleteEvent(net.dv8tion.jda.api.events.channel.category.CategoryDeleteEvent) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) GuildBanEvent(net.dv8tion.jda.api.events.guild.GuildBanEvent) GuildMemberRemoveEvent(net.dv8tion.jda.api.events.guild.member.GuildMemberRemoveEvent) EventListener(net.dv8tion.jda.api.hooks.EventListener) CategoryUpdateNameEvent(net.dv8tion.jda.api.events.channel.category.update.CategoryUpdateNameEvent) GuildMemberUpdateNicknameEvent(net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdateNicknameEvent) NotNull(org.jetbrains.annotations.NotNull) RoleUpdateColorEvent(net.dv8tion.jda.api.events.role.update.RoleUpdateColorEvent) ActionType(net.dv8tion.jda.api.audit.ActionType) net.dv8tion.jda.api.entities(net.dv8tion.jda.api.entities) VoiceChannelUpdateNameEvent(net.dv8tion.jda.api.events.channel.voice.update.VoiceChannelUpdateNameEvent) java.util(java.util) JDA(net.dv8tion.jda.api.JDA) EmbedAuthor(club.minnced.discord.webhook.send.WebhookEmbed.EmbedAuthor) GuildMemberRoleRemoveEvent(net.dv8tion.jda.api.events.guild.member.GuildMemberRoleRemoveEvent) RoleUpdatePermissionsEvent(net.dv8tion.jda.api.events.role.update.RoleUpdatePermissionsEvent) VoiceChannelDeleteEvent(net.dv8tion.jda.api.events.channel.voice.VoiceChannelDeleteEvent) Projections(com.mongodb.client.model.Projections) MongoDatabase(com.sx4.bot.database.mongo.MongoDatabase) TLongIntHashMap(gnu.trove.map.hash.TLongIntHashMap) EmbedField(club.minnced.discord.webhook.send.WebhookEmbed.EmbedField) AuditLogEntry(net.dv8tion.jda.api.audit.AuditLogEntry) Filters(com.mongodb.client.model.Filters) GuildMessageDeleteEvent(net.dv8tion.jda.api.events.message.guild.GuildMessageDeleteEvent) Bson(org.bson.conversions.Bson) Pair(net.dv8tion.jda.internal.utils.tuple.Pair) WebhookEmbedBuilder(club.minnced.discord.webhook.send.WebhookEmbedBuilder) Sx4(com.sx4.bot.core.Sx4) GuildMemberRoleAddEvent(net.dv8tion.jda.api.events.guild.member.GuildMemberRoleAddEvent) WebhookEmbed(club.minnced.discord.webhook.send.WebhookEmbed) EmoteRemovedEvent(net.dv8tion.jda.api.events.emote.EmoteRemovedEvent) Operators(com.sx4.bot.database.mongo.model.Operators) Accumulators(com.mongodb.client.model.Accumulators) TLongIntMap(gnu.trove.map.TLongIntMap) VoiceChannelCreateEvent(net.dv8tion.jda.api.events.channel.voice.VoiceChannelCreateEvent) LoggerUtility(com.sx4.bot.utility.LoggerUtility) RoleUpdateNameEvent(net.dv8tion.jda.api.events.role.update.RoleUpdateNameEvent) StoreChannelUpdateNameEvent(net.dv8tion.jda.api.events.channel.store.update.StoreChannelUpdateNameEvent) TLongObjectHashMap(gnu.trove.map.hash.TLongObjectHashMap) OkHttpClient(okhttp3.OkHttpClient) PermissionOverrideUpdateEvent(net.dv8tion.jda.api.events.guild.override.PermissionOverrideUpdateEvent) net.dv8tion.jda.api.events.guild.voice(net.dv8tion.jda.api.events.guild.voice) StoreChannelCreateEvent(net.dv8tion.jda.api.events.channel.store.StoreChannelCreateEvent) GuildMessage(com.sx4.bot.entities.cache.GuildMessage) GuildUnbanEvent(net.dv8tion.jda.api.events.guild.GuildUnbanEvent) TLongObjectMap(gnu.trove.map.TLongObjectMap) RoleDeleteEvent(net.dv8tion.jda.api.events.role.RoleDeleteEvent) ExceptionUtility(com.sx4.bot.utility.ExceptionUtility) StringUtility(com.sx4.bot.utility.StringUtility) GuildMemberJoinEvent(net.dv8tion.jda.api.events.guild.member.GuildMemberJoinEvent) AuditLogChange(net.dv8tion.jda.api.audit.AuditLogChange) LoggerEvent(com.sx4.bot.entities.management.LoggerEvent) Document(org.bson.Document) LoggerContext(com.sx4.bot.entities.management.LoggerContext) EmbedFooter(club.minnced.discord.webhook.send.WebhookEmbed.EmbedFooter) EmbedAuthor(club.minnced.discord.webhook.send.WebhookEmbed.EmbedAuthor) WebhookEmbedBuilder(club.minnced.discord.webhook.send.WebhookEmbedBuilder) TLongIntHashMap(gnu.trove.map.hash.TLongIntHashMap) TLongIntMap(gnu.trove.map.TLongIntMap) TLongObjectHashMap(gnu.trove.map.hash.TLongObjectHashMap) TLongObjectMap(gnu.trove.map.TLongObjectMap)

Aggregations

WebhookEmbedBuilder (club.minnced.discord.webhook.send.WebhookEmbedBuilder)48 WebhookEmbed (club.minnced.discord.webhook.send.WebhookEmbed)42 EmbedFooter (club.minnced.discord.webhook.send.WebhookEmbed.EmbedFooter)34 EmbedAuthor (club.minnced.discord.webhook.send.WebhookEmbed.EmbedAuthor)33 Document (org.bson.Document)32 EmbedField (club.minnced.discord.webhook.send.WebhookEmbed.EmbedField)30 LoggerContext (com.sx4.bot.entities.management.LoggerContext)30 LoggerEvent (com.sx4.bot.entities.management.LoggerEvent)29 Sx4 (com.sx4.bot.core.Sx4)28 GuildMessage (com.sx4.bot.entities.cache.GuildMessage)28 Instant (java.time.Instant)28 Permission (net.dv8tion.jda.api.Permission)28 GenericEvent (net.dv8tion.jda.api.events.GenericEvent)28 MongoDatabase (com.sx4.bot.database.mongo.MongoDatabase)27 Operators (com.sx4.bot.database.mongo.model.Operators)27 ExceptionUtility (com.sx4.bot.utility.ExceptionUtility)27 StringUtility (com.sx4.bot.utility.StringUtility)27 Duration (java.time.Duration)27 ZoneOffset (java.time.ZoneOffset)27 ZonedDateTime (java.time.ZonedDateTime)27