From 65e8bcef7db892efa027625e5e72225416cdd354 Mon Sep 17 00:00:00 2001 From: Egg-03 <111327101+eggy03@users.noreply.github.com> Date: Tue, 14 Jul 2026 09:55:40 +0530 Subject: [PATCH 1/7] refactor: move handler classes to `service.handlers` package Signed-off-by: Egg-03 <111327101+eggy03@users.noreply.github.com> --- .../bot/listeners/command/AuditLogSetupCommandListener.java | 2 +- .../listeners/command/BotSetupInstructionCommandListener.java | 2 +- .../papertrail/bot/listeners/command/DebugCommandListener.java | 2 +- .../bot/listeners/command/MessageLogSetupCommandListener.java | 2 +- .../bot/listeners/command/ServerStatCommandListener.java | 2 +- .../papertrail/bot/listeners/guild/GuildBoostEventListener.java | 2 +- .../bot/listeners/guild/GuildMemberEventListener.java | 2 +- .../papertrail/bot/listeners/guild/GuildPollEventListener.java | 2 +- .../bot/listeners/guild/GuildSecurityIncidentEventListener.java | 2 +- .../papertrail/bot/listeners/guild/GuildVoiceEventListener.java | 2 +- .../bot/listeners/message/GuildMessageEventListener.java | 2 +- .../handlers/auditlog/AutoModActionTypeHandler.java | 2 +- .../handlers/auditlog/ChannelActionTypeHandler.java | 2 +- .../handlers/auditlog/ChannelOverrideActionTypeHandler.java | 2 +- .../{ => service}/handlers/auditlog/EmojiActionTypeHandler.java | 2 +- .../handlers/auditlog/GuildUpdateActionTypeHandler.java | 2 +- .../handlers/auditlog/HomeSettingsActionTypeHandler.java | 2 +- .../handlers/auditlog/IntegrationActionTypeHandler.java | 2 +- .../handlers/auditlog/InviteActionTypeHandler.java | 2 +- .../handlers/auditlog/MemberUpdateActionTypeHandler.java | 2 +- .../handlers/auditlog/MessageActionTypeHandler.java | 2 +- .../handlers/auditlog/MessagePinActionTypeHandler.java | 2 +- .../handlers/auditlog/ModActionActionTypeHandler.java | 2 +- .../handlers/auditlog/OnboardingActionTypeHandler.java | 2 +- .../handlers/auditlog/OnboardingPromptActionTypeHandler.java | 2 +- .../{ => service}/handlers/auditlog/RoleActionTypeHandler.java | 2 +- .../handlers/auditlog/ScheduledEventActionTypeHandler.java | 2 +- .../handlers/auditlog/SoundboardActionTypeHandler.java | 2 +- .../handlers/auditlog/StageInstanceActionTypeHandler.java | 2 +- .../handlers/auditlog/StickerActionTypeHandler.java | 2 +- .../handlers/auditlog/ThreadActionTypeHandler.java | 2 +- .../handlers/auditlog/UnimplementedActionTypeHandler.java | 2 +- .../handlers/auditlog/UnknownActionTypeHandler.java | 2 +- .../handlers/auditlog/VoiceChannelStatusActionTypeHandler.java | 2 +- .../handlers/auditlog/WebhookActionTypeHandler.java | 2 +- .../handlers/command/AuditLogSetupCommandHandler.java | 2 +- .../handlers/command/BotSetupInstructionCommandHandler.java | 2 +- .../bot/{ => service}/handlers/command/DebugCommandHandler.java | 2 +- .../handlers/command/MessageLogSetupCommandHandler.java | 2 +- .../handlers/command/ServerStatCommandHandler.java | 2 +- .../{ => service}/handlers/guild/GuildBoostEventHandler.java | 2 +- .../{ => service}/handlers/guild/GuildMemberEventHandler.java | 2 +- .../bot/{ => service}/handlers/guild/GuildPollEventHandler.java | 2 +- .../handlers/guild/GuildSecurityIncidentEventHandler.java | 2 +- .../{ => service}/handlers/guild/GuildVoiceEventHandler.java | 2 +- .../handlers/message/GuildMessageEventHandler.java | 2 +- 46 files changed, 46 insertions(+), 46 deletions(-) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/AutoModActionTypeHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/ChannelActionTypeHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/ChannelOverrideActionTypeHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/EmojiActionTypeHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/GuildUpdateActionTypeHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/HomeSettingsActionTypeHandler.java (98%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/IntegrationActionTypeHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/InviteActionTypeHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/MemberUpdateActionTypeHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/MessageActionTypeHandler.java (98%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/MessagePinActionTypeHandler.java (98%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/ModActionActionTypeHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/OnboardingActionTypeHandler.java (98%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/OnboardingPromptActionTypeHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/RoleActionTypeHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/ScheduledEventActionTypeHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/SoundboardActionTypeHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/StageInstanceActionTypeHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/StickerActionTypeHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/ThreadActionTypeHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/UnimplementedActionTypeHandler.java (91%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/UnknownActionTypeHandler.java (98%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java (98%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/auditlog/WebhookActionTypeHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/command/AuditLogSetupCommandHandler.java (98%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/command/BotSetupInstructionCommandHandler.java (97%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/command/DebugCommandHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/command/MessageLogSetupCommandHandler.java (98%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/command/ServerStatCommandHandler.java (98%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/guild/GuildBoostEventHandler.java (98%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/guild/GuildMemberEventHandler.java (98%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/guild/GuildPollEventHandler.java (98%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/guild/GuildSecurityIncidentEventHandler.java (99%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/guild/GuildVoiceEventHandler.java (98%) rename src/main/java/io/github/eggy03/papertrail/bot/{ => service}/handlers/message/GuildMessageEventHandler.java (99%) diff --git a/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/AuditLogSetupCommandListener.java b/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/AuditLogSetupCommandListener.java index 92534d9..27f386b 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/AuditLogSetupCommandListener.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/AuditLogSetupCommandListener.java @@ -1,7 +1,7 @@ package io.github.eggy03.papertrail.bot.listeners.command; import io.github.eggy03.papertrail.bot.annotations.VirtualThreadFactory; -import io.github.eggy03.papertrail.bot.handlers.command.AuditLogSetupCommandHandler; +import io.github.eggy03.papertrail.bot.service.handlers.command.AuditLogSetupCommandHandler; import jakarta.inject.Inject; import jakarta.inject.Singleton; import lombok.NonNull; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/BotSetupInstructionCommandListener.java b/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/BotSetupInstructionCommandListener.java index 9666cbf..075c3a0 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/BotSetupInstructionCommandListener.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/BotSetupInstructionCommandListener.java @@ -1,7 +1,7 @@ package io.github.eggy03.papertrail.bot.listeners.command; import io.github.eggy03.papertrail.bot.annotations.VirtualThreadFactory; -import io.github.eggy03.papertrail.bot.handlers.command.BotSetupInstructionCommandHandler; +import io.github.eggy03.papertrail.bot.service.handlers.command.BotSetupInstructionCommandHandler; import jakarta.inject.Inject; import jakarta.inject.Singleton; import lombok.NonNull; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/DebugCommandListener.java b/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/DebugCommandListener.java index 81d44a9..52df670 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/DebugCommandListener.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/DebugCommandListener.java @@ -1,7 +1,7 @@ package io.github.eggy03.papertrail.bot.listeners.command; import io.github.eggy03.papertrail.bot.annotations.VirtualThreadFactory; -import io.github.eggy03.papertrail.bot.handlers.command.DebugCommandHandler; +import io.github.eggy03.papertrail.bot.service.handlers.command.DebugCommandHandler; import jakarta.inject.Inject; import jakarta.inject.Singleton; import lombok.NonNull; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/MessageLogSetupCommandListener.java b/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/MessageLogSetupCommandListener.java index de86ef4..945f443 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/MessageLogSetupCommandListener.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/MessageLogSetupCommandListener.java @@ -1,7 +1,7 @@ package io.github.eggy03.papertrail.bot.listeners.command; import io.github.eggy03.papertrail.bot.annotations.VirtualThreadFactory; -import io.github.eggy03.papertrail.bot.handlers.command.MessageLogSetupCommandHandler; +import io.github.eggy03.papertrail.bot.service.handlers.command.MessageLogSetupCommandHandler; import jakarta.inject.Inject; import jakarta.inject.Singleton; import lombok.NonNull; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/ServerStatCommandListener.java b/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/ServerStatCommandListener.java index e87eb76..bc3cafb 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/ServerStatCommandListener.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/listeners/command/ServerStatCommandListener.java @@ -1,7 +1,7 @@ package io.github.eggy03.papertrail.bot.listeners.command; import io.github.eggy03.papertrail.bot.annotations.VirtualThreadFactory; -import io.github.eggy03.papertrail.bot.handlers.command.ServerStatCommandHandler; +import io.github.eggy03.papertrail.bot.service.handlers.command.ServerStatCommandHandler; import jakarta.inject.Inject; import jakarta.inject.Singleton; import lombok.NonNull; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildBoostEventListener.java b/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildBoostEventListener.java index f0e9a77..553299f 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildBoostEventListener.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildBoostEventListener.java @@ -1,7 +1,7 @@ package io.github.eggy03.papertrail.bot.listeners.guild; import io.github.eggy03.papertrail.bot.annotations.VirtualThreadFactory; -import io.github.eggy03.papertrail.bot.handlers.guild.GuildBoostEventHandler; +import io.github.eggy03.papertrail.bot.service.handlers.guild.GuildBoostEventHandler; import jakarta.inject.Inject; import jakarta.inject.Singleton; import lombok.NonNull; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildMemberEventListener.java b/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildMemberEventListener.java index 8fdacb0..f52ea41 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildMemberEventListener.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildMemberEventListener.java @@ -1,7 +1,7 @@ package io.github.eggy03.papertrail.bot.listeners.guild; import io.github.eggy03.papertrail.bot.annotations.VirtualThreadFactory; -import io.github.eggy03.papertrail.bot.handlers.guild.GuildMemberEventHandler; +import io.github.eggy03.papertrail.bot.service.handlers.guild.GuildMemberEventHandler; import jakarta.inject.Inject; import jakarta.inject.Singleton; import lombok.NonNull; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildPollEventListener.java b/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildPollEventListener.java index 7b2c135..e3154c5 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildPollEventListener.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildPollEventListener.java @@ -1,7 +1,7 @@ package io.github.eggy03.papertrail.bot.listeners.guild; import io.github.eggy03.papertrail.bot.annotations.VirtualThreadFactory; -import io.github.eggy03.papertrail.bot.handlers.guild.GuildPollEventHandler; +import io.github.eggy03.papertrail.bot.service.handlers.guild.GuildPollEventHandler; import jakarta.inject.Inject; import jakarta.inject.Singleton; import lombok.NonNull; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildSecurityIncidentEventListener.java b/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildSecurityIncidentEventListener.java index 4c191c9..28a235b 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildSecurityIncidentEventListener.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildSecurityIncidentEventListener.java @@ -1,7 +1,7 @@ package io.github.eggy03.papertrail.bot.listeners.guild; import io.github.eggy03.papertrail.bot.annotations.VirtualThreadFactory; -import io.github.eggy03.papertrail.bot.handlers.guild.GuildSecurityIncidentEventHandler; +import io.github.eggy03.papertrail.bot.service.handlers.guild.GuildSecurityIncidentEventHandler; import jakarta.inject.Inject; import jakarta.inject.Singleton; import lombok.NonNull; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildVoiceEventListener.java b/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildVoiceEventListener.java index d9e838b..77a5d65 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildVoiceEventListener.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/listeners/guild/GuildVoiceEventListener.java @@ -1,7 +1,7 @@ package io.github.eggy03.papertrail.bot.listeners.guild; import io.github.eggy03.papertrail.bot.annotations.VirtualThreadFactory; -import io.github.eggy03.papertrail.bot.handlers.guild.GuildVoiceEventHandler; +import io.github.eggy03.papertrail.bot.service.handlers.guild.GuildVoiceEventHandler; import jakarta.inject.Inject; import jakarta.inject.Singleton; import lombok.NonNull; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/listeners/message/GuildMessageEventListener.java b/src/main/java/io/github/eggy03/papertrail/bot/listeners/message/GuildMessageEventListener.java index 0b8cc0c..6d674be 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/listeners/message/GuildMessageEventListener.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/listeners/message/GuildMessageEventListener.java @@ -1,7 +1,7 @@ package io.github.eggy03.papertrail.bot.listeners.message; import io.github.eggy03.papertrail.bot.annotations.VirtualThreadFactory; -import io.github.eggy03.papertrail.bot.handlers.message.GuildMessageEventHandler; +import io.github.eggy03.papertrail.bot.service.handlers.message.GuildMessageEventHandler; import jakarta.inject.Inject; import jakarta.inject.Singleton; import lombok.NonNull; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/AutoModActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/AutoModActionTypeHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/AutoModActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/AutoModActionTypeHandler.java index 63fe4d4..f761f04 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/AutoModActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/AutoModActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/ChannelActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelActionTypeHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/ChannelActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelActionTypeHandler.java index cd8eeb0..264fd47 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/ChannelActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/ChannelOverrideActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelOverrideActionTypeHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/ChannelOverrideActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelOverrideActionTypeHandler.java index 9066045..c02c07f 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/ChannelOverrideActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelOverrideActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.auditlog.ChannelUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/EmojiActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/EmojiActionTypeHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/EmojiActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/EmojiActionTypeHandler.java index 3c255e0..54107d2 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/EmojiActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/EmojiActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/GuildUpdateActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildUpdateActionTypeHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/GuildUpdateActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildUpdateActionTypeHandler.java index bbd3ac5..d37d613 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/GuildUpdateActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildUpdateActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/HomeSettingsActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/HomeSettingsActionTypeHandler.java similarity index 98% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/HomeSettingsActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/HomeSettingsActionTypeHandler.java index 1d41d1d..1acd5be 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/HomeSettingsActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/HomeSettingsActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/IntegrationActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/IntegrationActionTypeHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/IntegrationActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/IntegrationActionTypeHandler.java index 2d34f3c..5af76a3 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/IntegrationActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/IntegrationActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/InviteActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/InviteActionTypeHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/InviteActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/InviteActionTypeHandler.java index 710d5d3..4085fbb 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/InviteActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/InviteActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/MemberUpdateActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MemberUpdateActionTypeHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/MemberUpdateActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MemberUpdateActionTypeHandler.java index dbaa02a..09f07c9 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/MemberUpdateActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MemberUpdateActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/MessageActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessageActionTypeHandler.java similarity index 98% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/MessageActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessageActionTypeHandler.java index 4b0c117..cefd7c3 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/MessageActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessageActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/MessagePinActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessagePinActionTypeHandler.java similarity index 98% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/MessagePinActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessagePinActionTypeHandler.java index 7ebe493..6720e37 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/MessagePinActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessagePinActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.auditlog.MessageUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/ModActionActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ModActionActionTypeHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/ModActionActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ModActionActionTypeHandler.java index 8453d1a..2dfdd03 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/ModActionActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ModActionActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/OnboardingActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingActionTypeHandler.java similarity index 98% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/OnboardingActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingActionTypeHandler.java index 87e88e8..c8b9945 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/OnboardingActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/OnboardingPromptActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingPromptActionTypeHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/OnboardingPromptActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingPromptActionTypeHandler.java index 8188930..c468522 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/OnboardingPromptActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingPromptActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/RoleActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/RoleActionTypeHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/RoleActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/RoleActionTypeHandler.java index f99d852..0d27727 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/RoleActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/RoleActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/ScheduledEventActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ScheduledEventActionTypeHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/ScheduledEventActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ScheduledEventActionTypeHandler.java index cb0999e..953ed4e 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/ScheduledEventActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ScheduledEventActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.auditlog.ScheduledEventUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/SoundboardActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/SoundboardActionTypeHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/SoundboardActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/SoundboardActionTypeHandler.java index ebc969d..b75067b 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/SoundboardActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/SoundboardActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.auditlog.SoundboardUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/StageInstanceActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StageInstanceActionTypeHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/StageInstanceActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StageInstanceActionTypeHandler.java index d79c4d5..91bcf12 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/StageInstanceActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StageInstanceActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.auditlog.StageUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/StickerActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StickerActionTypeHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/StickerActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StickerActionTypeHandler.java index 32fdb34..74abfcb 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/StickerActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StickerActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.auditlog.StickerUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/ThreadActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ThreadActionTypeHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/ThreadActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ThreadActionTypeHandler.java index f9df43b..da8974f 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/ThreadActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ThreadActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/UnimplementedActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnimplementedActionTypeHandler.java similarity index 91% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/UnimplementedActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnimplementedActionTypeHandler.java index e931233..6568f8c 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/UnimplementedActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnimplementedActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import jakarta.enterprise.context.ApplicationScoped; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/UnknownActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnknownActionTypeHandler.java similarity index 98% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/UnknownActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnknownActionTypeHandler.java index f13d9c3..853d485 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/UnknownActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnknownActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java similarity index 98% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java index 3d2c866..1c7af4d 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/WebhookActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/WebhookActionTypeHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/WebhookActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/WebhookActionTypeHandler.java index fca00ed..95213a8 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/auditlog/WebhookActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/WebhookActionTypeHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.auditlog.GuildUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/command/AuditLogSetupCommandHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/command/AuditLogSetupCommandHandler.java similarity index 98% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/command/AuditLogSetupCommandHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/command/AuditLogSetupCommandHandler.java index a3ef703..f408073 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/command/AuditLogSetupCommandHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/command/AuditLogSetupCommandHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.command; +package io.github.eggy03.papertrail.bot.service.handlers.command; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/command/BotSetupInstructionCommandHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/command/BotSetupInstructionCommandHandler.java similarity index 97% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/command/BotSetupInstructionCommandHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/command/BotSetupInstructionCommandHandler.java index 95a5ec9..d603198 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/command/BotSetupInstructionCommandHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/command/BotSetupInstructionCommandHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.command; +package io.github.eggy03.papertrail.bot.service.handlers.command; import io.github.eggy03.papertrail.bot.about.ApplicationInfo; import jakarta.enterprise.context.ApplicationScoped; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/command/DebugCommandHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/command/DebugCommandHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/command/DebugCommandHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/command/DebugCommandHandler.java index 1e486e0..d9f6997 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/command/DebugCommandHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/command/DebugCommandHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.command; +package io.github.eggy03.papertrail.bot.service.handlers.command; import io.github.eggy03.papertrail.bot.about.ApplicationInfo; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/command/MessageLogSetupCommandHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/command/MessageLogSetupCommandHandler.java similarity index 98% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/command/MessageLogSetupCommandHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/command/MessageLogSetupCommandHandler.java index 9272125..95cb097 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/command/MessageLogSetupCommandHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/command/MessageLogSetupCommandHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.command; +package io.github.eggy03.papertrail.bot.service.handlers.command; import io.github.eggy03.papertrail.sdk.client.MessageLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.MessageLogRegistrationEntity; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/command/ServerStatCommandHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/command/ServerStatCommandHandler.java similarity index 98% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/command/ServerStatCommandHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/command/ServerStatCommandHandler.java index c31cf4a..f16c2f4 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/command/ServerStatCommandHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/command/ServerStatCommandHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.command; +package io.github.eggy03.papertrail.bot.service.handlers.command; import io.github.eggy03.papertrail.bot.utils.DurationUtils; import jakarta.enterprise.context.ApplicationScoped; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/guild/GuildBoostEventHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildBoostEventHandler.java similarity index 98% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/guild/GuildBoostEventHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildBoostEventHandler.java index 4452ff0..b45d704 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/guild/GuildBoostEventHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildBoostEventHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.guild; +package io.github.eggy03.papertrail.bot.service.handlers.guild; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/guild/GuildMemberEventHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildMemberEventHandler.java similarity index 98% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/guild/GuildMemberEventHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildMemberEventHandler.java index 1b704aa..3f1620c 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/guild/GuildMemberEventHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildMemberEventHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.guild; +package io.github.eggy03.papertrail.bot.service.handlers.guild; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.bot.utils.DurationUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/guild/GuildPollEventHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildPollEventHandler.java similarity index 98% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/guild/GuildPollEventHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildPollEventHandler.java index 35847c0..a3a8526 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/guild/GuildPollEventHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildPollEventHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.guild; +package io.github.eggy03.papertrail.bot.service.handlers.guild; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/guild/GuildSecurityIncidentEventHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildSecurityIncidentEventHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/guild/GuildSecurityIncidentEventHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildSecurityIncidentEventHandler.java index 2fd6ff2..d8d2747 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/guild/GuildSecurityIncidentEventHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildSecurityIncidentEventHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.guild; +package io.github.eggy03.papertrail.bot.service.handlers.guild; import io.github.eggy03.papertrail.bot.utils.DurationUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/guild/GuildVoiceEventHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildVoiceEventHandler.java similarity index 98% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/guild/GuildVoiceEventHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildVoiceEventHandler.java index 236ca07..84bd6a5 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/guild/GuildVoiceEventHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildVoiceEventHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.guild; +package io.github.eggy03.papertrail.bot.service.handlers.guild; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/handlers/message/GuildMessageEventHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/message/GuildMessageEventHandler.java similarity index 99% rename from src/main/java/io/github/eggy03/papertrail/bot/handlers/message/GuildMessageEventHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/message/GuildMessageEventHandler.java index b5710bd..61b25bc 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/handlers/message/GuildMessageEventHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/message/GuildMessageEventHandler.java @@ -1,4 +1,4 @@ -package io.github.eggy03.papertrail.bot.handlers.message; +package io.github.eggy03.papertrail.bot.service.handlers.message; import com.google.common.base.Splitter; import io.github.eggy03.papertrail.sdk.client.MessageLogContentClient; From 831713e410676fa1c81fae028e4c8601f4d3a67f Mon Sep 17 00:00:00 2001 From: Egg-03 <111327101+eggy03@users.noreply.github.com> Date: Tue, 14 Jul 2026 10:19:26 +0530 Subject: [PATCH 2/7] refactor: move audit log entry handler - Relocate `GuildAuditLogEntryCreateEventActionTypeHandler` from `listeners` to `service.handlers`. Signed-off-by: Egg-03 <111327101+eggy03@users.noreply.github.com> --- .../listeners/auditlog/GuildAuditLogEntryEventListener.java | 1 + .../service/handlers/auditlog/AutoModActionTypeHandler.java | 1 - .../service/handlers/auditlog/ChannelActionTypeHandler.java | 1 - .../handlers/auditlog/ChannelOverrideActionTypeHandler.java | 1 - .../bot/service/handlers/auditlog/EmojiActionTypeHandler.java | 1 - .../GuildAuditLogEntryCreateEventActionTypeHandler.java | 3 ++- .../handlers/auditlog/GuildUpdateActionTypeHandler.java | 1 - .../handlers/auditlog/HomeSettingsActionTypeHandler.java | 1 - .../handlers/auditlog/IntegrationActionTypeHandler.java | 1 - .../bot/service/handlers/auditlog/InviteActionTypeHandler.java | 1 - .../handlers/auditlog/MemberUpdateActionTypeHandler.java | 1 - .../service/handlers/auditlog/MessageActionTypeHandler.java | 1 - .../service/handlers/auditlog/MessagePinActionTypeHandler.java | 1 - .../service/handlers/auditlog/ModActionActionTypeHandler.java | 1 - .../service/handlers/auditlog/OnboardingActionTypeHandler.java | 1 - .../handlers/auditlog/OnboardingPromptActionTypeHandler.java | 1 - .../bot/service/handlers/auditlog/RoleActionTypeHandler.java | 1 - .../handlers/auditlog/ScheduledEventActionTypeHandler.java | 1 - .../service/handlers/auditlog/SoundboardActionTypeHandler.java | 1 - .../handlers/auditlog/StageInstanceActionTypeHandler.java | 1 - .../service/handlers/auditlog/StickerActionTypeHandler.java | 1 - .../bot/service/handlers/auditlog/ThreadActionTypeHandler.java | 1 - .../handlers/auditlog/UnimplementedActionTypeHandler.java | 1 - .../service/handlers/auditlog/UnknownActionTypeHandler.java | 1 - .../handlers/auditlog/VoiceChannelStatusActionTypeHandler.java | 1 - .../service/handlers/auditlog/WebhookActionTypeHandler.java | 1 - 26 files changed, 3 insertions(+), 25 deletions(-) rename src/main/java/io/github/eggy03/papertrail/bot/{listeners => service/handlers}/auditlog/GuildAuditLogEntryCreateEventActionTypeHandler.java (98%) diff --git a/src/main/java/io/github/eggy03/papertrail/bot/listeners/auditlog/GuildAuditLogEntryEventListener.java b/src/main/java/io/github/eggy03/papertrail/bot/listeners/auditlog/GuildAuditLogEntryEventListener.java index 242d895..a17c250 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/listeners/auditlog/GuildAuditLogEntryEventListener.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/listeners/auditlog/GuildAuditLogEntryEventListener.java @@ -1,6 +1,7 @@ package io.github.eggy03.papertrail.bot.listeners.auditlog; import io.github.eggy03.papertrail.bot.annotations.VirtualThreadFactory; +import io.github.eggy03.papertrail.bot.service.handlers.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import jakarta.enterprise.inject.Instance; import jakarta.inject.Inject; import jakarta.inject.Singleton; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/AutoModActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/AutoModActionTypeHandler.java index f761f04..dbb1db4 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/AutoModActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/AutoModActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.bot.utils.auditlog.AutoModUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelActionTypeHandler.java index 264fd47..8d206fc 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.bot.utils.DurationUtils; import io.github.eggy03.papertrail.bot.utils.auditlog.ChannelUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelOverrideActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelOverrideActionTypeHandler.java index c02c07f..ecb20d8 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelOverrideActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelOverrideActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.auditlog.ChannelUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/EmojiActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/EmojiActionTypeHandler.java index 54107d2..1a19da1 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/EmojiActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/EmojiActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; import jakarta.enterprise.context.ApplicationScoped; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/listeners/auditlog/GuildAuditLogEntryCreateEventActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildAuditLogEntryCreateEventActionTypeHandler.java similarity index 98% rename from src/main/java/io/github/eggy03/papertrail/bot/listeners/auditlog/GuildAuditLogEntryCreateEventActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildAuditLogEntryCreateEventActionTypeHandler.java index 8397a75..89e4127 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/listeners/auditlog/GuildAuditLogEntryCreateEventActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildAuditLogEntryCreateEventActionTypeHandler.java @@ -1,5 +1,6 @@ -package io.github.eggy03.papertrail.bot.listeners.auditlog; +package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryEventListener; import lombok.NonNull; import net.dv8tion.jda.api.audit.ActionType; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildUpdateActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildUpdateActionTypeHandler.java index d37d613..09d147d 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildUpdateActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildUpdateActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.bot.utils.DurationUtils; import io.github.eggy03.papertrail.bot.utils.auditlog.GuildUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/HomeSettingsActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/HomeSettingsActionTypeHandler.java index 1acd5be..831909c 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/HomeSettingsActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/HomeSettingsActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; import jakarta.enterprise.context.ApplicationScoped; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/IntegrationActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/IntegrationActionTypeHandler.java index 5af76a3..b7031de 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/IntegrationActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/IntegrationActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; import jakarta.enterprise.context.ApplicationScoped; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/InviteActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/InviteActionTypeHandler.java index 4085fbb..3b2976b 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/InviteActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/InviteActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.bot.utils.DurationUtils; import io.github.eggy03.papertrail.bot.utils.auditlog.InviteUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MemberUpdateActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MemberUpdateActionTypeHandler.java index 09f07c9..685ff8b 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MemberUpdateActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MemberUpdateActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.bot.utils.DurationUtils; import io.github.eggy03.papertrail.bot.utils.auditlog.MemberUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessageActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessageActionTypeHandler.java index cefd7c3..6caa586 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessageActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessageActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; import jakarta.enterprise.context.ApplicationScoped; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessagePinActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessagePinActionTypeHandler.java index 6720e37..a235a0a 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessagePinActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessagePinActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.auditlog.MessageUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ModActionActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ModActionActionTypeHandler.java index 2dfdd03..c34e968 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ModActionActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ModActionActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; import jakarta.enterprise.context.ApplicationScoped; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingActionTypeHandler.java index c8b9945..d95c001 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.bot.utils.auditlog.OnboardingUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingPromptActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingPromptActionTypeHandler.java index c468522..2723b6c 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingPromptActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingPromptActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/RoleActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/RoleActionTypeHandler.java index 0d27727..0f48b57 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/RoleActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/RoleActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.bot.utils.auditlog.RoleUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ScheduledEventActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ScheduledEventActionTypeHandler.java index 953ed4e..33c65e3 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ScheduledEventActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ScheduledEventActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.auditlog.ScheduledEventUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/SoundboardActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/SoundboardActionTypeHandler.java index b75067b..cb70559 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/SoundboardActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/SoundboardActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.auditlog.SoundboardUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StageInstanceActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StageInstanceActionTypeHandler.java index 91bcf12..aabd110 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StageInstanceActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StageInstanceActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.auditlog.StageUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StickerActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StickerActionTypeHandler.java index 74abfcb..e6c7c65 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StickerActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StickerActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.auditlog.StickerUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ThreadActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ThreadActionTypeHandler.java index da8974f..4a4dccf 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ThreadActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ThreadActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.bot.utils.DurationUtils; import io.github.eggy03.papertrail.bot.utils.auditlog.ChannelUtils; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnimplementedActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnimplementedActionTypeHandler.java index 6568f8c..1d45385 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnimplementedActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnimplementedActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import jakarta.enterprise.context.ApplicationScoped; import lombok.NonNull; import lombok.extern.slf4j.Slf4j; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnknownActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnknownActionTypeHandler.java index 853d485..84e1d16 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnknownActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnknownActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; import jakarta.enterprise.context.ApplicationScoped; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java index 1c7af4d..b4c0665 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; import jakarta.enterprise.context.ApplicationScoped; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/WebhookActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/WebhookActionTypeHandler.java index 95213a8..0da22ae 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/WebhookActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/WebhookActionTypeHandler.java @@ -1,6 +1,5 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; -import io.github.eggy03.papertrail.bot.listeners.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; import io.github.eggy03.papertrail.bot.utils.auditlog.GuildUtils; import io.github.eggy03.papertrail.bot.utils.auditlog.WebhookUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; From 9c563bb0b3edd292c6a5f7f6896298f5450fe8be Mon Sep 17 00:00:00 2001 From: Egg-03 <111327101+eggy03@users.noreply.github.com> Date: Tue, 14 Jul 2026 10:22:29 +0530 Subject: [PATCH 3/7] refactor: rename base handler to abstract class - Rename `GuildAuditLogEntryCreateEventActionTypeHandler` to `AbstractGuildAuditLogEntryCreateEventActionTypeHandler`. Signed-off-by: Egg-03 <111327101+eggy03@users.noreply.github.com> --- .../auditlog/GuildAuditLogEntryEventListener.java | 12 ++++++------ ...ldAuditLogEntryCreateEventActionTypeHandler.java} | 8 ++++---- .../handlers/auditlog/AutoModActionTypeHandler.java | 2 +- .../handlers/auditlog/ChannelActionTypeHandler.java | 2 +- .../auditlog/ChannelOverrideActionTypeHandler.java | 2 +- .../handlers/auditlog/EmojiActionTypeHandler.java | 2 +- .../auditlog/GuildUpdateActionTypeHandler.java | 2 +- .../auditlog/HomeSettingsActionTypeHandler.java | 2 +- .../auditlog/IntegrationActionTypeHandler.java | 2 +- .../handlers/auditlog/InviteActionTypeHandler.java | 2 +- .../auditlog/MemberUpdateActionTypeHandler.java | 2 +- .../handlers/auditlog/MessageActionTypeHandler.java | 2 +- .../auditlog/MessagePinActionTypeHandler.java | 2 +- .../auditlog/ModActionActionTypeHandler.java | 2 +- .../auditlog/OnboardingActionTypeHandler.java | 2 +- .../auditlog/OnboardingPromptActionTypeHandler.java | 2 +- .../handlers/auditlog/RoleActionTypeHandler.java | 2 +- .../auditlog/ScheduledEventActionTypeHandler.java | 2 +- .../auditlog/SoundboardActionTypeHandler.java | 2 +- .../auditlog/StageInstanceActionTypeHandler.java | 2 +- .../handlers/auditlog/StickerActionTypeHandler.java | 2 +- .../handlers/auditlog/ThreadActionTypeHandler.java | 2 +- .../auditlog/UnimplementedActionTypeHandler.java | 2 +- .../handlers/auditlog/UnknownActionTypeHandler.java | 2 +- .../VoiceChannelStatusActionTypeHandler.java | 2 +- .../handlers/auditlog/WebhookActionTypeHandler.java | 2 +- 26 files changed, 34 insertions(+), 34 deletions(-) rename src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/{GuildAuditLogEntryCreateEventActionTypeHandler.java => AbstractGuildAuditLogEntryCreateEventActionTypeHandler.java} (97%) diff --git a/src/main/java/io/github/eggy03/papertrail/bot/listeners/auditlog/GuildAuditLogEntryEventListener.java b/src/main/java/io/github/eggy03/papertrail/bot/listeners/auditlog/GuildAuditLogEntryEventListener.java index a17c250..6731e14 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/listeners/auditlog/GuildAuditLogEntryEventListener.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/listeners/auditlog/GuildAuditLogEntryEventListener.java @@ -1,7 +1,7 @@ package io.github.eggy03.papertrail.bot.listeners.auditlog; import io.github.eggy03.papertrail.bot.annotations.VirtualThreadFactory; -import io.github.eggy03.papertrail.bot.service.handlers.auditlog.GuildAuditLogEntryCreateEventActionTypeHandler; +import io.github.eggy03.papertrail.bot.service.handlers.auditlog.AbstractGuildAuditLogEntryCreateEventActionTypeHandler; import jakarta.enterprise.inject.Instance; import jakarta.inject.Inject; import jakarta.inject.Singleton; @@ -15,17 +15,17 @@ /** * Listener responsible for receiving {@link GuildAuditLogEntryCreateEvent} * events from JDA and delegating them to all registered - * {@link GuildAuditLogEntryCreateEventActionTypeHandler} CDI beans. + * {@link AbstractGuildAuditLogEntryCreateEventActionTypeHandler} CDI beans. * *

* Event handlers are resolved dynamically using - * {@code Instance}, allowing multiple + * {@code Instance}, allowing multiple * independent handler implementations to process the same audit log event. *

* *

* Each discovered handler instance will receive the event through - * {@link GuildAuditLogEntryCreateEventActionTypeHandler#handleActionType(GuildAuditLogEntryCreateEvent)}, where + * {@link AbstractGuildAuditLogEntryCreateEventActionTypeHandler#handleActionType(GuildAuditLogEntryCreateEvent)}, where * it will process the event. *

*/ @@ -33,12 +33,12 @@ @Singleton public final class GuildAuditLogEntryEventListener extends ListenerAdapter { - private final @NonNull Instance handlerInstances; + private final @NonNull Instance handlerInstances; private final @NonNull @VirtualThreadFactory ThreadFactory virtualThreadFactory; @Inject - public GuildAuditLogEntryEventListener(@NonNull Instance handlerInstances, + public GuildAuditLogEntryEventListener(@NonNull Instance handlerInstances, @NonNull @VirtualThreadFactory ThreadFactory virtualThreadFactory ) { this.handlerInstances = handlerInstances; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildAuditLogEntryCreateEventActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/AbstractGuildAuditLogEntryCreateEventActionTypeHandler.java similarity index 97% rename from src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildAuditLogEntryCreateEventActionTypeHandler.java rename to src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/AbstractGuildAuditLogEntryCreateEventActionTypeHandler.java index 89e4127..cc95f5a 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildAuditLogEntryCreateEventActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/AbstractGuildAuditLogEntryCreateEventActionTypeHandler.java @@ -30,7 +30,7 @@ * *

* If multiple subclasses are registered as CDI beans and are iterated - * through {@code Instance}, each handler + * through {@code Instance}, each handler * instance will independently receive and process the event. *

* @@ -53,7 +53,7 @@ * *
{@code
  * @ApplicationScoped
- * public class MyHandler extends GuildAuditLogEntryCreateEventActionTypeHandler {
+ * public class MyHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler {
  *
  *     @Override
  *     public void onBan(@NonNull GuildAuditLogEntryCreateEvent event) {
@@ -75,7 +75,7 @@
  *
  * 
{@code
  * @Inject
- * Instance eventHandlerInstance;
+ * Instance eventHandlerInstance;
  *
  * eventHandlerInstance.forEach(handler ->
  *     handler.handleActionType(event)
@@ -87,7 +87,7 @@
  * {@link GuildAuditLogEntryEventListener}.
  * 

*/ -public abstract class GuildAuditLogEntryCreateEventActionTypeHandler { +public abstract class AbstractGuildAuditLogEntryCreateEventActionTypeHandler { // handler methods for ActionType diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/AutoModActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/AutoModActionTypeHandler.java index dbb1db4..f89bada 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/AutoModActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/AutoModActionTypeHandler.java @@ -22,7 +22,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class AutoModActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class AutoModActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelActionTypeHandler.java index 8d206fc..e84df5b 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelActionTypeHandler.java @@ -23,7 +23,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class ChannelActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class ChannelActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelOverrideActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelOverrideActionTypeHandler.java index ecb20d8..9ec7b17 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelOverrideActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelOverrideActionTypeHandler.java @@ -23,7 +23,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class ChannelOverrideActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class ChannelOverrideActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/EmojiActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/EmojiActionTypeHandler.java index 1a19da1..7f866ea 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/EmojiActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/EmojiActionTypeHandler.java @@ -19,7 +19,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class EmojiActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class EmojiActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildUpdateActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildUpdateActionTypeHandler.java index 09d147d..524b6fb 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildUpdateActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildUpdateActionTypeHandler.java @@ -22,7 +22,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class GuildUpdateActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class GuildUpdateActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/HomeSettingsActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/HomeSettingsActionTypeHandler.java index 831909c..9e32335 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/HomeSettingsActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/HomeSettingsActionTypeHandler.java @@ -19,7 +19,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class HomeSettingsActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class HomeSettingsActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/IntegrationActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/IntegrationActionTypeHandler.java index b7031de..6253c7e 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/IntegrationActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/IntegrationActionTypeHandler.java @@ -19,7 +19,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class IntegrationActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class IntegrationActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/InviteActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/InviteActionTypeHandler.java index 3b2976b..6b659bb 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/InviteActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/InviteActionTypeHandler.java @@ -22,7 +22,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class InviteActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class InviteActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MemberUpdateActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MemberUpdateActionTypeHandler.java index 685ff8b..44f3ac8 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MemberUpdateActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MemberUpdateActionTypeHandler.java @@ -22,7 +22,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class MemberUpdateActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class MemberUpdateActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessageActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessageActionTypeHandler.java index 6caa586..9a575e8 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessageActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessageActionTypeHandler.java @@ -19,7 +19,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class MessageActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class MessageActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessagePinActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessagePinActionTypeHandler.java index a235a0a..674540f 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessagePinActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessagePinActionTypeHandler.java @@ -20,7 +20,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class MessagePinActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class MessagePinActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ModActionActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ModActionActionTypeHandler.java index c34e968..c7db768 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ModActionActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ModActionActionTypeHandler.java @@ -19,7 +19,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class ModActionActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class ModActionActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingActionTypeHandler.java index d95c001..fbdb84e 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingActionTypeHandler.java @@ -22,7 +22,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class OnboardingActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class OnboardingActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingPromptActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingPromptActionTypeHandler.java index 2723b6c..a6e68bf 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingPromptActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingPromptActionTypeHandler.java @@ -20,7 +20,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class OnboardingPromptActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class OnboardingPromptActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/RoleActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/RoleActionTypeHandler.java index 0f48b57..f7a956d 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/RoleActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/RoleActionTypeHandler.java @@ -22,7 +22,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class RoleActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class RoleActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ScheduledEventActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ScheduledEventActionTypeHandler.java index 33c65e3..771a87f 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ScheduledEventActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ScheduledEventActionTypeHandler.java @@ -20,7 +20,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class ScheduledEventActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class ScheduledEventActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/SoundboardActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/SoundboardActionTypeHandler.java index cb70559..df61e4b 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/SoundboardActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/SoundboardActionTypeHandler.java @@ -20,7 +20,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class SoundboardActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class SoundboardActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StageInstanceActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StageInstanceActionTypeHandler.java index aabd110..19dbe1d 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StageInstanceActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StageInstanceActionTypeHandler.java @@ -20,7 +20,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class StageInstanceActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class StageInstanceActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StickerActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StickerActionTypeHandler.java index e6c7c65..2f67ea6 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StickerActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StickerActionTypeHandler.java @@ -21,7 +21,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class StickerActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class StickerActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ThreadActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ThreadActionTypeHandler.java index 4a4dccf..a13b5ef 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ThreadActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ThreadActionTypeHandler.java @@ -24,7 +24,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class ThreadActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class ThreadActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnimplementedActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnimplementedActionTypeHandler.java index 1d45385..9cffd1e 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnimplementedActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnimplementedActionTypeHandler.java @@ -9,7 +9,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class UnimplementedActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class UnimplementedActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { @Override public void onUnimplementedActionType(@NonNull GuildAuditLogEntryCreateEvent event) { diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnknownActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnknownActionTypeHandler.java index 84e1d16..37e860b 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnknownActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnknownActionTypeHandler.java @@ -20,7 +20,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class UnknownActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class UnknownActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java index b4c0665..0b0745f 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java @@ -20,7 +20,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class VoiceChannelStatusActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class VoiceChannelStatusActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/WebhookActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/WebhookActionTypeHandler.java index 0da22ae..9570c7e 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/WebhookActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/WebhookActionTypeHandler.java @@ -21,7 +21,7 @@ @ApplicationScoped @Slf4j @SuppressWarnings("java:S1192") -public final class WebhookActionTypeHandler extends GuildAuditLogEntryCreateEventActionTypeHandler { +public final class WebhookActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; From 2383f009f202fa6a454d838e56243520073e869a Mon Sep 17 00:00:00 2001 From: Egg-03 <111327101+eggy03@users.noreply.github.com> Date: Tue, 14 Jul 2026 11:20:26 +0530 Subject: [PATCH 4/7] refactor(embeds): centralize embed validation and sending into an injectable service - Extract duplicated embed validation and sending logic into `EmbedCheckingService`. Signed-off-by: Egg-03 <111327101+eggy03@users.noreply.github.com> --- .../bot/service/EmbedCheckingService.java | 38 +++++++++++++++++++ .../auditlog/AutoModActionTypeHandler.java | 32 ++++++---------- .../auditlog/ChannelActionTypeHandler.java | 23 ++++------- .../ChannelOverrideActionTypeHandler.java | 23 ++++------- .../auditlog/EmojiActionTypeHandler.java | 23 ++++------- .../GuildUpdateActionTypeHandler.java | 21 +++------- .../HomeSettingsActionTypeHandler.java | 21 +++------- .../IntegrationActionTypeHandler.java | 25 ++++-------- .../auditlog/InviteActionTypeHandler.java | 23 ++++------- .../MemberUpdateActionTypeHandler.java | 25 ++++-------- .../auditlog/MessageActionTypeHandler.java | 21 +++------- .../auditlog/MessagePinActionTypeHandler.java | 21 +++------- .../auditlog/ModActionActionTypeHandler.java | 27 +++++-------- .../auditlog/OnboardingActionTypeHandler.java | 21 +++------- .../OnboardingPromptActionTypeHandler.java | 23 ++++------- .../auditlog/RoleActionTypeHandler.java | 23 ++++------- .../ScheduledEventActionTypeHandler.java | 23 ++++------- .../auditlog/SoundboardActionTypeHandler.java | 23 ++++------- .../StageInstanceActionTypeHandler.java | 23 ++++------- .../auditlog/StickerActionTypeHandler.java | 23 ++++------- .../auditlog/ThreadActionTypeHandler.java | 23 ++++------- .../auditlog/UnknownActionTypeHandler.java | 19 +++------- .../VoiceChannelStatusActionTypeHandler.java | 21 +++------- .../auditlog/WebhookActionTypeHandler.java | 23 ++++------- .../guild/GuildBoostEventHandler.java | 25 ++++-------- .../guild/GuildMemberEventHandler.java | 23 +++-------- .../handlers/guild/GuildPollEventHandler.java | 20 +++------- .../GuildSecurityIncidentEventHandler.java | 35 ++++++----------- .../guild/GuildVoiceEventHandler.java | 23 +++-------- .../message/GuildMessageEventHandler.java | 23 +++-------- 30 files changed, 241 insertions(+), 476 deletions(-) create mode 100644 src/main/java/io/github/eggy03/papertrail/bot/service/EmbedCheckingService.java diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/EmbedCheckingService.java b/src/main/java/io/github/eggy03/papertrail/bot/service/EmbedCheckingService.java new file mode 100644 index 0000000..a433d6f --- /dev/null +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/EmbedCheckingService.java @@ -0,0 +1,38 @@ +package io.github.eggy03.papertrail.bot.service; + +import jakarta.enterprise.context.ApplicationScoped; +import lombok.NonNull; +import lombok.extern.slf4j.Slf4j; +import net.dv8tion.jda.api.EmbedBuilder; +import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; +import net.dv8tion.jda.api.events.guild.GenericGuildEvent; +import net.dv8tion.jda.api.events.message.GenericMessageEvent; + +@ApplicationScoped +@Slf4j +public final class EmbedCheckingService { + + public void checkAndSend(@NonNull GenericGuildEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { + if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { + log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); + return; + } + + TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); + if (sendingChannel != null && sendingChannel.canTalk()) { + sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); + } + } + + public void checkAndSend(@NonNull GenericMessageEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { + if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { + log.warn("Embed containing message is empty or too long (current length: {}).", embedBuilder.length()); + return; + } + + TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); + if (sendingChannel != null && sendingChannel.canTalk()) { + sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); + } + } +} diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/AutoModActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/AutoModActionTypeHandler.java index f89bada..9394d5a 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/AutoModActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/AutoModActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.bot.utils.auditlog.AutoModUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; @@ -12,7 +13,6 @@ import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; import net.dv8tion.jda.api.entities.automod.AutoModRule; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -25,10 +25,12 @@ public final class AutoModActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public AutoModActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public AutoModActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -38,21 +40,9 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } - @Override public void onAutoModerationFlagToChannel(@NonNull GuildAuditLogEntryCreateEvent event) { - + String channelIdToSendTo = getRegisteredChannelId(event.getGuild().getId()); if (channelIdToSendTo.isBlank()) return; @@ -76,7 +66,7 @@ public void onAutoModerationFlagToChannel(@NonNull GuildAuditLogEntryCreateEvent eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @@ -106,7 +96,7 @@ public void onAutoModerationMemberTimeout(@NonNull GuildAuditLogEntryCreateEvent eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -135,7 +125,7 @@ public void onAutoModerationRuleBlockMessage(@NonNull GuildAuditLogEntryCreateEv eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @@ -183,7 +173,7 @@ public void onAutoModerationRuleCreate(@NonNull GuildAuditLogEntryCreateEvent ev eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -212,7 +202,7 @@ public void onAutoModerationRuleUpdate(@NonNull GuildAuditLogEntryCreateEvent ev eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -244,6 +234,6 @@ public void onAutoModerationRuleDelete(@NonNull GuildAuditLogEntryCreateEvent ev eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelActionTypeHandler.java index e84df5b..beb1579 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.bot.utils.DurationUtils; import io.github.eggy03.papertrail.bot.utils.auditlog.ChannelUtils; @@ -12,7 +13,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.entities.channel.middleman.GuildChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; @@ -26,10 +26,12 @@ public final class ChannelActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public ChannelActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public ChannelActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -39,17 +41,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onChannelCreate(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -108,7 +99,7 @@ public void onChannelCreate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -221,7 +212,7 @@ public void onChannelUpdate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -259,6 +250,6 @@ public void onChannelDelete(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelOverrideActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelOverrideActionTypeHandler.java index 9ec7b17..a5f78f5 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelOverrideActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ChannelOverrideActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.auditlog.ChannelUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; @@ -12,7 +13,6 @@ import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.entities.channel.middleman.GuildChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; @@ -26,10 +26,12 @@ public final class ChannelOverrideActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public ChannelOverrideActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public ChannelOverrideActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -39,17 +41,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onChannelOverrideCreate(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -99,7 +90,7 @@ public void onChannelOverrideCreate(@NonNull GuildAuditLogEntryCreateEvent event eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -146,7 +137,7 @@ public void onChannelOverrideUpdate(@NonNull GuildAuditLogEntryCreateEvent event eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -197,7 +188,7 @@ public void onChannelOverrideDelete(@NonNull GuildAuditLogEntryCreateEvent event eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } // ALE changes do not expose the id and type keys in case of override updates diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/EmojiActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/EmojiActionTypeHandler.java index 7f866ea..6068895 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/EmojiActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/EmojiActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; import jakarta.enterprise.context.ApplicationScoped; @@ -9,7 +10,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -22,10 +22,12 @@ public final class EmojiActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public EmojiActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public EmojiActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -35,17 +37,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onEmojiCreate(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -79,7 +70,7 @@ public void onEmojiCreate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -115,7 +106,7 @@ public void onEmojiUpdate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -150,6 +141,6 @@ public void onEmojiDelete(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildUpdateActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildUpdateActionTypeHandler.java index 524b6fb..7885774 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildUpdateActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/GuildUpdateActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.bot.utils.DurationUtils; import io.github.eggy03.papertrail.bot.utils.auditlog.GuildUtils; @@ -12,7 +13,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -25,10 +25,12 @@ public final class GuildUpdateActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public GuildUpdateActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public GuildUpdateActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -38,17 +40,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onGuildUpdate(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -141,7 +132,7 @@ public void onGuildUpdate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -175,6 +166,6 @@ public void onGuildProfileUpdate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/HomeSettingsActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/HomeSettingsActionTypeHandler.java index 9e32335..ee87538 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/HomeSettingsActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/HomeSettingsActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; import jakarta.enterprise.context.ApplicationScoped; @@ -9,7 +10,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -22,10 +22,12 @@ public final class HomeSettingsActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public HomeSettingsActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public HomeSettingsActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -35,17 +37,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onHomeSettingsCreate(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -71,7 +62,7 @@ public void onHomeSettingsCreate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -104,6 +95,6 @@ public void onHomeSettingsUpdate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/IntegrationActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/IntegrationActionTypeHandler.java index 6253c7e..db846c0 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/IntegrationActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/IntegrationActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; import jakarta.enterprise.context.ApplicationScoped; @@ -9,7 +10,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -22,10 +22,12 @@ public final class IntegrationActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public IntegrationActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public IntegrationActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -35,17 +37,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onIntegrationCreate(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -81,7 +72,7 @@ public void onIntegrationCreate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -106,7 +97,7 @@ public void onIntegrationUpdate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -142,7 +133,7 @@ public void onIntegrationDelete(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -165,6 +156,6 @@ public void onApplicationCommandPrivilegesUpdate(@NonNull GuildAuditLogEntryCrea eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/InviteActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/InviteActionTypeHandler.java index 6b659bb..64e81b8 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/InviteActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/InviteActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.bot.utils.DurationUtils; import io.github.eggy03.papertrail.bot.utils.auditlog.InviteUtils; @@ -12,7 +13,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -25,10 +25,12 @@ public final class InviteActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public InviteActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public InviteActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -38,17 +40,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onInviteCreate(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -107,7 +98,7 @@ public void onInviteCreate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -132,7 +123,7 @@ public void onInviteUpdate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -188,6 +179,6 @@ public void onInviteDelete(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MemberUpdateActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MemberUpdateActionTypeHandler.java index 44f3ac8..9d4690b 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MemberUpdateActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MemberUpdateActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.bot.utils.DurationUtils; import io.github.eggy03.papertrail.bot.utils.auditlog.MemberUtils; @@ -12,7 +13,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -25,10 +25,12 @@ public final class MemberUpdateActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public MemberUpdateActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public MemberUpdateActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -38,17 +40,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onMemberUpdate(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -110,7 +101,7 @@ public void onMemberUpdate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -155,7 +146,7 @@ public void onMemberRoleUpdate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } // the audit log does not expose much information regarding member vc move and kick events @@ -179,7 +170,7 @@ public void onMemberVoiceKick(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } // the audit log does not expose much information regarding member vc move and kick events @@ -202,6 +193,6 @@ public void onMemberVoiceMove(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessageActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessageActionTypeHandler.java index 9a575e8..c961b3f 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessageActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessageActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; import jakarta.enterprise.context.ApplicationScoped; @@ -9,7 +10,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -22,10 +22,12 @@ public final class MessageActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public MessageActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public MessageActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -35,17 +37,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } // for the following four events, audit log does not expose much information // a custom implementation to log edits and deletes of messages is found in GuildMessageEventListener @@ -77,7 +68,7 @@ public void onMessageDelete(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -98,6 +89,6 @@ public void onMessageBulkDelete(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessagePinActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessagePinActionTypeHandler.java index 674540f..2678e6d 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessagePinActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/MessagePinActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.auditlog.MessageUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; @@ -10,7 +11,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -23,10 +23,12 @@ public final class MessagePinActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public MessagePinActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public MessagePinActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -36,17 +38,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onMessagePin(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -76,7 +67,7 @@ public void onMessagePin(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -107,6 +98,6 @@ public void onMessageUnpin(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ModActionActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ModActionActionTypeHandler.java index c7db768..515adc1 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ModActionActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ModActionActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; import jakarta.enterprise.context.ApplicationScoped; @@ -9,7 +10,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -22,10 +22,12 @@ public final class ModActionActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public ModActionActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public ModActionActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -35,17 +37,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onKick(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -74,7 +65,7 @@ public void onKick(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); }); } @@ -106,7 +97,7 @@ public void onBan(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); }); } @@ -134,7 +125,7 @@ public void onUnban(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); }); } @@ -161,7 +152,7 @@ public void onBotAdd(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -186,6 +177,6 @@ public void onPrune(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingActionTypeHandler.java index fbdb84e..5bc0557 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.bot.utils.auditlog.OnboardingUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; @@ -12,7 +13,6 @@ import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -25,10 +25,12 @@ public final class OnboardingActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public OnboardingActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public OnboardingActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -38,17 +40,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onOnboardingCreate(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -72,7 +63,7 @@ public void onOnboardingCreate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -131,6 +122,6 @@ public void onOnboardingUpdate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingPromptActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingPromptActionTypeHandler.java index a6e68bf..c03d5ef 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingPromptActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/OnboardingPromptActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; @@ -10,7 +11,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -23,10 +23,12 @@ public final class OnboardingPromptActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public OnboardingPromptActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public OnboardingPromptActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -36,17 +38,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onOnboardingPromptCreate(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -99,7 +90,7 @@ public void onOnboardingPromptCreate(@NonNull GuildAuditLogEntryCreateEvent even eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -161,7 +152,7 @@ public void onOnboardingPromptUpdate(@NonNull GuildAuditLogEntryCreateEvent even eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -211,6 +202,6 @@ public void onOnboardingPromptDelete(@NonNull GuildAuditLogEntryCreateEvent even eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/RoleActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/RoleActionTypeHandler.java index f7a956d..a796f96 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/RoleActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/RoleActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.bot.utils.auditlog.RoleUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; @@ -12,7 +13,6 @@ import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -25,10 +25,12 @@ public final class RoleActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public RoleActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public RoleActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -38,17 +40,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onRoleCreate(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -94,7 +85,7 @@ public void onRoleCreate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -172,7 +163,7 @@ public void onRoleUpdate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -224,6 +215,6 @@ public void onRoleDelete(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ScheduledEventActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ScheduledEventActionTypeHandler.java index 771a87f..a63ab20 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ScheduledEventActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ScheduledEventActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.auditlog.ScheduledEventUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; @@ -10,7 +11,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -23,10 +23,12 @@ public final class ScheduledEventActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public ScheduledEventActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public ScheduledEventActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -36,17 +38,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onScheduledEventCreate(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -93,7 +84,7 @@ public void onScheduledEventCreate(@NonNull GuildAuditLogEntryCreateEvent event) eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -173,7 +164,7 @@ public void onScheduledEventUpdate(@NonNull GuildAuditLogEntryCreateEvent event) eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -220,6 +211,6 @@ public void onScheduledEventDelete(@NonNull GuildAuditLogEntryCreateEvent event) eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/SoundboardActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/SoundboardActionTypeHandler.java index df61e4b..292ac10 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/SoundboardActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/SoundboardActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.auditlog.SoundboardUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; @@ -10,7 +11,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -23,10 +23,12 @@ public final class SoundboardActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public SoundboardActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public SoundboardActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -36,17 +38,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onSoundboardSoundCreate(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -92,7 +83,7 @@ public void onSoundboardSoundCreate(@NonNull GuildAuditLogEntryCreateEvent event eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -148,7 +139,7 @@ public void onSoundboardSoundUpdate(@NonNull GuildAuditLogEntryCreateEvent event eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -195,6 +186,6 @@ public void onSoundboardSoundDelete(@NonNull GuildAuditLogEntryCreateEvent event eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StageInstanceActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StageInstanceActionTypeHandler.java index 19dbe1d..99c44db 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StageInstanceActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StageInstanceActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.auditlog.StageUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; @@ -10,7 +11,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -23,10 +23,12 @@ public final class StageInstanceActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public StageInstanceActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public StageInstanceActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -36,17 +38,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onStageInstanceCreate(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -83,7 +74,7 @@ public void onStageInstanceCreate(@NonNull GuildAuditLogEntryCreateEvent event) eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -127,7 +118,7 @@ public void onStageInstanceUpdate(@NonNull GuildAuditLogEntryCreateEvent event) eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -164,6 +155,6 @@ public void onStageInstanceDelete(@NonNull GuildAuditLogEntryCreateEvent event) eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StickerActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StickerActionTypeHandler.java index 2f67ea6..db09fda 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StickerActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/StickerActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.auditlog.StickerUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; @@ -10,7 +11,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.entities.sticker.GuildSticker; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; @@ -24,10 +24,12 @@ public final class StickerActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public StickerActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public StickerActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -37,17 +39,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onStickerCreate(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -94,7 +85,7 @@ public void onStickerCreate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -148,7 +139,7 @@ public void onStickerUpdate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -196,6 +187,6 @@ public void onStickerDelete(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ThreadActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ThreadActionTypeHandler.java index a13b5ef..9e59071 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ThreadActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/ThreadActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.bot.utils.DurationUtils; import io.github.eggy03.papertrail.bot.utils.auditlog.ChannelUtils; @@ -13,7 +14,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.entities.channel.concrete.ThreadChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; @@ -27,10 +27,12 @@ public final class ThreadActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public ThreadActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public ThreadActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -40,17 +42,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onThreadCreate(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -109,7 +100,7 @@ public void onThreadCreate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -187,7 +178,7 @@ public void onThreadUpdate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -245,6 +236,6 @@ public void onThreadDelete(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnknownActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnknownActionTypeHandler.java index 37e860b..d683966 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnknownActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/UnknownActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; import jakarta.enterprise.context.ApplicationScoped; @@ -9,7 +10,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -23,10 +23,12 @@ public final class UnknownActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public UnknownActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public UnknownActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -36,17 +38,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onUnknownActionType(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -75,6 +66,6 @@ public void onUnknownActionType(@NonNull GuildAuditLogEntryCreateEvent event) { ) ); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java index 0b0745f..0c017e8 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/VoiceChannelStatusActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; import jakarta.enterprise.context.ApplicationScoped; @@ -9,7 +10,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.entities.channel.middleman.GuildChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; @@ -23,10 +23,12 @@ public final class VoiceChannelStatusActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public VoiceChannelStatusActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public VoiceChannelStatusActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -36,17 +38,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onVoiceChannelStatusUpdate(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -80,7 +71,7 @@ public void onVoiceChannelStatusUpdate(@NonNull GuildAuditLogEntryCreateEvent ev eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -112,6 +103,6 @@ public void onVoiceChannelStatusDelete(@NonNull GuildAuditLogEntryCreateEvent ev eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/WebhookActionTypeHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/WebhookActionTypeHandler.java index 9570c7e..68f6d4c 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/WebhookActionTypeHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/auditlog/WebhookActionTypeHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.auditlog; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.auditlog.GuildUtils; import io.github.eggy03.papertrail.bot.utils.auditlog.WebhookUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; @@ -11,7 +12,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.audit.AuditLogEntry; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.events.guild.GuildAuditLogEntryCreateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -24,10 +24,12 @@ public final class WebhookActionTypeHandler extends AbstractGuildAuditLogEntryCreateEventActionTypeHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public WebhookActionTypeHandler(@NonNull AuditLogRegistrationClient client) { + public WebhookActionTypeHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -37,17 +39,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GuildAuditLogEntryCreateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } @Override public void onWebhookCreate(@NonNull GuildAuditLogEntryCreateEvent event) { @@ -89,7 +80,7 @@ public void onWebhookCreate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -146,7 +137,7 @@ public void onWebhookUpdate(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @Override @@ -189,6 +180,6 @@ public void onWebhookDelete(@NonNull GuildAuditLogEntryCreateEvent event) { eb.setFooter("Audit Log Entry ID: " + ale.getId()); eb.setTimestamp(ale.getTimeCreated()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildBoostEventHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildBoostEventHandler.java index b45d704..d0e5c26 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildBoostEventHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildBoostEventHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.guild; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; import jakarta.enterprise.context.ApplicationScoped; @@ -9,8 +10,6 @@ import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Member; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; -import net.dv8tion.jda.api.events.guild.GenericGuildEvent; import net.dv8tion.jda.api.events.guild.member.update.GuildMemberUpdateBoostTimeEvent; import net.dv8tion.jda.api.events.guild.update.GuildUpdateBoostCountEvent; import net.dv8tion.jda.api.events.guild.update.GuildUpdateBoostTierEvent; @@ -26,10 +25,12 @@ public final class GuildBoostEventHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public GuildBoostEventHandler(@NonNull AuditLogRegistrationClient client) { + public GuildBoostEventHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -39,18 +40,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GenericGuildEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } - public void handleUpdateBoostTier(@NonNull GuildUpdateBoostTierEvent event) { String channelIdToSendTo = getRegisteredChannelId(event.getGuild().getId()); if (channelIdToSendTo.isBlank()) return; @@ -82,7 +71,7 @@ public void handleUpdateBoostTier(@NonNull GuildUpdateBoostTierEvent event) { eb.setFooter(guild.getName()); eb.setTimestamp(Instant.now()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } public void handleUpdateBoostCount(@NonNull GuildUpdateBoostCountEvent event) { @@ -103,7 +92,7 @@ public void handleUpdateBoostCount(@NonNull GuildUpdateBoostCountEvent event) { eb.setFooter(guild.getName()); eb.setTimestamp(Instant.now()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } public void handleMemberUpdateBoostTime(@NonNull GuildMemberUpdateBoostTimeEvent event) { @@ -132,6 +121,6 @@ public void handleMemberUpdateBoostTime(@NonNull GuildMemberUpdateBoostTimeEvent eb.setFooter(guild.getName()); eb.setTimestamp(Instant.now()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildMemberEventHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildMemberEventHandler.java index 3f1620c..4b905c9 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildMemberEventHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildMemberEventHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.guild; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.bot.utils.DurationUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; @@ -12,8 +13,6 @@ import net.dv8tion.jda.api.entities.Guild; import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; -import net.dv8tion.jda.api.events.guild.GenericGuildEvent; import net.dv8tion.jda.api.events.guild.member.GuildMemberJoinEvent; import net.dv8tion.jda.api.events.guild.member.GuildMemberRemoveEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; @@ -28,10 +27,12 @@ public final class GuildMemberEventHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public GuildMemberEventHandler(@NonNull AuditLogRegistrationClient client) { + public GuildMemberEventHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -41,18 +42,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GenericGuildEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } - public void handleGuildMemberJoin(@NonNull GuildMemberJoinEvent event) { String channelIdToSendTo = getRegisteredChannelId(event.getGuild().getId()); if (channelIdToSendTo.isBlank()) return; @@ -75,7 +64,7 @@ public void handleGuildMemberJoin(@NonNull GuildMemberJoinEvent event) { eb.setFooter(event.getGuild().getName()); eb.setTimestamp(Instant.now()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } public void handleGuildMemberRemove(@NonNull GuildMemberRemoveEvent event) { @@ -100,7 +89,7 @@ public void handleGuildMemberRemove(@NonNull GuildMemberRemoveEvent event) { eb.setFooter(event.getGuild().getName()); eb.setTimestamp(Instant.now()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } @NonNull diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildPollEventHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildPollEventHandler.java index a3a8526..c09f806 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildPollEventHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildPollEventHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.guild; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.BooleanUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; @@ -8,7 +9,6 @@ import lombok.NonNull; import lombok.extern.slf4j.Slf4j; import net.dv8tion.jda.api.EmbedBuilder; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.entities.messages.MessagePoll; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; @@ -23,10 +23,12 @@ public final class GuildPollEventHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public GuildPollEventHandler(@NonNull AuditLogRegistrationClient client) { + public GuildPollEventHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -36,18 +38,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull MessageReceivedEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } - public void handlePollCreationEvent(@NonNull MessageReceivedEvent event) { // check if message has a poll MessagePoll messagePoll = event.getMessage().getPoll(); @@ -70,7 +60,7 @@ public void handlePollCreationEvent(@NonNull MessageReceivedEvent event) { eb.setFooter(event.getGuild().getName()); eb.setTimestamp(Instant.now()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildSecurityIncidentEventHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildSecurityIncidentEventHandler.java index d8d2747..b3cb66b 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildSecurityIncidentEventHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildSecurityIncidentEventHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.guild; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.bot.utils.DurationUtils; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; @@ -8,10 +9,8 @@ import lombok.NonNull; import lombok.extern.slf4j.Slf4j; import net.dv8tion.jda.api.EmbedBuilder; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.entities.guild.SecurityIncidentActions; import net.dv8tion.jda.api.entities.guild.SecurityIncidentDetections; -import net.dv8tion.jda.api.events.guild.update.GenericGuildUpdateEvent; import net.dv8tion.jda.api.events.guild.update.GuildUpdateSecurityIncidentActionsEvent; import net.dv8tion.jda.api.events.guild.update.GuildUpdateSecurityIncidentDetectionsEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; @@ -26,10 +25,12 @@ public final class GuildSecurityIncidentEventHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public GuildSecurityIncidentEventHandler(@NonNull AuditLogRegistrationClient client) { + public GuildSecurityIncidentEventHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -39,18 +40,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GenericGuildUpdateEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } - public void handleGuildUpdateSecurityIncidentDetections(@NonNull GuildUpdateSecurityIncidentDetectionsEvent event) { String channelIdToSendTo = getRegisteredChannelId(event.getGuild().getId()); if (channelIdToSendTo.isBlank()) return; @@ -73,7 +62,7 @@ public void handleGuildUpdateSecurityIncidentDetections(@NonNull GuildUpdateSecu eb.setFooter(event.getGuild().getName()); eb.setTimestamp(Instant.now()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } if (newDMSpamDetectedAt != null) { @@ -85,7 +74,7 @@ public void handleGuildUpdateSecurityIncidentDetections(@NonNull GuildUpdateSecu eb.setFooter(event.getGuild().getName()); eb.setTimestamp(Instant.now()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } if (oldRaidDetectedAt != null) { @@ -97,7 +86,7 @@ public void handleGuildUpdateSecurityIncidentDetections(@NonNull GuildUpdateSecu eb.setFooter(event.getGuild().getName()); eb.setTimestamp(Instant.now()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } if (newRaidDetectedAt != null) { @@ -109,7 +98,7 @@ public void handleGuildUpdateSecurityIncidentDetections(@NonNull GuildUpdateSecu eb.setFooter(event.getGuild().getName()); eb.setTimestamp(Instant.now()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } @@ -135,7 +124,7 @@ public void handleGuildUpdateSecurityIncidentActions(@NonNull GuildUpdateSecurit eb.setFooter(event.getGuild().getName()); eb.setTimestamp(Instant.now()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } if (newDMDisabledUntil != null) { @@ -147,7 +136,7 @@ public void handleGuildUpdateSecurityIncidentActions(@NonNull GuildUpdateSecurit eb.setFooter(event.getGuild().getName()); eb.setTimestamp(Instant.now()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } if (oldInvitesPausedUntil != null) { @@ -159,7 +148,7 @@ public void handleGuildUpdateSecurityIncidentActions(@NonNull GuildUpdateSecurit eb.setFooter(event.getGuild().getName()); eb.setTimestamp(Instant.now()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } if (newInvitesPausedUntil != null) { @@ -171,7 +160,7 @@ public void handleGuildUpdateSecurityIncidentActions(@NonNull GuildUpdateSecurit eb.setFooter(event.getGuild().getName()); eb.setTimestamp(Instant.now()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildVoiceEventHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildVoiceEventHandler.java index 84bd6a5..6c54cd6 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildVoiceEventHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/guild/GuildVoiceEventHandler.java @@ -1,5 +1,6 @@ package io.github.eggy03.papertrail.bot.service.handlers.guild; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.sdk.client.AuditLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.AuditLogRegistrationEntity; import jakarta.enterprise.context.ApplicationScoped; @@ -8,9 +9,7 @@ import lombok.extern.slf4j.Slf4j; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Member; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; import net.dv8tion.jda.api.entities.channel.middleman.AudioChannel; -import net.dv8tion.jda.api.events.guild.GenericGuildEvent; import net.dv8tion.jda.api.events.guild.voice.GuildVoiceUpdateEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; import org.apache.commons.lang3.StringUtils; @@ -23,10 +22,12 @@ public final class GuildVoiceEventHandler { private final @NonNull AuditLogRegistrationClient client; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public GuildVoiceEventHandler(@NonNull AuditLogRegistrationClient client) { + public GuildVoiceEventHandler(@NonNull AuditLogRegistrationClient client, @NonNull EmbedCheckingService embedCheckingService) { this.client = client; + this.embedCheckingService = embedCheckingService; } @NonNull @@ -35,19 +36,7 @@ private String getRegisteredChannelId(@NonNull String guildId) { .map(AuditLogRegistrationEntity::getChannelId).orElse(StringUtils.EMPTY); } - - private void performChecksThenBuildAndSendEmbed(@NonNull GenericGuildEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } - + public void handleVoiceUpdateEvent(@NonNull GuildVoiceUpdateEvent event) { String channelIdToSendTo = getRegisteredChannelId(event.getGuild().getId()); @@ -95,6 +84,6 @@ public void handleVoiceUpdateEvent(@NonNull GuildVoiceUpdateEvent event) { eb.setFooter(event.getGuild().getName()); eb.setTimestamp(Instant.now()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } diff --git a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/message/GuildMessageEventHandler.java b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/message/GuildMessageEventHandler.java index 61b25bc..8d767bc 100644 --- a/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/message/GuildMessageEventHandler.java +++ b/src/main/java/io/github/eggy03/papertrail/bot/service/handlers/message/GuildMessageEventHandler.java @@ -1,6 +1,7 @@ package io.github.eggy03.papertrail.bot.service.handlers.message; import com.google.common.base.Splitter; +import io.github.eggy03.papertrail.bot.service.EmbedCheckingService; import io.github.eggy03.papertrail.sdk.client.MessageLogContentClient; import io.github.eggy03.papertrail.sdk.client.MessageLogRegistrationClient; import io.github.eggy03.papertrail.sdk.entity.MessageLogContentEntity; @@ -11,8 +12,6 @@ import lombok.extern.slf4j.Slf4j; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.User; -import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; -import net.dv8tion.jda.api.events.message.GenericMessageEvent; import net.dv8tion.jda.api.events.message.MessageDeleteEvent; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.events.message.MessageUpdateEvent; @@ -30,11 +29,13 @@ public final class GuildMessageEventHandler { private final @NonNull MessageLogRegistrationClient registrationClient; private final @NonNull MessageLogContentClient contentClient; + private final @NonNull EmbedCheckingService embedCheckingService; @Inject - public GuildMessageEventHandler(@NonNull MessageLogRegistrationClient registrationClient, @NonNull MessageLogContentClient contentClient) { + public GuildMessageEventHandler(@NonNull MessageLogRegistrationClient registrationClient, @NonNull MessageLogContentClient contentClient, @NonNull EmbedCheckingService embedCheckingService) { this.registrationClient = registrationClient; this.contentClient = contentClient; + this.embedCheckingService = embedCheckingService; } private boolean isGuildRegistered(@NonNull String guildId) { @@ -48,18 +49,6 @@ private String getRegisteredChannelId(@NonNull String guildId) { } - private void performChecksThenBuildAndSendEmbed(@NonNull GenericMessageEvent event, @NonNull EmbedBuilder embedBuilder, @NonNull String channelIdToSendTo) { - if (!embedBuilder.isValidLength() || embedBuilder.isEmpty()) { - log.warn("Message Embed is empty or too long (current length: {}).", embedBuilder.length()); - return; - } - - TextChannel sendingChannel = event.getGuild().getTextChannelById(channelIdToSendTo); - if (sendingChannel != null && sendingChannel.canTalk()) { - sendingChannel.sendMessageEmbeds(embedBuilder.build()).queue(); - } - } - public void handleMessageReceivedEvent(@NonNull MessageReceivedEvent event) { if (!isGuildRegistered(event.getGuild().getId())) return; @@ -112,7 +101,7 @@ public void handleMessageUpdateEvent(@NonNull MessageUpdateEvent event) { // update the database with the new message contentClient.updateMessage(event.getMessageId(), updatedMessage, event.getAuthor().getId()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } public void handleMessageDeleteEvent(@NonNull MessageDeleteEvent event) { @@ -149,6 +138,6 @@ public void handleMessageDeleteEvent(@NonNull MessageDeleteEvent event) { // delete the message from the database contentClient.deleteMessage(event.getMessageId()); - performChecksThenBuildAndSendEmbed(event, eb, channelIdToSendTo); + embedCheckingService.checkAndSend(event, eb, channelIdToSendTo); } } From 1811c4aa9e772729857d5a08b4276e81914bda98 Mon Sep 17 00:00:00 2001 From: Egg-03 <111327101+eggy03@users.noreply.github.com> Date: Tue, 14 Jul 2026 12:04:27 +0530 Subject: [PATCH 5/7] chore(config): separate global and application log levels - Replace `LOG_LEVEL` with `GLOBAL_LOG_LEVEL` for general logging - Introduce `APPLICATION_LOG_LEVEL` for `io.github.eggy03.papertrail.bot` package - Update `.env.example` Signed-off-by: Egg-03 <111327101+eggy03@users.noreply.github.com> --- .env.example | 3 ++- src/main/resources/application.properties | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index d8a5b3d..b314844 100644 --- a/.env.example +++ b/.env.example @@ -8,4 +8,5 @@ MAX_SHARD_ID= TWILIGHT_HTTP_PROXY_URL= PORT= MANAGEMENT_PORT= -LOG_LEVEL= +GLOBAL_LOG_LEVEL= +APPLICATION_LOG_LEVEL= \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 6383826..674c626 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -19,7 +19,8 @@ quarkus.management.enabled=true quarkus.management.port=${MANAGEMENT_PORT:9000} # Logging Level -quarkus.log.level=${LOG_LEVEL:INFO} +quarkus.log.level=${GLOBAL_LOG_LEVEL:INFO} +quarkus.log.category."io.github.eggy03.papertrail.bot".level=${APPLICATION_LOG_LEVEL:INFO} # Analytics quarkus.analytics.disabled=true From 2e2b292775b46ee1420b93fae630a7e718fe826a Mon Sep 17 00:00:00 2001 From: Egg-03 <111327101+eggy03@users.noreply.github.com> Date: Tue, 14 Jul 2026 12:08:26 +0530 Subject: [PATCH 6/7] actions: add dependabot.yml Signed-off-by: Egg-03 <111327101+eggy03@users.noreply.github.com> --- .github/dependabot.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..c3da567 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,19 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 + +updates: + - package-ecosystem: "maven" + directory: "/" + schedule: + interval: "weekly" + + open-pull-requests-limit: 5 + + groups: + all-dependencies: + patterns: + - "*" \ No newline at end of file From ac1b8fc08f3ac141bad6d2775376e13806f2f526 Mon Sep 17 00:00:00 2001 From: Egg-03 <111327101+eggy03@users.noreply.github.com> Date: Tue, 14 Jul 2026 12:09:52 +0530 Subject: [PATCH 7/7] chore: bump version to 4.2.0 Signed-off-by: Egg-03 <111327101+eggy03@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d9365dd..8ea3e54 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 io.github.eggy03 papertrailbot - 4.1.9 + 4.2.0 PaperTrail Bot A simple bot for logging all server and member actions quarkus