use of club.minnced.discord.webhook.send.WebhookEmbed in project MantaroBot by Mantaro.
the class LogUtils method spambot.
public static void spambot(User user, String guildId, String channelId, String messageId, SpamType type) {
if (SPAMBOT_WEBHOOK == null) {
log.warn("---- Spambot detected! ID: {}, Reason: {}", user.getId(), type);
return;
}
try {
List<WebhookEmbed.EmbedField> fields = new ArrayList<>();
fields.add(new WebhookEmbed.EmbedField(false, "Tag", String.format("%#s", user)));
fields.add(new WebhookEmbed.EmbedField(true, "ID", user.getId()));
fields.add(new WebhookEmbed.EmbedField(true, "Guild ID", guildId));
fields.add(new WebhookEmbed.EmbedField(true, "Channel ID", channelId));
fields.add(new WebhookEmbed.EmbedField(true, "Message ID", messageId));
fields.add(new WebhookEmbed.EmbedField(true, "Account Creation", user.getTimeCreated().toString()));
fields.add(new WebhookEmbed.EmbedField(true, "Mutual Guilds", user.getMutualGuilds().stream().map(g -> g.getId() + ": " + g.getMemberCount() + " members").collect(Collectors.joining("\n"))));
fields.add(new WebhookEmbed.EmbedField(false, "Type", type.toString()));
if (type == SpamType.BLATANT) {
var mantaroData = MantaroData.db().getMantaroData();
mantaroData.getBlackListedUsers().add(user.getId());
mantaroData.save();
fields.add(new WebhookEmbed.EmbedField(false, "Info", "User has been blacklisted automatically. " + "For more information use the investigate command."));
}
SPAMBOT_WEBHOOK.send(new WebhookEmbed(null, Color.PINK.getRGB(), null, user.getEffectiveAvatarUrl(), null, new WebhookEmbed.EmbedFooter(Utils.formatDate(OffsetDateTime.now()), ICON_URL), new WebhookEmbed.EmbedTitle("Possible spambot detected", null), null, fields));
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations