diff --git a/src/commands/Management/Message Filters/attachment-mode.ts b/src/commands/Management/Message Filters/attachment-mode.ts new file mode 100644 index 00000000000..691d76a8445 --- /dev/null +++ b/src/commands/Management/Message Filters/attachment-mode.ts @@ -0,0 +1,22 @@ +import { GuildSettings, type AdderKey, type GuildSettingsOfType } from '#lib/database'; +import { LanguageKeys } from '#lib/i18n/languageKeys'; +import { SelfModerationCommand } from '#lib/moderation'; +import { ApplyOptions } from '@sapphire/decorators'; + +const Root = LanguageKeys.Commands.Management; +const SettingsRoot = GuildSettings.Selfmod.Attachments; + +@ApplyOptions({ + aliases: ['attachments-mode', 'manage-attachment', 'manage-attachments'], + description: Root.AttachmentsModeDescription, + detailedDescription: Root.AttachmentsModeExtended +}) +export class UserSelfModerationCommand extends SelfModerationCommand { + protected $adder: AdderKey = 'attachments'; + protected keyEnabled: GuildSettingsOfType = SettingsRoot.Enabled; + protected keySoftAction: GuildSettingsOfType = SettingsRoot.SoftAction; + protected keyHardAction: GuildSettingsOfType = SettingsRoot.HardAction; + protected keyHardActionDuration: GuildSettingsOfType = SettingsRoot.HardActionDuration; + protected keyThresholdMaximum: GuildSettingsOfType = SettingsRoot.ThresholdMaximum; + protected keyThresholdDuration: GuildSettingsOfType = SettingsRoot.ThresholdDuration; +} diff --git a/src/commands/Management/Message Filters/attachmentMode.ts b/src/commands/Management/Message Filters/attachmentMode.ts deleted file mode 100644 index 5eebeb306fa..00000000000 --- a/src/commands/Management/Message Filters/attachmentMode.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { GuildSettings, type AdderKey, type GuildSettingsOfType } from '#lib/database'; -import { LanguageKeys } from '#lib/i18n/languageKeys'; -import { SelfModerationCommand } from '#lib/moderation'; -import { ApplyOptions } from '@sapphire/decorators'; - -@ApplyOptions({ - aliases: ['attachment-mode', 'attachments-mode', 'att-mode', 'manageAttachment', 'manageattachment'], - description: LanguageKeys.Commands.Management.AttachmentsModeDescription, - detailedDescription: LanguageKeys.Commands.Management.AttachmentsModeExtended -}) -export class UserSelfModerationCommand extends SelfModerationCommand { - protected $adder: AdderKey = 'attachments'; - protected keyEnabled: GuildSettingsOfType = GuildSettings.Selfmod.Attachments.Enabled; - protected keySoftAction: GuildSettingsOfType = GuildSettings.Selfmod.Attachments.SoftAction; - protected keyHardAction: GuildSettingsOfType = GuildSettings.Selfmod.Attachments.HardAction; - protected keyHardActionDuration: GuildSettingsOfType = GuildSettings.Selfmod.Attachments.HardActionDuration; - protected keyThresholdMaximum: GuildSettingsOfType = GuildSettings.Selfmod.Attachments.ThresholdMaximum; - protected keyThresholdDuration: GuildSettingsOfType = GuildSettings.Selfmod.Attachments.ThresholdDuration; -} diff --git a/src/commands/Management/Message Filters/capitals-mode.ts b/src/commands/Management/Message Filters/capitals-mode.ts new file mode 100644 index 00000000000..977dae98db9 --- /dev/null +++ b/src/commands/Management/Message Filters/capitals-mode.ts @@ -0,0 +1,22 @@ +import { GuildSettings, type AdderKey, type GuildSettingsOfType } from '#lib/database'; +import { LanguageKeys } from '#lib/i18n/languageKeys'; +import { SelfModerationCommand } from '#lib/moderation'; +import { ApplyOptions } from '@sapphire/decorators'; + +const Root = LanguageKeys.Commands.Management; +const SettingsRoot = GuildSettings.Selfmod.Capitals; + +@ApplyOptions({ + aliases: ['manage-capitals'], + description: Root.CapitalsModeDescription, + detailedDescription: Root.CapitalsModeExtended +}) +export class UserSelfModerationCommand extends SelfModerationCommand { + protected $adder: AdderKey = 'capitals'; + protected keyEnabled: GuildSettingsOfType = SettingsRoot.Enabled; + protected keySoftAction: GuildSettingsOfType = SettingsRoot.SoftAction; + protected keyHardAction: GuildSettingsOfType = SettingsRoot.HardAction; + protected keyHardActionDuration: GuildSettingsOfType = SettingsRoot.HardActionDuration; + protected keyThresholdMaximum: GuildSettingsOfType = SettingsRoot.ThresholdMaximum; + protected keyThresholdDuration: GuildSettingsOfType = SettingsRoot.ThresholdDuration; +} diff --git a/src/commands/Management/Message Filters/capitalsMode.ts b/src/commands/Management/Message Filters/capitalsMode.ts deleted file mode 100644 index 7d9b08802e9..00000000000 --- a/src/commands/Management/Message Filters/capitalsMode.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { GuildSettings, type AdderKey, type GuildSettingsOfType } from '#lib/database'; -import { LanguageKeys } from '#lib/i18n/languageKeys'; -import { SelfModerationCommand } from '#lib/moderation'; -import { ApplyOptions } from '@sapphire/decorators'; - -@ApplyOptions({ - aliases: ['capitals-mode', 'caps-mode'], - description: LanguageKeys.Commands.Management.CapitalsModeDescription, - detailedDescription: LanguageKeys.Commands.Management.CapitalsModeExtended -}) -export class UserSelfModerationCommand extends SelfModerationCommand { - protected $adder: AdderKey = 'capitals'; - protected keyEnabled: GuildSettingsOfType = GuildSettings.Selfmod.Capitals.Enabled; - protected keySoftAction: GuildSettingsOfType = GuildSettings.Selfmod.Capitals.SoftAction; - protected keyHardAction: GuildSettingsOfType = GuildSettings.Selfmod.Capitals.HardAction; - protected keyHardActionDuration: GuildSettingsOfType = GuildSettings.Selfmod.Capitals.HardActionDuration; - protected keyThresholdMaximum: GuildSettingsOfType = GuildSettings.Selfmod.Capitals.ThresholdMaximum; - protected keyThresholdDuration: GuildSettingsOfType = GuildSettings.Selfmod.Capitals.ThresholdDuration; -} diff --git a/src/commands/Management/Message Filters/filter-mode.ts b/src/commands/Management/Message Filters/filter-mode.ts new file mode 100644 index 00000000000..da273a76a80 --- /dev/null +++ b/src/commands/Management/Message Filters/filter-mode.ts @@ -0,0 +1,22 @@ +import { GuildSettings, type AdderKey, type GuildSettingsOfType } from '#lib/database'; +import { LanguageKeys } from '#lib/i18n/languageKeys'; +import { SelfModerationCommand } from '#lib/moderation'; +import { ApplyOptions } from '@sapphire/decorators'; + +const Root = LanguageKeys.Commands.Management; +const SettingsRoot = GuildSettings.Selfmod.Filter; + +@ApplyOptions({ + aliases: ['word-filter-mode', 'manage-filter'], + description: Root.FilterModeDescription, + detailedDescription: Root.FilterModeExtended +}) +export class UserSelfModerationCommand extends SelfModerationCommand { + protected $adder: AdderKey = 'words'; + protected keyEnabled: GuildSettingsOfType = SettingsRoot.Enabled; + protected keySoftAction: GuildSettingsOfType = SettingsRoot.SoftAction; + protected keyHardAction: GuildSettingsOfType = SettingsRoot.HardAction; + protected keyHardActionDuration: GuildSettingsOfType = SettingsRoot.HardActionDuration; + protected keyThresholdMaximum: GuildSettingsOfType = SettingsRoot.ThresholdMaximum; + protected keyThresholdDuration: GuildSettingsOfType = SettingsRoot.ThresholdDuration; +} diff --git a/src/commands/Management/Message Filters/filterMode.ts b/src/commands/Management/Message Filters/filterMode.ts deleted file mode 100644 index 513d433dceb..00000000000 --- a/src/commands/Management/Message Filters/filterMode.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { GuildSettings, type AdderKey, type GuildSettingsOfType } from '#lib/database'; -import { LanguageKeys } from '#lib/i18n/languageKeys'; -import { SelfModerationCommand } from '#lib/moderation'; -import { ApplyOptions } from '@sapphire/decorators'; - -@ApplyOptions({ - aliases: ['word-filter-mode'], - description: LanguageKeys.Commands.Management.FilterModeDescription, - detailedDescription: LanguageKeys.Commands.Management.FilterModeExtended -}) -export class UserSelfModerationCommand extends SelfModerationCommand { - protected $adder: AdderKey = 'words'; - protected keyEnabled: GuildSettingsOfType = GuildSettings.Selfmod.Filter.Enabled; - protected keySoftAction: GuildSettingsOfType = GuildSettings.Selfmod.Filter.SoftAction; - protected keyHardAction: GuildSettingsOfType = GuildSettings.Selfmod.Filter.HardAction; - protected keyHardActionDuration: GuildSettingsOfType = GuildSettings.Selfmod.Filter.HardActionDuration; - protected keyThresholdMaximum: GuildSettingsOfType = GuildSettings.Selfmod.Filter.ThresholdMaximum; - protected keyThresholdDuration: GuildSettingsOfType = GuildSettings.Selfmod.Filter.ThresholdDuration; -} diff --git a/src/commands/Management/Message Filters/invite-mode.ts b/src/commands/Management/Message Filters/invite-mode.ts new file mode 100644 index 00000000000..4c817ac63f1 --- /dev/null +++ b/src/commands/Management/Message Filters/invite-mode.ts @@ -0,0 +1,22 @@ +import { GuildSettings, type AdderKey, type GuildSettingsOfType } from '#lib/database'; +import { LanguageKeys } from '#lib/i18n/languageKeys'; +import { SelfModerationCommand } from '#lib/moderation'; +import { ApplyOptions } from '@sapphire/decorators'; + +const Root = LanguageKeys.Commands.Management; +const SettingsRoot = GuildSettings.Selfmod.Invites; + +@ApplyOptions({ + aliases: ['invites-mode', 'manage-invite', 'manage-invites'], + description: Root.InviteModeDescription, + detailedDescription: Root.InviteModeExtended +}) +export class UserSelfModerationCommand extends SelfModerationCommand { + protected $adder: AdderKey = 'invites'; + protected keyEnabled: GuildSettingsOfType = SettingsRoot.Enabled; + protected keySoftAction: GuildSettingsOfType = SettingsRoot.SoftAction; + protected keyHardAction: GuildSettingsOfType = SettingsRoot.HardAction; + protected keyHardActionDuration: GuildSettingsOfType = SettingsRoot.HardActionDuration; + protected keyThresholdMaximum: GuildSettingsOfType = SettingsRoot.ThresholdMaximum; + protected keyThresholdDuration: GuildSettingsOfType = SettingsRoot.ThresholdDuration; +} diff --git a/src/commands/Management/Message Filters/inviteMode.ts b/src/commands/Management/Message Filters/inviteMode.ts deleted file mode 100644 index c1958da4402..00000000000 --- a/src/commands/Management/Message Filters/inviteMode.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { GuildSettings, type AdderKey, type GuildSettingsOfType } from '#lib/database'; -import { LanguageKeys } from '#lib/i18n/languageKeys'; -import { SelfModerationCommand } from '#lib/moderation'; -import { ApplyOptions } from '@sapphire/decorators'; - -@ApplyOptions({ - aliases: ['invites-mode', 'inv-mode'], - description: LanguageKeys.Commands.Management.InviteModeDescription, - detailedDescription: LanguageKeys.Commands.Management.InviteModeExtended -}) -export class UserSelfModerationCommand extends SelfModerationCommand { - protected $adder: AdderKey = 'invites'; - protected keyEnabled: GuildSettingsOfType = GuildSettings.Selfmod.Invites.Enabled; - protected keySoftAction: GuildSettingsOfType = GuildSettings.Selfmod.Invites.SoftAction; - protected keyHardAction: GuildSettingsOfType = GuildSettings.Selfmod.Invites.HardAction; - protected keyHardActionDuration: GuildSettingsOfType = GuildSettings.Selfmod.Invites.HardActionDuration; - protected keyThresholdMaximum: GuildSettingsOfType = GuildSettings.Selfmod.Invites.ThresholdMaximum; - protected keyThresholdDuration: GuildSettingsOfType = GuildSettings.Selfmod.Invites.ThresholdDuration; -} diff --git a/src/commands/Management/Message Filters/link-mode.ts b/src/commands/Management/Message Filters/link-mode.ts new file mode 100644 index 00000000000..f7c4d04014b --- /dev/null +++ b/src/commands/Management/Message Filters/link-mode.ts @@ -0,0 +1,22 @@ +import { GuildSettings, type AdderKey, type GuildSettingsOfType } from '#lib/database'; +import { LanguageKeys } from '#lib/i18n/languageKeys'; +import { SelfModerationCommand } from '#lib/moderation'; +import { ApplyOptions } from '@sapphire/decorators'; + +const Root = LanguageKeys.Commands.Management; +const SettingsRoot = GuildSettings.Selfmod.Links; + +@ApplyOptions({ + aliases: ['links-mode', 'manage-link', 'manage-links'], + description: Root.LinkModeDescription, + detailedDescription: Root.LinkModeExtended +}) +export class UserSelfModerationCommand extends SelfModerationCommand { + protected $adder: AdderKey = 'links'; + protected keyEnabled: GuildSettingsOfType = SettingsRoot.Enabled; + protected keySoftAction: GuildSettingsOfType = SettingsRoot.SoftAction; + protected keyHardAction: GuildSettingsOfType = SettingsRoot.HardAction; + protected keyHardActionDuration: GuildSettingsOfType = SettingsRoot.HardActionDuration; + protected keyThresholdMaximum: GuildSettingsOfType = SettingsRoot.ThresholdMaximum; + protected keyThresholdDuration: GuildSettingsOfType = SettingsRoot.ThresholdDuration; +} diff --git a/src/commands/Management/Message Filters/linkMode.ts b/src/commands/Management/Message Filters/linkMode.ts deleted file mode 100644 index 2b7c894dbe6..00000000000 --- a/src/commands/Management/Message Filters/linkMode.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { GuildSettings, type AdderKey, type GuildSettingsOfType } from '#lib/database'; -import { LanguageKeys } from '#lib/i18n/languageKeys'; -import { SelfModerationCommand } from '#lib/moderation'; -import { ApplyOptions } from '@sapphire/decorators'; - -@ApplyOptions({ - aliases: ['link-mode', 'lmode', 'linkfilter', 'extlinks', 'externallinks'], - description: LanguageKeys.Commands.Management.LinkModeDescription, - detailedDescription: LanguageKeys.Commands.Management.LinkModeExtended -}) -export class UserSelfModerationCommand extends SelfModerationCommand { - protected $adder: AdderKey = 'links'; - protected keyEnabled: GuildSettingsOfType = GuildSettings.Selfmod.Links.Enabled; - protected keySoftAction: GuildSettingsOfType = GuildSettings.Selfmod.Links.SoftAction; - protected keyHardAction: GuildSettingsOfType = GuildSettings.Selfmod.Links.HardAction; - protected keyHardActionDuration: GuildSettingsOfType = GuildSettings.Selfmod.Links.HardActionDuration; - protected keyThresholdMaximum: GuildSettingsOfType = GuildSettings.Selfmod.Links.ThresholdMaximum; - protected keyThresholdDuration: GuildSettingsOfType = GuildSettings.Selfmod.Links.ThresholdDuration; -} diff --git a/src/commands/Management/Message Filters/message-mode.ts b/src/commands/Management/Message Filters/message-mode.ts new file mode 100644 index 00000000000..af86c6d52fa --- /dev/null +++ b/src/commands/Management/Message Filters/message-mode.ts @@ -0,0 +1,22 @@ +import { GuildSettings, type AdderKey, type GuildSettingsOfType } from '#lib/database'; +import { LanguageKeys } from '#lib/i18n/languageKeys'; +import { SelfModerationCommand } from '#lib/moderation'; +import { ApplyOptions } from '@sapphire/decorators'; + +const Root = LanguageKeys.Commands.Management; +const SettingsRoot = GuildSettings.Selfmod.Messages; + +@ApplyOptions({ + aliases: ['messages-mode', 'manage-message', 'manage-messages'], + description: Root.MessageModeDescription, + detailedDescription: Root.MessageModeExtended +}) +export class UserSelfModerationCommand extends SelfModerationCommand { + protected $adder: AdderKey = 'messages'; + protected keyEnabled: GuildSettingsOfType = SettingsRoot.Enabled; + protected keySoftAction: GuildSettingsOfType = SettingsRoot.SoftAction; + protected keyHardAction: GuildSettingsOfType = SettingsRoot.HardAction; + protected keyHardActionDuration: GuildSettingsOfType = SettingsRoot.HardActionDuration; + protected keyThresholdMaximum: GuildSettingsOfType = SettingsRoot.ThresholdMaximum; + protected keyThresholdDuration: GuildSettingsOfType = SettingsRoot.ThresholdDuration; +} diff --git a/src/commands/Management/Message Filters/messageMode.ts b/src/commands/Management/Message Filters/messageMode.ts deleted file mode 100644 index 2d68d9f4640..00000000000 --- a/src/commands/Management/Message Filters/messageMode.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { GuildSettings, type AdderKey, type GuildSettingsOfType } from '#lib/database'; -import { LanguageKeys } from '#lib/i18n/languageKeys'; -import { SelfModerationCommand } from '#lib/moderation'; -import { ApplyOptions } from '@sapphire/decorators'; - -@ApplyOptions({ - aliases: ['message-mode', 'msg-mode', 'm-mode'], - description: LanguageKeys.Commands.Management.MessageModeDescription, - detailedDescription: LanguageKeys.Commands.Management.MessageModeExtended -}) -export class UserSelfModerationCommand extends SelfModerationCommand { - protected $adder: AdderKey = 'messages'; - protected keyEnabled: GuildSettingsOfType = GuildSettings.Selfmod.Messages.Enabled; - protected keySoftAction: GuildSettingsOfType = GuildSettings.Selfmod.Messages.SoftAction; - protected keyHardAction: GuildSettingsOfType = GuildSettings.Selfmod.Messages.HardAction; - protected keyHardActionDuration: GuildSettingsOfType = GuildSettings.Selfmod.Messages.HardActionDuration; - protected keyThresholdMaximum: GuildSettingsOfType = GuildSettings.Selfmod.Messages.ThresholdMaximum; - protected keyThresholdDuration: GuildSettingsOfType = GuildSettings.Selfmod.Messages.ThresholdDuration; -} diff --git a/src/commands/Management/Message Filters/newline-mode.ts b/src/commands/Management/Message Filters/newline-mode.ts new file mode 100644 index 00000000000..d59f29896d9 --- /dev/null +++ b/src/commands/Management/Message Filters/newline-mode.ts @@ -0,0 +1,22 @@ +import { GuildSettings, type AdderKey, type GuildSettingsOfType } from '#lib/database'; +import { LanguageKeys } from '#lib/i18n/languageKeys'; +import { SelfModerationCommand } from '#lib/moderation'; +import { ApplyOptions } from '@sapphire/decorators'; + +const Root = LanguageKeys.Commands.Management; +const SettingsRoot = GuildSettings.Selfmod.NewLines; + +@ApplyOptions({ + aliases: ['newlines-mode', 'manage-newline', 'manage-newlines'], + description: Root.NewlineModeDescription, + detailedDescription: Root.NewlineModeExtended +}) +export class UserSelfModerationCommand extends SelfModerationCommand { + protected $adder: AdderKey = 'newlines'; + protected keyEnabled: GuildSettingsOfType = SettingsRoot.Enabled; + protected keySoftAction: GuildSettingsOfType = SettingsRoot.SoftAction; + protected keyHardAction: GuildSettingsOfType = SettingsRoot.HardAction; + protected keyHardActionDuration: GuildSettingsOfType = SettingsRoot.HardActionDuration; + protected keyThresholdMaximum: GuildSettingsOfType = SettingsRoot.ThresholdMaximum; + protected keyThresholdDuration: GuildSettingsOfType = SettingsRoot.ThresholdDuration; +} diff --git a/src/commands/Management/Message Filters/newlineMode.ts b/src/commands/Management/Message Filters/newlineMode.ts deleted file mode 100644 index ec2b9b172a9..00000000000 --- a/src/commands/Management/Message Filters/newlineMode.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { GuildSettings, type AdderKey, type GuildSettingsOfType } from '#lib/database'; -import { LanguageKeys } from '#lib/i18n/languageKeys'; -import { SelfModerationCommand } from '#lib/moderation'; -import { ApplyOptions } from '@sapphire/decorators'; - -@ApplyOptions({ - aliases: ['newline-mode', 'nl-mode'], - description: LanguageKeys.Commands.Management.NewlineModeDescription, - detailedDescription: LanguageKeys.Commands.Management.NewlineModeExtended -}) -export class UserSelfModerationCommand extends SelfModerationCommand { - protected $adder: AdderKey = 'newlines'; - protected keyEnabled: GuildSettingsOfType = GuildSettings.Selfmod.NewLines.Enabled; - protected keySoftAction: GuildSettingsOfType = GuildSettings.Selfmod.NewLines.SoftAction; - protected keyHardAction: GuildSettingsOfType = GuildSettings.Selfmod.NewLines.HardAction; - protected keyHardActionDuration: GuildSettingsOfType = GuildSettings.Selfmod.NewLines.HardActionDuration; - protected keyThresholdMaximum: GuildSettingsOfType = GuildSettings.Selfmod.NewLines.ThresholdMaximum; - protected keyThresholdDuration: GuildSettingsOfType = GuildSettings.Selfmod.NewLines.ThresholdDuration; -} diff --git a/src/commands/Management/settings-moderation.ts b/src/commands/Management/settings-moderation.ts new file mode 100644 index 00000000000..b9f38a867ce --- /dev/null +++ b/src/commands/Management/settings-moderation.ts @@ -0,0 +1,123 @@ +import { LanguageKeys } from '#lib/i18n/languageKeys'; +import { SkyraCommand } from '#lib/structures'; +import { SlashCommandSubcommandBuilder } from '@discordjs/builders'; +import { ApplyOptions } from '@sapphire/decorators'; +import type { ApplicationCommandRegistry } from '@sapphire/framework'; +import { applyLocalizedBuilder, createLocalizedChoice } from '@sapphire/plugin-i18next'; +import { ChannelType, ChatInputCommandInteraction, PermissionFlagsBits } from 'discord.js'; + +const Root = LanguageKeys.Commands.SettingsModeration; + +type Action = 'edit' | 'reset' | 'view'; +type Module = 'attachment' | 'uppercase' | 'invite' | 'link' | 'filter' | 'newline' | 'duplicated-messages'; + +@ApplyOptions({ + description: Root.Description, + detailedDescription: LanguageKeys.Commands.Shared.SlashOnlyDetailedDescription, + requiredClientPermissions: [PermissionFlagsBits.EmbedLinks], + hidden: true +}) +export class UserCommand extends SkyraCommand { + public override async messageRun() { + this.error(LanguageKeys.Commands.Shared.SlashOnlyErrorMessage); + } + + public override async chatInputRun(interaction: ChatInputCommandInteraction) { + const action = interaction.options.getSubcommandGroup(true) as Action; + const module = interaction.options.getSubcommand(true) as Module; + + return interaction.reply({ content: `Action: ${action}, Module: ${module}` }); + } + + public override registerApplicationCommands(registry: ApplicationCommandRegistry) { + function makeSubcommand(root: string) { + return ( + applyLocalizedBuilder(new SlashCommandSubcommandBuilder(), root) + // enabled + .addBooleanOption((option) => applyLocalizedBuilder(option, Root.EnabledName, Root.EnabledDescription)) + // on-infraction-alert + .addBooleanOption((option) => applyLocalizedBuilder(option, Root.OnInfractionAlertName, Root.OnInfractionAlertDescription)) + // on-infraction-log + .addChannelOption((option) => + applyLocalizedBuilder(option, Root.OnInfractionLogName, Root.OnInfractionLogDescription).addChannelTypes( + ChannelType.GuildText, + ChannelType.GuildAnnouncement, + ChannelType.AnnouncementThread, + ChannelType.PublicThread, + ChannelType.PrivateThread + ) + ) + // on-infraction-delete + .addBooleanOption((option) => applyLocalizedBuilder(option, Root.OnInfractionDeleteName, Root.OnInfractionDeleteDescription)) + // on-threshold + .addStringOption((option) => + applyLocalizedBuilder(option, Root.OnThresholdName, Root.OnThresholdDescription).addChoices( + createLocalizedChoice(Root.PenaltyNone, { value: 'none' }), + createLocalizedChoice(Root.PenaltyWarning, { value: 'warning' }), + createLocalizedChoice(Root.PenaltyMute, { value: 'mute' }), + createLocalizedChoice(Root.PenaltyKick, { value: 'kick' }), + createLocalizedChoice(Root.PenaltySoftBan, { value: 'softBan' }), + createLocalizedChoice(Root.PenaltyBan, { value: 'ban' }) + ) + ) + // penalty-duration + .addStringOption((option) => applyLocalizedBuilder(option, Root.PenaltyDurationName, Root.PenaltyDurationDescription)) + // threshold-maximum + .addIntegerOption((option) => applyLocalizedBuilder(option, Root.ThresholdMaximumName, Root.ThresholdMaximumDescription)) + // threshold-expiration + .addStringOption((option) => applyLocalizedBuilder(option, Root.ThresholdExpirationName, Root.ThresholdExpirationDescription)) + ); + } + + function makeResetSubcommand(root: string) { + return applyLocalizedBuilder(new SlashCommandSubcommandBuilder(), root) + .addBooleanOption((option) => applyLocalizedBuilder(option, Root.EnabledName, Root.EnabledResetDescription)) + .addBooleanOption((option) => applyLocalizedBuilder(option, Root.OnInfractionAlertName, Root.OnInfractionAlertResetDescription)) + .addBooleanOption((option) => applyLocalizedBuilder(option, Root.OnInfractionLogName, Root.OnInfractionLogResetDescription)) + .addBooleanOption((option) => applyLocalizedBuilder(option, Root.OnInfractionDeleteName, Root.OnInfractionDeleteResetDescription)) + .addBooleanOption((option) => applyLocalizedBuilder(option, Root.OnThresholdName, Root.OnThresholdResetDescription)) + .addBooleanOption((option) => applyLocalizedBuilder(option, Root.PenaltyDurationName, Root.PenaltyDurationResetDescription)) + .addBooleanOption((option) => applyLocalizedBuilder(option, Root.ThresholdMaximumName, Root.ThresholdMaximumResetDescription)) + .addBooleanOption((option) => applyLocalizedBuilder(option, Root.ThresholdExpirationName, Root.ThresholdExpirationResetDescription)); + } + + registry.registerChatInputCommand((builder) => + applyLocalizedBuilder(builder, Root.Name, Root.Description) // + // auto-moderation set + .addSubcommandGroup((group) => + applyLocalizedBuilder(group, Root.Edit) + .addSubcommand(makeSubcommand(Root.Attachment)) + .addSubcommand(makeSubcommand(Root.Uppercase)) + .addSubcommand(makeSubcommand(Root.Invite)) + .addSubcommand(makeSubcommand(Root.Link)) + .addSubcommand(makeSubcommand(Root.Filter)) + .addSubcommand(makeSubcommand(Root.Newline)) + .addSubcommand(makeSubcommand(Root.DuplicatedMessages)) + ) + // auto-moderation reset + .addSubcommandGroup((group) => + applyLocalizedBuilder(group, Root.Reset) + .addSubcommand(makeResetSubcommand(Root.Attachment)) + .addSubcommand(makeResetSubcommand(Root.Uppercase)) + .addSubcommand(makeResetSubcommand(Root.Invite)) + .addSubcommand(makeResetSubcommand(Root.Link)) + .addSubcommand(makeResetSubcommand(Root.Filter)) + .addSubcommand(makeResetSubcommand(Root.Newline)) + .addSubcommand(makeResetSubcommand(Root.DuplicatedMessages)) + ) + // auto-moderation view + .addSubcommandGroup((group) => + applyLocalizedBuilder(group, Root.View) + .addSubcommand((subcommand) => applyLocalizedBuilder(subcommand, Root.Attachment)) + .addSubcommand((subcommand) => applyLocalizedBuilder(subcommand, Root.Uppercase)) + .addSubcommand((subcommand) => applyLocalizedBuilder(subcommand, Root.Invite)) + .addSubcommand((subcommand) => applyLocalizedBuilder(subcommand, Root.Link)) + .addSubcommand((subcommand) => applyLocalizedBuilder(subcommand, Root.Filter)) + .addSubcommand((subcommand) => applyLocalizedBuilder(subcommand, Root.Newline)) + .addSubcommand((subcommand) => applyLocalizedBuilder(subcommand, Root.DuplicatedMessages)) + ) + .setDMPermission(false) + .setDefaultMemberPermissions(PermissionFlagsBits.ManageGuild) + ); + } +} diff --git a/src/languages/en-US/commands/settings-moderation.json b/src/languages/en-US/commands/settings-moderation.json new file mode 100644 index 00000000000..106f6a81c4b --- /dev/null +++ b/src/languages/en-US/commands/settings-moderation.json @@ -0,0 +1,54 @@ +{ + "name": "settings-moderation", + "description": "Manages the auto-moderation settings for this server", + "editName": "edit", + "editDescription": "Edit a setting value", + "resetName": "reset", + "resetDescription": "Reset a setting value to its default", + "viewName": "view", + "viewDescription": "View the current settings", + "attachmentName": "attachment", + "attachmentDescription": "The settings for when a user uploads an attachment", + "uppercaseName": "uppercase", + "uppercaseDescription": "The settings for when a user sends a message with too many uppercase letters", + "inviteName": "invite", + "inviteDescription": "The settings for when a user sends an invite link", + "linkName": "link", + "linkDescription": "The settings for when a user sends a link", + "filterName": "filter", + "filterDescription": "The settings for when a user sends a filtered word", + "newlineName": "newline", + "newlineDescription": "The settings for when a user sends too many newlines", + "duplicatedMessagesName": "duplicated-messages", + "duplicatedMessagesDescription": "The settings for when users send too many duplicated messages", + "enabledName": "enabled", + "enabledDescription": "Whether or not this system is enabled", + "enabledResetDescription": "Reset to the default value (False)", + "onInfractionAlertName": "on-infraction-alert", + "onInfractionAlertDescription": "Whether or not to send an alert when a user is infracted", + "onInfractionAlertResetDescription": "Reset to the default value (False)", + "onInfractionLogName": "on-infraction-log", + "onInfractionLogDescription": "The channel to log infractions at", + "onInfractionLogResetDescription": "Reset to the default value (None)", + "onInfractionDeleteName": "on-infraction-delete", + "onInfractionDeleteDescription": "Whether or not to delete the message when a user is infracted", + "onInfractionDeleteResetDescription": "Reset to the default value (False)", + "onThresholdName": "on-threshold", + "onThresholdDescription": "The penalty to apply when a user reaches the threshold", + "onThresholdResetDescription": "Reset to the default value (None)", + "penaltyDurationName": "penalty-duration", + "penaltyDurationDescription": "The duration of the applied penalty, if available", + "penaltyDurationResetDescription": "Reset to the default value (None)", + "thresholdMaximumName": "threshold-maximum", + "thresholdMaximumDescription": "The maximum number of infractions a user can have before the threshold is reached", + "thresholdMaximumResetDescription": "Reset to the default value", + "thresholdExpirationName": "threshold-expiration", + "thresholdExpirationDescription": "The amount of time before the threshold expires", + "thresholdExpirationResetDescription": "Reset to the default value", + "penaltyNone": "None", + "penaltyWarning": "Warning", + "penaltyMute": "Mute", + "penaltyKick": "Kick", + "penaltySoftBan": "SoftBan", + "penaltyBan": "Ban" +} diff --git a/src/languages/en-US/commands/shared.json b/src/languages/en-US/commands/shared.json index 559f6c83ca6..b1ffdf25072 100644 --- a/src/languages/en-US/commands/shared.json +++ b/src/languages/en-US/commands/shared.json @@ -1,3 +1,7 @@ { - "deprecatedMessage": "Message based commands are **deprecated**, and will be removed in the future. You should use the {{command}} slash command instead!" + "deprecatedMessage": "Message based commands are **deprecated**, and will be removed in the future. You should use the {{command}} slash command instead!", + "slashOnlyDetailedDescription": { + "extendedHelp": "This command is only available via slash commands. Please use the slash command instead." + }, + "slashOnlyErrorMessage": "This command is only available via slash commands. Please use the slash command instead." } diff --git a/src/lib/i18n/languageKeys/keys/Commands.ts b/src/lib/i18n/languageKeys/keys/Commands.ts index 60beee2bcf5..d34a001ec93 100644 --- a/src/lib/i18n/languageKeys/keys/Commands.ts +++ b/src/lib/i18n/languageKeys/keys/Commands.ts @@ -6,6 +6,7 @@ export * as General from '#lib/i18n/languageKeys/keys/commands/General'; export * as Management from '#lib/i18n/languageKeys/keys/commands/Management'; export * as Misc from '#lib/i18n/languageKeys/keys/commands/Misc'; export * as Moderation from '#lib/i18n/languageKeys/keys/commands/Moderation'; +export * as SettingsModeration from '#lib/i18n/languageKeys/keys/commands/SettingsModeration'; export * as Shared from '#lib/i18n/languageKeys/keys/commands/Shared'; export * as System from '#lib/i18n/languageKeys/keys/commands/System'; export * as Tools from '#lib/i18n/languageKeys/keys/commands/Tools'; diff --git a/src/lib/i18n/languageKeys/keys/commands/SettingsModeration.ts b/src/lib/i18n/languageKeys/keys/commands/SettingsModeration.ts new file mode 100644 index 00000000000..d6fc1a1d783 --- /dev/null +++ b/src/lib/i18n/languageKeys/keys/commands/SettingsModeration.ts @@ -0,0 +1,54 @@ +import { T } from '#lib/types'; + +// Root +export const Name = T('commands/settings-moderation:name'); +export const Description = T('commands/settings-moderation:description'); + +// Subcommand Groups +export const Edit = 'commands/settings-moderation:edit'; +export const Reset = 'commands/settings-moderation:reset'; +export const View = 'commands/settings-moderation:view'; + +// Subcommands +export const Attachment = 'commands/settings-moderation:attachment'; +export const Uppercase = 'commands/settings-moderation:uppercase'; +export const Invite = 'commands/settings-moderation:invite'; +export const Link = 'commands/settings-moderation:link'; +export const Filter = 'commands/settings-moderation:filter'; +export const Newline = 'commands/settings-moderation:newline'; +export const DuplicatedMessages = 'commands/settings-moderation:duplicatedMessages'; + +// Options +export const EnabledName = T('commands/settings-moderation:enabledName'); +export const EnabledDescription = T('commands/settings-moderation:enabledDescription'); +export const OnInfractionAlertName = T('commands/settings-moderation:onInfractionAlertName'); +export const OnInfractionAlertDescription = T('commands/settings-moderation:onInfractionAlertDescription'); +export const OnInfractionLogName = T('commands/settings-moderation:onInfractionLogName'); +export const OnInfractionLogDescription = T('commands/settings-moderation:onInfractionLogDescription'); +export const OnInfractionDeleteName = T('commands/settings-moderation:onInfractionDeleteName'); +export const OnInfractionDeleteDescription = T('commands/settings-moderation:onInfractionDeleteDescription'); +export const OnThresholdName = T('commands/settings-moderation:onThresholdName'); +export const OnThresholdDescription = T('commands/settings-moderation:onThresholdDescription'); +export const PenaltyDurationName = T('commands/settings-moderation:penaltyDurationName'); +export const PenaltyDurationDescription = T('commands/settings-moderation:penaltyDurationDescription'); +export const ThresholdMaximumName = T('commands/settings-moderation:thresholdMaximumName'); +export const ThresholdMaximumDescription = T('commands/settings-moderation:thresholdMaximumDescription'); +export const ThresholdExpirationName = T('commands/settings-moderation:thresholdExpirationName'); +export const ThresholdExpirationDescription = T('commands/settings-moderation:thresholdExpirationDescription'); + +export const EnabledResetDescription = T('commands/settings-moderation:enabledResetDescription'); +export const OnInfractionAlertResetDescription = T('commands/settings-moderation:onInfractionAlertResetDescription'); +export const OnInfractionLogResetDescription = T('commands/settings-moderation:onInfractionLogResetDescription'); +export const OnInfractionDeleteResetDescription = T('commands/settings-moderation:onInfractionDeleteResetDescription'); +export const OnThresholdResetDescription = T('commands/settings-moderation:onThresholdResetDescription'); +export const PenaltyDurationResetDescription = T('commands/settings-moderation:penaltyDurationResetDescription'); +export const ThresholdMaximumResetDescription = T('commands/settings-moderation:thresholdMaximumResetDescription'); +export const ThresholdExpirationResetDescription = T('commands/settings-moderation:thresholdExpirationResetDescription'); + +// Penalties +export const PenaltyNone = T('commands/settings-moderation:penaltyNone'); +export const PenaltyWarning = T('commands/settings-moderation:penaltyWarning'); +export const PenaltyMute = T('commands/settings-moderation:penaltyMute'); +export const PenaltyKick = T('commands/settings-moderation:penaltyKick'); +export const PenaltySoftBan = T('commands/settings-moderation:penaltySoftBan'); +export const PenaltyBan = T('commands/settings-moderation:penaltyBan'); diff --git a/src/lib/i18n/languageKeys/keys/commands/Shared.ts b/src/lib/i18n/languageKeys/keys/commands/Shared.ts index d4e7ca56af2..2b38ed81fec 100644 --- a/src/lib/i18n/languageKeys/keys/commands/Shared.ts +++ b/src/lib/i18n/languageKeys/keys/commands/Shared.ts @@ -1,3 +1,6 @@ -import { FT } from '#lib/types'; +import type { LanguageHelpDisplayOptions } from '#lib/i18n/LanguageHelp'; +import { FT, T } from '#lib/types'; export const DeprecatedMessage = FT<{ command: string }>('commands/shared:deprecatedMessage'); +export const SlashOnlyDetailedDescription = T('commands/shared:slashOnlyDetailedDescription'); +export const SlashOnlyErrorMessage = T('commands/shared:slashOnlyErrorMessage');