Skip to content

Commit

Permalink
refactor: streamline moderation settings commands
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranet committed Mar 14, 2024
1 parent b2fe180 commit 9ade9de
Show file tree
Hide file tree
Showing 20 changed files with 395 additions and 135 deletions.
22 changes: 22 additions & 0 deletions src/commands/Management/Message Filters/attachment-mode.ts
Original file line number Diff line number Diff line change
@@ -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<SelfModerationCommand.Options>({
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<boolean> = SettingsRoot.Enabled;
protected keySoftAction: GuildSettingsOfType<number> = SettingsRoot.SoftAction;
protected keyHardAction: GuildSettingsOfType<number | null> = SettingsRoot.HardAction;
protected keyHardActionDuration: GuildSettingsOfType<number | null> = SettingsRoot.HardActionDuration;
protected keyThresholdMaximum: GuildSettingsOfType<number | null> = SettingsRoot.ThresholdMaximum;
protected keyThresholdDuration: GuildSettingsOfType<number | null> = SettingsRoot.ThresholdDuration;
}
19 changes: 0 additions & 19 deletions src/commands/Management/Message Filters/attachmentMode.ts

This file was deleted.

22 changes: 22 additions & 0 deletions src/commands/Management/Message Filters/capitals-mode.ts
Original file line number Diff line number Diff line change
@@ -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<SelfModerationCommand.Options>({
aliases: ['manage-capitals'],
description: Root.CapitalsModeDescription,
detailedDescription: Root.CapitalsModeExtended
})
export class UserSelfModerationCommand extends SelfModerationCommand {
protected $adder: AdderKey = 'capitals';
protected keyEnabled: GuildSettingsOfType<boolean> = SettingsRoot.Enabled;
protected keySoftAction: GuildSettingsOfType<number> = SettingsRoot.SoftAction;
protected keyHardAction: GuildSettingsOfType<number | null> = SettingsRoot.HardAction;
protected keyHardActionDuration: GuildSettingsOfType<number | null> = SettingsRoot.HardActionDuration;
protected keyThresholdMaximum: GuildSettingsOfType<number | null> = SettingsRoot.ThresholdMaximum;
protected keyThresholdDuration: GuildSettingsOfType<number | null> = SettingsRoot.ThresholdDuration;
}
19 changes: 0 additions & 19 deletions src/commands/Management/Message Filters/capitalsMode.ts

This file was deleted.

22 changes: 22 additions & 0 deletions src/commands/Management/Message Filters/filter-mode.ts
Original file line number Diff line number Diff line change
@@ -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<SelfModerationCommand.Options>({
aliases: ['word-filter-mode', 'manage-filter'],
description: Root.FilterModeDescription,
detailedDescription: Root.FilterModeExtended
})
export class UserSelfModerationCommand extends SelfModerationCommand {
protected $adder: AdderKey = 'words';
protected keyEnabled: GuildSettingsOfType<boolean> = SettingsRoot.Enabled;
protected keySoftAction: GuildSettingsOfType<number> = SettingsRoot.SoftAction;
protected keyHardAction: GuildSettingsOfType<number | null> = SettingsRoot.HardAction;
protected keyHardActionDuration: GuildSettingsOfType<number | null> = SettingsRoot.HardActionDuration;
protected keyThresholdMaximum: GuildSettingsOfType<number | null> = SettingsRoot.ThresholdMaximum;
protected keyThresholdDuration: GuildSettingsOfType<number | null> = SettingsRoot.ThresholdDuration;
}
19 changes: 0 additions & 19 deletions src/commands/Management/Message Filters/filterMode.ts

This file was deleted.

22 changes: 22 additions & 0 deletions src/commands/Management/Message Filters/invite-mode.ts
Original file line number Diff line number Diff line change
@@ -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<SelfModerationCommand.Options>({
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<boolean> = SettingsRoot.Enabled;
protected keySoftAction: GuildSettingsOfType<number> = SettingsRoot.SoftAction;
protected keyHardAction: GuildSettingsOfType<number | null> = SettingsRoot.HardAction;
protected keyHardActionDuration: GuildSettingsOfType<number | null> = SettingsRoot.HardActionDuration;
protected keyThresholdMaximum: GuildSettingsOfType<number | null> = SettingsRoot.ThresholdMaximum;
protected keyThresholdDuration: GuildSettingsOfType<number | null> = SettingsRoot.ThresholdDuration;
}
19 changes: 0 additions & 19 deletions src/commands/Management/Message Filters/inviteMode.ts

This file was deleted.

22 changes: 22 additions & 0 deletions src/commands/Management/Message Filters/link-mode.ts
Original file line number Diff line number Diff line change
@@ -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<SelfModerationCommand.Options>({
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<boolean> = SettingsRoot.Enabled;
protected keySoftAction: GuildSettingsOfType<number> = SettingsRoot.SoftAction;
protected keyHardAction: GuildSettingsOfType<number | null> = SettingsRoot.HardAction;
protected keyHardActionDuration: GuildSettingsOfType<number | null> = SettingsRoot.HardActionDuration;
protected keyThresholdMaximum: GuildSettingsOfType<number | null> = SettingsRoot.ThresholdMaximum;
protected keyThresholdDuration: GuildSettingsOfType<number | null> = SettingsRoot.ThresholdDuration;
}
19 changes: 0 additions & 19 deletions src/commands/Management/Message Filters/linkMode.ts

This file was deleted.

22 changes: 22 additions & 0 deletions src/commands/Management/Message Filters/message-mode.ts
Original file line number Diff line number Diff line change
@@ -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<SelfModerationCommand.Options>({
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<boolean> = SettingsRoot.Enabled;
protected keySoftAction: GuildSettingsOfType<number> = SettingsRoot.SoftAction;
protected keyHardAction: GuildSettingsOfType<number | null> = SettingsRoot.HardAction;
protected keyHardActionDuration: GuildSettingsOfType<number | null> = SettingsRoot.HardActionDuration;
protected keyThresholdMaximum: GuildSettingsOfType<number | null> = SettingsRoot.ThresholdMaximum;
protected keyThresholdDuration: GuildSettingsOfType<number | null> = SettingsRoot.ThresholdDuration;
}
19 changes: 0 additions & 19 deletions src/commands/Management/Message Filters/messageMode.ts

This file was deleted.

22 changes: 22 additions & 0 deletions src/commands/Management/Message Filters/newline-mode.ts
Original file line number Diff line number Diff line change
@@ -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<SelfModerationCommand.Options>({
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<boolean> = SettingsRoot.Enabled;
protected keySoftAction: GuildSettingsOfType<number> = SettingsRoot.SoftAction;
protected keyHardAction: GuildSettingsOfType<number | null> = SettingsRoot.HardAction;
protected keyHardActionDuration: GuildSettingsOfType<number | null> = SettingsRoot.HardActionDuration;
protected keyThresholdMaximum: GuildSettingsOfType<number | null> = SettingsRoot.ThresholdMaximum;
protected keyThresholdDuration: GuildSettingsOfType<number | null> = SettingsRoot.ThresholdDuration;
}
19 changes: 0 additions & 19 deletions src/commands/Management/Message Filters/newlineMode.ts

This file was deleted.

Loading

0 comments on commit 9ade9de

Please sign in to comment.