update channel log messages

This commit is contained in:
Lee 2024-07-02 19:43:27 +01:00
parent a3ffaf1ab9
commit 38bde93d16

View File

@ -31,10 +31,9 @@ public class ChannelListener implements EventListener {
@Override
public void onChannelCreate(@NonNull BatGuild guild, @NonNull ChannelCreateEvent event) {
logFeature.sendLog(guild, LogType.CHANNEL_CREATE, EmbedUtils.successEmbed()
.setDescription(new EmbedDescriptionBuilder("Channel Created")
.setDescription(new EmbedDescriptionBuilder("%s Channel Created".formatted(EnumUtils.getEnumName(event.getChannel().getType())))
.appendLine("Channel: %s".formatted(event.getChannel().getAsMention()), true)
.appendLine("Name: %s".formatted(event.getChannel().getName()), true)
.appendLine("Type: %s".formatted(EnumUtils.getEnumName(event.getChannel().getType())), true)
.build())
.build());
}
@ -42,14 +41,13 @@ public class ChannelListener implements EventListener {
@Override
public void onChannelDelete(@NonNull BatGuild guild, @NonNull ChannelDeleteEvent event) {
ChannelUnion channel = event.getChannel();
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("Channel Deleted")
EmbedDescriptionBuilder description = new EmbedDescriptionBuilder("%s Channel Deleted".formatted(EnumUtils.getEnumName(channel.getType())))
.appendLine("Channel: %s".formatted(channel.getAsMention()), true)
.appendLine("Name: %s".formatted(channel.getName()), true);
if (channel.getType().isMessage()) {
TextChannel textChannel = channel.asTextChannel();
description.appendLine("Topic: %s".formatted(textChannel.getTopic()), true);
}
description.appendLine("Type: %s".formatted(EnumUtils.getEnumName(channel.getType())), true);
logFeature.sendLog(guild, LogType.CHANNEL_DELETE, EmbedUtils.errorEmbed().setDescription(description.build()).build());
}
}