fix channel rename log

This commit is contained in:
Lee
2024-07-04 07:01:46 +01:00
parent 407ee6f1e9
commit dc04a2f36a
2 changed files with 29 additions and 24 deletions

View File

@ -96,11 +96,14 @@ public class ChannelListener implements EventListener {
ChannelUnion channel = event.getChannel();
String type = formatChannelType(channel);
log.info("{} \"{}\" name was updated to {} in guild \"{}\"", type, event.getNewValue(), event.getOldValue(), guild.getName());
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("%s Name Updated".formatted(type));
if (channel.getType() == ChannelType.TEXT || channel.getType() == ChannelType.VOICE) {
description.appendLine("Channel: %s".formatted(event.getChannel().getAsMention()), true);
}
description.appendLine("Old Name: `%s`".formatted(event.getOldValue()), true);
description.appendLine("New Name: `%s`".formatted(event.getNewValue()), true);
logFeature.sendLog(guild, LogType.CHANNEL_UPDATE_NAME, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("%s Name Updated".formatted(type))
.appendLine("%s: %s".formatted(type, event.getChannel().getAsMention()), true)
.appendLine("Old Name: `%s`".formatted(event.getOldValue()), true)
.appendLine("New Name: `%s`".formatted(event.getNewValue()), true)
.setDescription(description
.build())
.build());
}