From dc04a2f36a54924dac198ad689f0d156b9546ac0 Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 4 Jul 2024 07:01:46 +0100 Subject: [PATCH] fix channel rename log --- .../logging/listeners/ChannelListener.java | 11 +++-- src/main/resources/application.yml | 42 ++++++++++--------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/main/java/cc/fascinated/bat/features/logging/listeners/ChannelListener.java b/src/main/java/cc/fascinated/bat/features/logging/listeners/ChannelListener.java index 479f84a..5aa93ce 100644 --- a/src/main/java/cc/fascinated/bat/features/logging/listeners/ChannelListener.java +++ b/src/main/java/cc/fascinated/bat/features/logging/listeners/ChannelListener.java @@ -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()); } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 20ea83a..dd2e33e 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,3 +1,19 @@ +# Spring Configuration +spring: + data: + # MongoDB Configuration + mongodb: + uri: "mongodb://bat:p4$$w0rd@localhost:27017" + database: "bat" + auto-index-creation: true # Automatically create collection indexes + + # Redis - This is used for caching + redis: + host: "localhost" + port: 6379 + database: 0 + auth: "" # Leave blank for no auth + # Discord Configuration discord: token: "oh my goodnesssssssssss" @@ -17,12 +33,6 @@ sentry: tracesSampleRate: 1.0 environment: "development" -# MongoDB Migration Configuration -mongock: - runner-type: InitializingBean - migration-scan-package: - - "cc.fascinated.bat.changelog" - # Spotify Configuration spotify: redirect-uri: "http://localhost:8080/spotify/callback" @@ -34,18 +44,10 @@ tmdb: # API Read Access Token api-key: "api-read-access-token" -# Spring Configuration -spring: - data: - # MongoDB Configuration - mongodb: - uri: "mongodb://bat:p4$$w0rd@localhost:27017" - database: "bat" - auto-index-creation: true # Automatically create collection indexes +# DO NOT TOUCH BELOW (unless you know what you're doing, ofc!) - # Redis - This is used for caching - redis: - host: "localhost" - port: 6379 - database: 0 - auth: "" # Leave blank for no auth \ No newline at end of file +# MongoDB Migration Configuration +mongock: + runner-type: InitializingBean + migration-scan-package: + - "cc.fascinated.bat.changelog" \ No newline at end of file