finish moderation
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 2m2s

This commit is contained in:
Lee
2024-07-09 19:46:48 +01:00
parent bc57834366
commit a3f4e2b918
50 changed files with 1312 additions and 137 deletions

View File

@ -14,7 +14,8 @@ public enum LogCategory {
MESSAGE(Emoji.fromUnicode("📩")),
MEMBER(Emoji.fromUnicode("👤")),
CHANNEL(Emoji.fromUnicode("📺")),
GUILD(Emoji.fromUnicode("🏰"));
GUILD(Emoji.fromUnicode("🏰")),
MODERATION(Emoji.fromUnicode("🛡️"));
/**
* The emoji of the log category

View File

@ -18,9 +18,12 @@ import org.springframework.stereotype.Component;
*/
@Component
public class LogFeature extends Feature {
public static LogFeature INSTANCE;
@Autowired
public LogFeature(@NonNull ApplicationContext context, @NonNull CommandService commandService) {
super("Logging", FeatureProfile.FeatureState.DISABLED, true);
INSTANCE = this;
super.registerCommand(commandService, context.getBean(LogsCommand.class));
}

View File

@ -60,7 +60,14 @@ public enum LogType {
STICKER_REMOVE(LogCategory.GUILD),
STICKER_NAME_UPDATED(LogCategory.GUILD),
BOOST_TIER_UPDATED(LogCategory.GUILD),
GUILD_CONFIGURATION(LogCategory.GUILD);
GUILD_CONFIGURATION(LogCategory.GUILD),
/**
* Moderation Events
*/
PUNISHMENT_ISSUED(LogCategory.MODERATION),
PUNISHMENT_REMOVED_OR_EXPIRED(LogCategory.MODERATION),
PURGE(LogCategory.MODERATION);
/**
* The category of the log type

View File

@ -3,7 +3,7 @@ package cc.fascinated.bat.features.logging.command;
import cc.fascinated.bat.Emojis;
import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.CommandInfo;
import cc.fascinated.bat.common.EmbedDescriptionBuilder;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.event.EventListener;
import cc.fascinated.bat.features.logging.LogCategory;
@ -78,7 +78,7 @@ public class ListSubCommand extends BatCommand implements EventListener {
}
List<LogType> logEvents = LogType.getLogTypesByCategory(category.getName());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder(null);
DescriptionBuilder description = new DescriptionBuilder(null);
description.appendLine("Log channels for the `%s` category".formatted(category.getName()), false);
description.emptyLine();
for (LogType logType : logEvents) {
@ -97,7 +97,7 @@ public class ListSubCommand extends BatCommand implements EventListener {
* @return the help message
*/
public MessageEmbed getHelpMessage() {
return EmbedUtils.genericEmbed().setDescription(new EmbedDescriptionBuilder(null).appendLine(
return EmbedUtils.genericEmbed().setDescription(new DescriptionBuilder(null).appendLine(
"""
Set the log channel for:
- A specific event, use `/logs set <event> <channel>`

View File

@ -3,7 +3,7 @@ package cc.fascinated.bat.features.logging.command;
import cc.fascinated.bat.Emojis;
import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.CommandInfo;
import cc.fascinated.bat.common.EmbedDescriptionBuilder;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.features.logging.LogCategory;
import cc.fascinated.bat.features.logging.LogProfile;
@ -44,7 +44,7 @@ public class RemoveSubCommand extends BatCommand {
for (LogType logType : LogType.values()) {
profile.removeLogChannel(logType);
}
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder(null);
DescriptionBuilder description = new DescriptionBuilder(null);
description.appendLine("%s Successfully removed the log channel from `%s` log events".formatted(
Emojis.CHECK_MARK_EMOJI,
LogType.values().length
@ -62,7 +62,7 @@ public class RemoveSubCommand extends BatCommand {
for (LogType logType : category) {
profile.removeLogChannel(logType);
}
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder(null);
DescriptionBuilder description = new DescriptionBuilder(null);
description.appendLine("%s Successfully removed the log channel from `%s` `%s` log events".formatted(
Emojis.CHECK_MARK_EMOJI,
category.size(),
@ -85,7 +85,7 @@ public class RemoveSubCommand extends BatCommand {
return;
}
profile.removeLogChannel(logType);
event.replyEmbeds(EmbedUtils.successEmbed().setDescription(new EmbedDescriptionBuilder(null)
event.replyEmbeds(EmbedUtils.successEmbed().setDescription(new DescriptionBuilder(null)
.appendLine("%s Successfully removed the log channel from `%s`".formatted(
Emojis.CHECK_MARK_EMOJI,
logType.getName()

View File

@ -3,7 +3,7 @@ package cc.fascinated.bat.features.logging.command;
import cc.fascinated.bat.Emojis;
import cc.fascinated.bat.command.BatCommand;
import cc.fascinated.bat.command.CommandInfo;
import cc.fascinated.bat.common.EmbedDescriptionBuilder;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.features.logging.LogCategory;
import cc.fascinated.bat.features.logging.LogProfile;
@ -51,7 +51,7 @@ public class SetSubCommand extends BatCommand {
for (LogType logType : LogType.values()) {
profile.setLogChannel(logType, targetChannel);
}
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder(null);
DescriptionBuilder description = new DescriptionBuilder(null);
description.appendLine("%s Successfully set the log channel for `%s` log events to %s".formatted(
Emojis.CHECK_MARK_EMOJI,
LogType.values().length,
@ -70,7 +70,7 @@ public class SetSubCommand extends BatCommand {
for (LogType logType : category) {
profile.setLogChannel(logType, targetChannel);
}
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder(null);
DescriptionBuilder description = new DescriptionBuilder(null);
description.appendLine("%s Successfully set the log channel for `%s` `%s` log events to %s".formatted(
Emojis.CHECK_MARK_EMOJI,
category.size(),
@ -94,7 +94,7 @@ public class SetSubCommand extends BatCommand {
return;
}
profile.setLogChannel(logType, targetChannel);
event.replyEmbeds(EmbedUtils.successEmbed().setDescription(new EmbedDescriptionBuilder(null)
event.replyEmbeds(EmbedUtils.successEmbed().setDescription(new DescriptionBuilder(null)
.appendLine("%s Successfully set the log channel for `%s` to %s".formatted(
Emojis.CHECK_MARK_EMOJI,
logType.getName(),

View File

@ -84,7 +84,7 @@ public class ChannelListener implements EventListener {
String type = formatChannelType(channel);
log.info("{} \"{}\" was created in guild \"{}\"", type, event.getChannel().getName(), guild.getName());
logFeature.sendLog(guild, LogType.CHANNEL_CREATE, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("%s Created".formatted(type))
.setDescription(new DescriptionBuilder("%s Created".formatted(type))
.appendLine("%s: %s".formatted(type, event.getChannel().getAsMention()), true)
.appendLine("Name: `%s`".formatted(event.getChannel().getName()), true)
.build())
@ -96,7 +96,7 @@ public class ChannelListener implements EventListener {
ChannelUnion channel = event.getChannel();
String type = formatChannelType(channel);
log.info("{} \"{}\" was deleted in guild \"{}\"", type, event.getChannel().getName(), guild.getName());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("%s Deleted".formatted(type))
DescriptionBuilder description = new DescriptionBuilder("%s Deleted".formatted(type))
.appendLine("Name: `#%s`".formatted(channel.getName()), true);
if (channel instanceof TextChannel) {
TextChannel textChannel = channel.asTextChannel();
@ -125,7 +125,7 @@ public class ChannelListener implements EventListener {
// User switched channels
if (oldChannel != null && !oldChannel.equals(voiceChannel)) {
log.info("User \"{}\" switched from voice channel \"{}\" to \"{}\" in guild \"{}\"", user.getName(), oldChannel.getName(), voiceChannel.getName(), guild.getName());
String switchDescription = new EmbedDescriptionBuilder("Member Switched Voice Channel")
String switchDescription = new DescriptionBuilder("Member Switched Voice Channel")
.appendLine("User: %s".formatted(user.getDiscordUser().getAsMention()), true)
.appendLine("Channel: %s -> %s".formatted(oldChannel.getAsMention(), voiceChannel.getAsMention()), true)
.build();
@ -134,7 +134,7 @@ public class ChannelListener implements EventListener {
}
log.info("User \"{}\" {} voice channel \"{}\" in guild \"{}\"", user.getName(), joined ? "joined" : "left", voiceChannel.getName(), guild.getName());
String description = new EmbedDescriptionBuilder("Member %s Voice Channel".formatted(joined ? "Joined" : "Left"))
String description = new DescriptionBuilder("Member %s Voice Channel".formatted(joined ? "Joined" : "Left"))
.appendLine("User: %s".formatted(user.getDiscordUser().getAsMention()), true)
.appendLine("Channel: %s".formatted(voiceChannel.getAsMention()), true)
.build();
@ -161,7 +161,7 @@ public class ChannelListener implements EventListener {
String target = event.getPermissionOverride().isRoleOverride() ? event.getPermissionOverride().getRole().getAsMention()
: event.getPermissionOverride().getMember().getAsMention();
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Channel permissions updated")
DescriptionBuilder description = new DescriptionBuilder("Channel permissions updated")
.appendLine("Channel: %s".formatted(event.getChannel().getAsMention()), true)
.appendLine("%s: %s".formatted(
event.getPermissionOverride().isRoleOverride() ? "Role" : "Member",
@ -189,7 +189,7 @@ public class ChannelListener implements EventListener {
String type = formatChannelType(channel);
log.info("{} \"{}\" topic was updated to {} in guild \"{}\"", type, newValue, oldValue, guild.getName());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("%s Topic Updated".formatted(type));
DescriptionBuilder description = new DescriptionBuilder("%s Topic Updated".formatted(type));
description.appendLine("Channel: %s".formatted(event.getChannel().getAsMention()), true);
description.appendLine("Topic: `%s` -> `%s`".formatted(
oldValue == null ? "No Topic" : oldValue,
@ -208,7 +208,7 @@ public class ChannelListener implements EventListener {
VoiceChannel channel = event.getChannel().asVoiceChannel();
log.info("Voice channel \"{}\" bitrate was updated to {} in guild \"{}\"", channel.getName(), event.getNewValue(), guild.getName());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Voice Channel Updated")
DescriptionBuilder description = new DescriptionBuilder("Voice Channel Updated")
.appendLine("Channel: %s".formatted(channel.getAsMention()), true)
.appendLine("Bitrate: `%s` -> `%s`".formatted(NumberFormatter.format(event.getOldValue()),
NumberFormatter.format(event.getNewValue())), true);
@ -225,7 +225,7 @@ public class ChannelListener implements EventListener {
String type = formatChannelType(channel);
log.info("{} \"{}\" name was updated to {} in guild \"{}\"", type, newValue, oldValue, guild.getName());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("%s Name Updated".formatted(type));
DescriptionBuilder description = new DescriptionBuilder("%s Name Updated".formatted(type));
if (channel.getType() == ChannelType.TEXT || channel.getType() == ChannelType.VOICE) {
description.appendLine("Channel: %s".formatted(event.getChannel().getAsMention()), true);
}
@ -239,7 +239,7 @@ public class ChannelListener implements EventListener {
@Override
public void onChannelUpdateNSFW(@NonNull BatGuild guild, @NonNull ChannelUpdateNSFWEvent event) {
logFeature.sendLog(guild, LogType.CHANNEL_CONFIGURATION, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Channel NSFW Updated")
.setDescription(new DescriptionBuilder("Channel NSFW Updated")
.appendLine("Channel: %s".formatted(event.getChannel().getAsMention()), true)
.appendLine("NSFW: `%s` -> `%s`".formatted(
Boolean.TRUE.equals(event.getOldValue()) ? "Yes" : "No",
@ -257,7 +257,7 @@ public class ChannelListener implements EventListener {
VoiceChannel channel = event.getChannel().asVoiceChannel();
log.info("Voice channel \"{}\" user limit was updated to {} in guild \"{}\"", channel.getName(), event.getNewValue(), guild.getName());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Voice Channel User Limit Updated")
DescriptionBuilder description = new DescriptionBuilder("Voice Channel User Limit Updated")
.appendLine("Channel: %s".formatted(channel.getAsMention()), true)
.appendLine("User Limit: `%s` -> `%s`".formatted(
event.getOldValue() == 0 ? "Unlimited" : NumberFormatter.format(event.getOldValue()),
@ -277,7 +277,7 @@ public class ChannelListener implements EventListener {
String newRegion = event.getNewValue() == Region.UNKNOWN ? "Automatic" : event.getNewValue().getName();
log.info("Channel \"{}\" region was updated to \"{}\" in guild \"{}\"", event.getChannel().getName(), newRegion, guild.getName());
logFeature.sendLog(guild, LogType.CHANNEL_CONFIGURATION, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Channel Region Updated")
.setDescription(new DescriptionBuilder("Channel Region Updated")
.appendLine("Channel: %s".formatted(event.getChannel().getAsMention()), true)
.appendLine("Region: `%s` -> `%s`".formatted(
event.getOldValue() == Region.UNKNOWN ? "Automatic" : event.getOldValue().getName(),
@ -297,7 +297,7 @@ public class ChannelListener implements EventListener {
log.info("Text channel \"{}\" slowmode was updated to {} in guild \"{}\"", event.getChannel().getName(), newSlowmode, guild.getName());
logFeature.sendLog(guild, LogType.CHANNEL_CONFIGURATION, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Channel Slowmode Updated")
.setDescription(new DescriptionBuilder("Channel Slowmode Updated")
.appendLine("Channel: %s".formatted(event.getChannel().getAsMention()), true)
.appendLine("Slowmode: `%s` -> `%s`".formatted(oldSlowmode, newSlowmode), true)
.build())
@ -308,7 +308,7 @@ public class ChannelListener implements EventListener {
public void onChannelUpdateArchived(@NonNull BatGuild guild, @NonNull Channel channel, boolean isArchived, @NonNull ChannelUpdateArchivedEvent event) {
log.info("Thread \"{}\" was {} in guild \"{}\"", channel.getName(), isArchived ? "archived" : "unarchived", guild.getName());
logFeature.sendLog(guild, LogType.THREAD_ARCHIVE, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Thread %s".formatted(isArchived ? "Archived" : "Unarchived"))
.setDescription(new DescriptionBuilder("Thread %s".formatted(isArchived ? "Archived" : "Unarchived"))
.appendLine("Channel: %s".formatted(channel.getAsMention()), true)
.build())
.build());

View File

@ -1,6 +1,6 @@
package cc.fascinated.bat.features.logging.listeners;
import cc.fascinated.bat.common.EmbedDescriptionBuilder;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.event.EventListener;
import cc.fascinated.bat.features.logging.LogFeature;
@ -32,7 +32,7 @@ public class EmojiListener implements EventListener {
public void onEmojiAdd(@NonNull BatGuild guild, @NonNull Emoji emoji, @NonNull EmojiAddedEvent event) {
log.info("Emoji \"{}\" was added in guild \"{}\"", emoji.getName(), guild.getName());
logFeature.sendLog(guild, LogType.EMOJI_ADD, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Emoji Added")
.setDescription(new DescriptionBuilder("Emoji Added")
.appendLine("Emoji: %s".formatted(emoji.getFormatted()), true)
.appendLine("Name: `%s`".formatted(emoji.getName()), true)
.build())
@ -43,7 +43,7 @@ public class EmojiListener implements EventListener {
public void onEmojiRemove(@NonNull BatGuild guild, @NonNull Emoji emoji, @NonNull EmojiRemovedEvent event) {
log.info("Emoji \"{}\" was removed in guild \"{}\"", emoji.getName(), guild.getName());
logFeature.sendLog(guild, LogType.EMOJI_REMOVE, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Emoji Removed")
.setDescription(new DescriptionBuilder("Emoji Removed")
.appendLine("Emoji: %s".formatted(emoji.getFormatted()), true)
.appendLine("Name: `%s`".formatted(emoji.getName()), true)
.build())
@ -54,7 +54,7 @@ public class EmojiListener implements EventListener {
public void onEmojiRename(@NonNull BatGuild guild, @NonNull Emoji emoji, @NonNull String oldName, @NonNull String newName, @NonNull EmojiUpdateNameEvent event) {
log.info("Emoji \"{}\" was renamed to \"{}\" in guild \"{}\"", oldName, newName, guild.getName());
logFeature.sendLog(guild, LogType.EMOJI_NAME_UPDATED, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Emoji Renamed")
.setDescription(new DescriptionBuilder("Emoji Renamed")
.appendLine("Emoji: %s".formatted(emoji.getFormatted()), true)
.appendLine("Name: `%s` -> `%s`".formatted(oldName, newName), true)
.build())

View File

@ -1,6 +1,6 @@
package cc.fascinated.bat.features.logging.listeners;
import cc.fascinated.bat.common.EmbedDescriptionBuilder;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.EnumUtils;
import cc.fascinated.bat.common.TimeUtils;
@ -41,7 +41,7 @@ public class GuildListener implements EventListener {
log.info("Invite created in guild \"{}\" with code \"{}\"", guild.getGuild().getName(), invite.getCode());
invite.expand().queue(expandedInvite -> {
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Invite Created");
DescriptionBuilder description = new DescriptionBuilder("Invite Created");
description.appendLine("Invite: %s".formatted(expandedInvite.getUrl()), true);
if (expandedInvite.getChannel() != null) {
description.appendLine("Channel: %s".formatted(
@ -60,7 +60,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateName(@NonNull BatGuild guild, String oldName, String newName, @NonNull GuildUpdateNameEvent event) {
log.info("Guild name was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldName, newName);
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Guild Name Updated")
DescriptionBuilder description = new DescriptionBuilder("Guild Name Updated")
.appendLine("Name: `%s` -> `%s`".formatted(oldName, newName), true);
logFeature.sendLog(guild, LogType.GUILD_CONFIGURATION, EmbedUtils.successEmbed().setDescription(description.build()).build());
}
@ -69,7 +69,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateAfkChannel(@NonNull BatGuild guild, VoiceChannel oldChannel, VoiceChannel newChannel, @NonNull GuildUpdateAfkChannelEvent event) {
log.info("Guild AFK channel was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldChannel == null ? "None" : oldChannel.getName(), newChannel == null ? "None" : newChannel.getName());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Guild AFK Channel Updated")
DescriptionBuilder description = new DescriptionBuilder("Guild AFK Channel Updated")
.appendLine("Channel: `%s` -> `%s`".formatted(
oldChannel == null ? "None" : oldChannel.getName(),
newChannel == null ? "None" : newChannel.getName()
@ -82,7 +82,7 @@ public class GuildListener implements EventListener {
log.info("Guild AFK timeout was updated in guild \"{}\" from \"{}\" to \"{}\"",
guild.getGuild().getName(), oldTimeout.getSeconds(), newTimeout.getSeconds());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Guild AFK Timeout Updated")
DescriptionBuilder description = new DescriptionBuilder("Guild AFK Timeout Updated")
.appendLine("Timeout: `%s` -> `%s`".formatted(
TimeUtils.format(oldTimeout.getSeconds() * 1000L),
TimeUtils.format(newTimeout.getSeconds() * 1000L)
@ -94,7 +94,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateBanner(@NonNull BatGuild guild, String oldBannerUrl, String newBannerUrl, @NonNull GuildUpdateBannerEvent event) {
log.info("Guild banner was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldBannerUrl, newBannerUrl);
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Guild Banner Updated")
DescriptionBuilder description = new DescriptionBuilder("Guild Banner Updated")
.appendLine("Banner: [click here](%s)".formatted(newBannerUrl), true);
logFeature.sendLog(guild, LogType.GUILD_CONFIGURATION, EmbedUtils.successEmbed().setDescription(description.build()).build());
}
@ -103,7 +103,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateDescription(@NonNull BatGuild guild, String oldDescription, String newDescription, @NonNull GuildUpdateDescriptionEvent event) {
log.info("Guild description was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldDescription, newDescription);
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Guild Description Updated")
DescriptionBuilder description = new DescriptionBuilder("Guild Description Updated")
.appendLine("Description: `%s` -> `%s`".formatted(oldDescription, newDescription), true);
logFeature.sendLog(guild, LogType.GUILD_CONFIGURATION, EmbedUtils.successEmbed().setDescription(description.build()).build());
}
@ -112,7 +112,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateIcon(@NonNull BatGuild guild, String oldIconUrl, String newIconUrl, @NonNull GuildUpdateIconEvent event) {
log.info("Guild icon was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldIconUrl, newIconUrl);
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Guild Icon Updated")
DescriptionBuilder description = new DescriptionBuilder("Guild Icon Updated")
.appendLine("Icon: [click here](%s)".formatted(newIconUrl), true);
logFeature.sendLog(guild, LogType.GUILD_CONFIGURATION, EmbedUtils.successEmbed().setDescription(description.build()).build());
}
@ -121,7 +121,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateLocale(@NonNull BatGuild guild, DiscordLocale oldLocale, DiscordLocale newLocale, @NonNull GuildUpdateLocaleEvent event) {
log.info("Guild primary language was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldLocale, newLocale);
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Guild Primary Language Updated")
DescriptionBuilder description = new DescriptionBuilder("Guild Primary Language Updated")
.appendLine("Language: `%s` -> `%s`".formatted(
oldLocale.getLanguageName(),
newLocale.getLanguageName()
@ -133,7 +133,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateCommunityUpdatesChannel(@NonNull BatGuild guild, TextChannel oldChannel, TextChannel newChannel, @NonNull GuildUpdateCommunityUpdatesChannelEvent event) {
log.info("Guild community updates channel was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldChannel == null ? "None" : oldChannel.getName(), newChannel == null ? "None" : newChannel.getName());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Community Updates Channel Updated")
DescriptionBuilder description = new DescriptionBuilder("Community Updates Channel Updated")
.appendLine("Channel: `%s` -> `%s`".formatted(
oldChannel == null ? "None" : oldChannel.getName(),
newChannel == null ? "None" : newChannel.getName()
@ -146,7 +146,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateBoostTier(@NonNull BatGuild guild, Guild.BoostTier oldTier, Guild.BoostTier newTier, @NonNull GuildUpdateBoostTierEvent event) {
log.info("Guild boost tier was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldTier.getKey(), newTier.getKey());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Guild Boost Tier Updated")
DescriptionBuilder description = new DescriptionBuilder("Guild Boost Tier Updated")
.appendLine("Tier: `%s` -> `%s`".formatted(oldTier.getKey(), newTier.getKey()), true);
logFeature.sendLog(guild, LogType.BOOST_TIER_UPDATED, EmbedUtils.successEmbed().setDescription(description.build()).build());
}
@ -155,7 +155,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateMaxMembers(@NonNull BatGuild guild, int oldCount, int newCount, @NonNull GuildUpdateMaxMembersEvent event) {
log.info("Guild max members was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldCount, newCount);
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Guild Max Members Updated")
DescriptionBuilder description = new DescriptionBuilder("Guild Max Members Updated")
.appendLine("Members: `%s` -> `%s`".formatted(oldCount, newCount), true);
logFeature.sendLog(guild, LogType.GUILD_CONFIGURATION, EmbedUtils.successEmbed().setDescription(description.build()).build());
}
@ -164,7 +164,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateExplicitContentLevel(@NonNull BatGuild guild, Guild.ExplicitContentLevel oldLevel, Guild.ExplicitContentLevel newLevel, @NonNull GuildUpdateExplicitContentLevelEvent event) {
log.info("Guild explicit content level was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldLevel.getKey(), newLevel.getKey());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Guild Explicit Content Level Updated")
DescriptionBuilder description = new DescriptionBuilder("Guild Explicit Content Level Updated")
.appendLine("Level: `%s` -> `%s`".formatted(
EnumUtils.getEnumName(oldLevel),
EnumUtils.getEnumName(newLevel)
@ -176,7 +176,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateMFALevel(@NonNull BatGuild guild, Guild.MFALevel oldLevel, Guild.MFALevel newLevel, @NonNull GuildUpdateMFALevelEvent event) {
log.info("Guild MFA level was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldLevel.getKey(), newLevel.getKey());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Guild MFA Level Updated")
DescriptionBuilder description = new DescriptionBuilder("Guild MFA Level Updated")
.appendLine("Level: `%s` -> `%s`".formatted(
EnumUtils.getEnumName(oldLevel),
EnumUtils.getEnumName(newLevel)
@ -188,7 +188,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateNotificationLevel(@NonNull BatGuild guild, Guild.NotificationLevel oldLevel, Guild.NotificationLevel newLevel, @NonNull GuildUpdateNotificationLevelEvent event) {
log.info("Guild notification level was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldLevel.getKey(), newLevel.getKey());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Guild Notification Level Updated")
DescriptionBuilder description = new DescriptionBuilder("Guild Notification Level Updated")
.appendLine("Level: `%s` -> `%s`".formatted(
EnumUtils.getEnumName(oldLevel),
EnumUtils.getEnumName(newLevel)
@ -200,7 +200,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateNSFWLevel(@NonNull BatGuild guild, Guild.NSFWLevel oldLevel, Guild.NSFWLevel newLevel, @NonNull GuildUpdateNSFWLevelEvent event) {
log.info("Guild NSFW level was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldLevel.getKey(), newLevel.getKey());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Guild NSFW Level Updated")
DescriptionBuilder description = new DescriptionBuilder("Guild NSFW Level Updated")
.appendLine("Level: `%s` -> `%s`".formatted(
EnumUtils.getEnumName(oldLevel),
EnumUtils.getEnumName(newLevel)
@ -212,7 +212,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateOwner(@NonNull BatGuild guild, @NonNull BatUser oldOwner, @NonNull BatUser newOwner, @NonNull GuildUpdateOwnerEvent event) {
log.info("Guild owner was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldOwner.getUser().getAsTag(), newOwner.getUser().getAsTag());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Guild Owner Updated")
DescriptionBuilder description = new DescriptionBuilder("Guild Owner Updated")
.appendLine("Owner: %s -> %s".formatted(oldOwner.getUser().getAsMention(), newOwner.getUser().getAsMention()), true);
logFeature.sendLog(guild, LogType.GUILD_CONFIGURATION, EmbedUtils.successEmbed().setDescription(description.build()).build());
}
@ -221,7 +221,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateRulesChannel(@NonNull BatGuild guild, TextChannel oldChannel, TextChannel newChannel, @NonNull GuildUpdateRulesChannelEvent event) {
log.info("Guild rules channel was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldChannel == null ? "None" : oldChannel.getName(), newChannel == null ? "None" : newChannel.getName());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Rules Channel Updated")
DescriptionBuilder description = new DescriptionBuilder("Rules Channel Updated")
.appendLine("Channel: %s -> %s".formatted(
oldChannel == null ? "`None`" : oldChannel.getAsMention(),
newChannel == null ? "`None`" : newChannel.getAsMention()
@ -233,7 +233,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateSystemChannel(@NonNull BatGuild guild, TextChannel oldChannel, TextChannel newChannel, @NonNull GuildUpdateSystemChannelEvent event) {
log.info("Guild system channel was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldChannel == null ? "None" : oldChannel.getName(), newChannel == null ? "None" : newChannel.getName());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("System Channel Updated")
DescriptionBuilder description = new DescriptionBuilder("System Channel Updated")
.appendLine("Channel: %s -> %s".formatted(
oldChannel == null ? "`None`" : oldChannel.getAsMention(),
newChannel == null ? "`None`" : newChannel.getAsMention()
@ -245,7 +245,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateVanityCode(@NonNull BatGuild guild, String oldCode, String newCode, @NonNull GuildUpdateVanityCodeEvent event) {
log.info("Guild vanity code was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldCode, newCode);
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Vanity Code Updated")
DescriptionBuilder description = new DescriptionBuilder("Vanity Code Updated")
.appendLine("Code: `%s` -> `%s`".formatted(
oldCode == null ? "None" : oldCode,
newCode == null ? "None" : newCode
@ -257,7 +257,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateVerificationLevel(@NonNull BatGuild guild, Guild.VerificationLevel oldLevel, Guild.VerificationLevel newLevel, @NonNull GuildUpdateVerificationLevelEvent event) {
log.info("Guild verification level was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldLevel.getKey(), newLevel.getKey());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Verification Level Updated")
DescriptionBuilder description = new DescriptionBuilder("Verification Level Updated")
.appendLine("Level: `%s` -> `%s`".formatted(
EnumUtils.getEnumName(oldLevel),
EnumUtils.getEnumName(newLevel)
@ -269,7 +269,7 @@ public class GuildListener implements EventListener {
public void onGuildUpdateSplash(@NonNull BatGuild guild, String oldSplashUrl, String newSplashUrl, @NonNull GuildUpdateSplashEvent event) {
log.info("Guild splash was updated in guild \"{}\" from \"{}\" to \"{}\"", guild.getGuild().getName(), oldSplashUrl, newSplashUrl);
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Guild Splash Updated")
DescriptionBuilder description = new DescriptionBuilder("Guild Splash Updated")
.appendLine("Splash: [click here](%s)".formatted(newSplashUrl), true);
logFeature.sendLog(guild, LogType.GUILD_CONFIGURATION, EmbedUtils.successEmbed().setDescription(description.build()).build());
}

View File

@ -1,6 +1,6 @@
package cc.fascinated.bat.features.logging.listeners;
import cc.fascinated.bat.common.EmbedDescriptionBuilder;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.event.EventListener;
import cc.fascinated.bat.features.logging.LogFeature;
@ -53,7 +53,7 @@ public class MemberListener implements EventListener {
log.info("User \"{}\" joined the guild \"{}\"", user.getName(), guild.getDiscordGuild().getName());
logFeature.sendLog(guild, LogType.MEMBER_JOIN, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Joined")
.setDescription(new DescriptionBuilder("Member Joined")
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.appendLine("Username: `%s`".formatted(user.getDiscordUser().getName()), true)
.appendLine("Joined Discord: <t:%s:R>".formatted(user.getDiscordUser().getTimeCreated().toEpochSecond()), true)
@ -68,7 +68,7 @@ public class MemberListener implements EventListener {
log.info("User \"{}\" left the guild \"{}\"", user.getName(), guild.getDiscordGuild().getName());
logFeature.sendLog(guild, LogType.MEMBER_LEAVE, EmbedUtils.errorEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Left")
.setDescription(new DescriptionBuilder("Member Left")
.appendLine("Member: <@%s>".formatted(user.getId()), true)
.appendLine("Username: `%s`".formatted(user.getName()), true)
.build())
@ -86,7 +86,7 @@ public class MemberListener implements EventListener {
user.getName(), oldNameFormatted, newNameFormatted, guild.getDiscordGuild().getName());
logFeature.sendLog(guild, LogType.MEMBER_NICKNAME_UPDATE, EmbedUtils.genericEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Nickname Updated")
.setDescription(new DescriptionBuilder("Member Nickname Updated")
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.appendLine("Nickname: `%s` -> `%s`".formatted(
oldNameFormatted,
@ -111,7 +111,7 @@ public class MemberListener implements EventListener {
if (!guild.isMember(user.getDiscordUser())) continue; // User is not in the guild
logFeature.sendLog(batGuild, LogType.MEMBER_GLOBAL_NAME_UPDATE, EmbedUtils.genericEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Name Updated")
.setDescription(new DescriptionBuilder("Member Name Updated")
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.appendLine("Name: `%s` -> `%s`".formatted(
oldNameFormatted,
@ -135,7 +135,7 @@ public class MemberListener implements EventListener {
if (!guild.isMember(user.getDiscordUser())) continue; // User is not in the guild
logFeature.sendLog(batGuild, LogType.MEMBER_USERNAME_UPDATE, EmbedUtils.genericEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Username Updated")
.setDescription(new DescriptionBuilder("Member Username Updated")
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.appendLine("Username: `%s` -> `%s`".formatted(oldName, newName), true)
.build())
@ -157,7 +157,7 @@ public class MemberListener implements EventListener {
if (!guild.isMember(user.getDiscordUser())) continue; // User is not in the guild
logFeature.sendLog(batGuild, LogType.MEMBER_USERNAME_UPDATE, EmbedUtils.genericEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Avatar Updated")
.setDescription(new DescriptionBuilder("Member Avatar Updated")
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.appendLine("Avatar: %s".formatted(newAvatarUrl == null ? "Removed" : "[click here](%s)".formatted(newAvatarUrl)), true)
.build())
@ -180,7 +180,7 @@ public class MemberListener implements EventListener {
String s = rolesAdded.size() > 1 ? "s" : "";
logFeature.sendLog(guild, LogType.MEMBER_ROLE_UPDATE, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Role%s Added".formatted(s))
.setDescription(new DescriptionBuilder("Member Role%s Added".formatted(s))
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.appendLine("Role%s Added: %s".formatted(s, roles.substring(0, roles.length() - 2)), true)
.build())
@ -201,7 +201,7 @@ public class MemberListener implements EventListener {
String s = rolesAdded.size() > 1 ? "s" : "";
logFeature.sendLog(guild, LogType.MEMBER_ROLE_UPDATE, EmbedUtils.errorEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Role%s Removed".formatted(s))
.setDescription(new DescriptionBuilder("Member Role%s Removed".formatted(s))
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.appendLine("Role%s Removed: %s".formatted(s, roles.substring(0, roles.length() - 2)), true)
.build())
@ -216,7 +216,7 @@ public class MemberListener implements EventListener {
log.info("User \"{}\" was banned from the guild \"{}\"", user.getName(), guild.getDiscordGuild().getName());
logFeature.sendLog(guild, LogType.MEMBER_BAN, EmbedUtils.errorEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Banned")
.setDescription(new DescriptionBuilder("Member Banned")
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.build())
.build());
@ -230,7 +230,7 @@ public class MemberListener implements EventListener {
log.info("User \"{}\" was unbanned from the guild \"{}\"", user.getName(), guild.getDiscordGuild().getName());
logFeature.sendLog(guild, LogType.MEMBER_UNBAN, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Unbanned")
.setDescription(new DescriptionBuilder("Member Unbanned")
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.build())
.build());
@ -244,7 +244,7 @@ public class MemberListener implements EventListener {
long seconds = timeoutEnd.toInstant().getEpochSecond();
logFeature.sendLog(guild, LogType.MEMBER_TIMEOUT, EmbedUtils.errorEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Timed Out")
.setDescription(new DescriptionBuilder("Member Timed Out")
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.appendLine("Timeout End: <t:%s>".formatted(seconds), true)
.appendLine("Relative End: <t:%s:R>".formatted(seconds), true)
@ -261,7 +261,7 @@ public class MemberListener implements EventListener {
log.info("User \"{}\" boosted the guild \"{}\" until \"{}\"", user.getName(), guild.getDiscordGuild().getName(), newBoostTime);
logFeature.sendLog(guild, LogType.MEMBER_BOOSTED, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Boosted")
.setDescription(new DescriptionBuilder("Member Boosted")
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.build())
.build());
@ -279,7 +279,7 @@ public class MemberListener implements EventListener {
log.info("User \"{}\" boost expired in the guild \"{}\"", user.getName(), guild.getDiscordGuild().getName());
logFeature.sendLog(guild, LogType.MEMBER_BOOST_EXPIRE, EmbedUtils.errorEmbed()
.setDescription(new EmbedDescriptionBuilder("Member Boost Expired")
.setDescription(new DescriptionBuilder("Member Boost Expired")
.appendLine("Member: %s".formatted(user.getDiscordUser().getAsMention()), true)
.build())
.build());

View File

@ -1,6 +1,6 @@
package cc.fascinated.bat.features.logging.listeners;
import cc.fascinated.bat.common.EmbedDescriptionBuilder;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.event.EventListener;
import cc.fascinated.bat.features.logging.LogFeature;
@ -35,7 +35,7 @@ public class MessageListener implements EventListener {
log.info("User \"{}\" deleted a message in guild \"{}\"", user.getDiscordUser().getGlobalName(), guild.getName());
logFeature.sendLog(guild, LogType.MESSAGE_DELETE, EmbedUtils.errorEmbed()
.setDescription(new EmbedDescriptionBuilder("Message Deleted")
.setDescription(new DescriptionBuilder("Message Deleted")
.appendLine("Author: %s".formatted(message.getAuthor().getAsMention()), true)
.appendLine("Channel: %s".formatted(message.getChannel().getAsMention()), true)
.appendLine("Content: %s".formatted(logFeature.formatContent(message.getContent())), true)
@ -50,7 +50,7 @@ public class MessageListener implements EventListener {
log.info("User \"{}\" edited a message in guild \"{}\"", user.getDiscordUser().getGlobalName(), guild.getName());
logFeature.sendLog(guild, LogType.MESSAGE_EDIT, EmbedUtils.genericEmbed()
.setDescription(new EmbedDescriptionBuilder("Message Edited")
.setDescription(new DescriptionBuilder("Message Edited")
.appendLine("Author: %s".formatted(newMessage.getAuthor().getAsMention()), true)
.appendLine("Channel: %s".formatted(newMessage.getChannel().getAsMention()), true)
.appendLine("Old Content: %s".formatted(logFeature.formatContent(oldMessage.getContent())), true)

View File

@ -1,6 +1,6 @@
package cc.fascinated.bat.features.logging.listeners;
import cc.fascinated.bat.common.EmbedDescriptionBuilder;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.common.RoleUtils;
import cc.fascinated.bat.event.EventListener;
@ -53,7 +53,7 @@ public class RoleListener implements EventListener {
}
}
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Role Permissions Updated")
DescriptionBuilder description = new DescriptionBuilder("Role Permissions Updated")
.appendLine("Role: %s".formatted(event.getRole().getAsMention()), true);
if (!allowedPermissions.isEmpty()) {
description.appendLine("Allowed Permissions: %s".formatted(allowedPermissions.substring(0, allowedPermissions.length() - 2)), true);
@ -72,7 +72,7 @@ public class RoleListener implements EventListener {
Role role = event.getRole();
log.info("Role \"{}\" was created in guild \"{}\"", role.getName(), guild.getName());
logFeature.sendLog(guild, LogType.ROLE_CREATE, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Role Created")
.setDescription(new DescriptionBuilder("Role Created")
.appendLine("Role: %s".formatted(role.getAsMention()), true)
.appendLine("Color: %s".formatted(RoleUtils.getFormattedColor(role)), true)
.appendLine("Permissions: %s".formatted(RoleUtils.getFormattedPermissions(role)), true)
@ -85,7 +85,7 @@ public class RoleListener implements EventListener {
Role role = event.getRole();
log.info("Role \"{}\" was deleted in guild \"{}\"", role.getName(), guild.getName());
logFeature.sendLog(guild, LogType.ROLE_DELETE, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Role Deleted")
.setDescription(new DescriptionBuilder("Role Deleted")
.appendLine("Role: `%s`".formatted(role.getName()), true)
.appendLine("Color: %s".formatted(RoleUtils.getFormattedColor(role)), true)
.appendLine("Permissions: %s".formatted(RoleUtils.getFormattedPermissions(role)), true)
@ -99,7 +99,7 @@ public class RoleListener implements EventListener {
String newName = event.getNewName();
log.info("Role \"{}\" was renamed to \"{}\" in guild \"{}\"", oldName, newName, guild.getName());
logFeature.sendLog(guild, LogType.ROLE_CONFIGURATION, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Role Renamed")
.setDescription(new DescriptionBuilder("Role Renamed")
.appendLine("Role: %s".formatted(event.getRole().getAsMention()), true)
.appendLine("Name: `%s` -> `%s`".formatted(oldName, newName), true)
.build())
@ -113,7 +113,7 @@ public class RoleListener implements EventListener {
log.info("Role \"{}\" color was updated in guild \"{}\"", event.getRole().getName(), guild.getName());
logFeature.sendLog(guild, LogType.ROLE_CONFIGURATION, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Role Color Updated")
.setDescription(new DescriptionBuilder("Role Color Updated")
.appendLine("Role: %s".formatted(event.getRole().getAsMention()), true)
.appendLine("Color: %s -> %s".formatted(
RoleUtils.getFormattedColor(oldColor),
@ -130,7 +130,7 @@ public class RoleListener implements EventListener {
log.info("Role \"{}\" icon was updated in guild \"{}\"", event.getRole().getName(), guild.getName());
logFeature.sendLog(guild, LogType.ROLE_CONFIGURATION, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Role Icon Updated")
.setDescription(new DescriptionBuilder("Role Icon Updated")
.appendLine("Role: %s".formatted(event.getRole().getAsMention()), true)
.appendLine("Icon: `%s` -> `%s`".formatted(
oldIcon == null ? "None" : oldIcon.getEmoji(),
@ -144,7 +144,7 @@ public class RoleListener implements EventListener {
public void onRoleUpdateHoisted(@NonNull BatGuild guild, @NonNull Role role, boolean wasHoisted, boolean isHoisted, @NonNull RoleUpdateHoistedEvent event) {
log.info("Role \"{}\" hoisted status was updated in guild \"{}\"", role.getName(), guild.getName());
logFeature.sendLog(guild, LogType.ROLE_CONFIGURATION, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Role Hoisted Status Updated")
.setDescription(new DescriptionBuilder("Role Hoisted Status Updated")
.appendLine("Role: %s".formatted(role.getAsMention()), true)
.appendLine("Hoisted: `%s` -> `%s`".formatted(
wasHoisted ? "Yes" : "No",

View File

@ -1,6 +1,6 @@
package cc.fascinated.bat.features.logging.listeners;
import cc.fascinated.bat.common.EmbedDescriptionBuilder;
import cc.fascinated.bat.common.DescriptionBuilder;
import cc.fascinated.bat.common.EmbedUtils;
import cc.fascinated.bat.event.EventListener;
import cc.fascinated.bat.features.logging.LogFeature;
@ -32,7 +32,7 @@ public class StickerListener implements EventListener {
public void onGuildStickerAdd(@NonNull BatGuild guild, @NonNull GuildSticker sticker, @NonNull GuildStickerAddedEvent event) {
log.info("Sticker \"{}\" was added in guild \"{}\"", sticker.getName(), guild.getName());
logFeature.sendLog(guild, LogType.STICKER_ADD, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Sticker Added")
.setDescription(new DescriptionBuilder("Sticker Added")
.appendLine("Sticker: %s".formatted(sticker.getName()), true)
.appendLine("URL: %s".formatted(sticker.getIconUrl()), true)
.build())
@ -43,7 +43,7 @@ public class StickerListener implements EventListener {
public void onGuildStickerRemove(@NonNull BatGuild guild, @NonNull GuildSticker sticker, @NonNull GuildStickerRemovedEvent event) {
log.info("Sticker \"{}\" was removed in guild \"{}\"", sticker.getName(), guild.getName());
logFeature.sendLog(guild, LogType.STICKER_REMOVE, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Sticker Removed")
.setDescription(new DescriptionBuilder("Sticker Removed")
.appendLine("Sticker: %s".formatted(sticker.getName()), true)
.appendLine("URL: %s".formatted(sticker.getIconUrl()), true)
.build())
@ -55,7 +55,7 @@ public class StickerListener implements EventListener {
@NonNull String newName, @NonNull GuildStickerUpdateNameEvent event) {
log.info("Sticker \"{}\" was renamed in guild \"{}\" from \"{}\" to \"{}\"", sticker.getName(), guild.getName(), oldName, newName);
logFeature.sendLog(guild, LogType.STICKER_NAME_UPDATED, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Sticker Renamed")
.setDescription(new DescriptionBuilder("Sticker Renamed")
.appendLine("Sticker: %s".formatted(sticker.getName()), true)
.appendLine("Name: `%s` -> `%s`".formatted(oldName, newName), true)
.build())