forked from syntaxbullet/aurorabot
refactor: migrate all code to use getGuildConfig() for guild settings
- Update all commands and events to fetch guild config once per execution - Pass config to service methods that need it (ModerationService.issueWarning) - Update terminal service to use guildSettingsService for persistence - Remove direct imports of config for guild-specific settings This consolidates configuration to database-backed guild settings, eliminating the dual config system.
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
getModerationErrorEmbed,
|
||||
getUserWarningEmbed
|
||||
} from "@/modules/moderation/moderation.view";
|
||||
import { config } from "@shared/lib/config";
|
||||
import { getGuildConfig } from "@shared/lib/config";
|
||||
|
||||
export const warn = createCommand({
|
||||
data: new SlashCommandBuilder()
|
||||
@@ -50,6 +50,9 @@ export const warn = createCommand({
|
||||
return;
|
||||
}
|
||||
|
||||
// Fetch guild config for moderation settings
|
||||
const guildConfig = await getGuildConfig(interaction.guildId!);
|
||||
|
||||
// Issue the warning via service
|
||||
const { moderationCase, warningCount, autoTimeoutIssued } = await ModerationService.issueWarning({
|
||||
userId: targetUser.id,
|
||||
@@ -59,7 +62,11 @@ export const warn = createCommand({
|
||||
reason,
|
||||
guildName: interaction.guild?.name || undefined,
|
||||
dmTarget: targetUser,
|
||||
timeoutTarget: await interaction.guild?.members.fetch(targetUser.id)
|
||||
timeoutTarget: await interaction.guild?.members.fetch(targetUser.id),
|
||||
config: {
|
||||
dmOnWarn: guildConfig.moderation?.cases?.dmOnWarn,
|
||||
autoTimeoutThreshold: guildConfig.moderation?.cases?.autoTimeoutThreshold,
|
||||
},
|
||||
});
|
||||
|
||||
// Send success message to moderator
|
||||
|
||||
Reference in New Issue
Block a user