aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/moderation')
-rw-r--r--src/commands/moderation/_activePunishments.ts151
-rw-r--r--src/commands/moderation/ban.ts6
-rw-r--r--src/commands/moderation/block.ts4
-rw-r--r--src/commands/moderation/evidence.ts6
-rw-r--r--src/commands/moderation/lockdown.ts10
-rw-r--r--src/commands/moderation/massBan.ts4
-rw-r--r--src/commands/moderation/massEvidence.ts4
-rw-r--r--src/commands/moderation/mute.ts4
-rw-r--r--src/commands/moderation/role.ts4
-rw-r--r--src/commands/moderation/unban.ts4
-rw-r--r--src/commands/moderation/unblock.ts4
-rw-r--r--src/commands/moderation/unlockdown.ts6
-rw-r--r--src/commands/moderation/unmute.ts4
-rw-r--r--src/commands/moderation/untimeout.ts4
-rw-r--r--src/commands/moderation/warn.ts4
15 files changed, 110 insertions, 109 deletions
diff --git a/src/commands/moderation/_activePunishments.ts b/src/commands/moderation/_activePunishments.ts
index cffc39f..e751493 100644
--- a/src/commands/moderation/_activePunishments.ts
+++ b/src/commands/moderation/_activePunishments.ts
@@ -1,78 +1,79 @@
-// import { BushCommand, ModLog, ModLogModel, type BushGuildMember, type BushMessage, type BushSlashMessage } from '#lib';
-// import { FindOptions, Op } from 'sequelize';
-// import { Permissions } from 'discord.js';
+/* import { BushCommand, ModLog, ModLogModel, type BushGuildMember, type BushMessage, type BushSlashMessage } from '#lib';
+import { FindOptions, Op } from 'sequelize';
+import { Permissions } from 'discord.js';
-// const punishmentTypes = ['ban', 'kick', 'mute', 'warn', 'role'] as const;
+const punishmentTypes = ['ban', 'kick', 'mute', 'warn', 'role'] as const;
-// export default class ActivePunishmentsCommand extends BushCommand {
-// public constructor() {
-// super('activePunishments', {
-// aliases: ['active-punishments', 'ap'],
-// category: 'moderation',
-// description: 'Gets a list of all the active punishment in the server.',
-// usage: [`active-punishments [--moderator <user>] [--type <${punishmentTypes.map((v) => `'${v}'`).join('|')}>]`],
-// examples: ['active-punishments'],
-// args: [
-// {
-// id: 'moderator',
-// description: 'Only show active punishments by this moderator.',
-// type: 'user',
-// match: 'option',
-// prompt: 'Only show active punishments from what user?',
-// optional: true,
-// slashType: ApplicationCommandOptionType.User,
-// slashResolve: 'Member'
-// },
-// {
-// id: 'type',
-// description: 'Only show active punishments of this type.',
-// customType: [...punishmentTypes],
-// readableType: punishmentTypes.map((v) => `'${v}'`).join('|'),
-// match: 'option',
-// optional: true,
-// slashType: ApplicationCommandOptionType.String,
-// choices: punishmentTypes.map((v) => ({ name: v, value: v }))
-// }
-// ],
-// slash: true,
-// channel: 'guild',
-// hidden: true,
-// clientPermissions: (m) => util.clientSendAndPermCheck(m),
-// userPermissions: (m) => util.userGuildPermCheck(m, [PermissionFlagsBits.ManageMessages])
-// });
-// }
-//
-// public override async exec(
-// message: BushMessage | BushSlashMessage,
-// args: { moderator?: BushGuildMember; type: typeof punishmentTypes[number] }
-// ) {
-// const where: FindOptions<ModLogModel>['where'] = { guild: message.guild!.id };
-// if (args.moderator?.id) where.user = args.moderator.id;
-// if (args.type) {
-// switch (args.type) {
-// case 'ban':
-// where.type = { [Op.or]: ['PERM_BAN', 'TEMP_BAN', 'UNBAN'] };
-// break;
-// case 'kick':
-// where.type = { [Op.or]: ['KICK'] };
-// break;
-// case 'mute':
-// where.type = { [Op.or]: ['PERM_MUTE', 'TEMP_MUTE', 'UNMUTE'] };
-// break;
-// case 'warn':
-// where.type = { [Op.or]: ['WARN'] };
-// break;
-// case 'role':
-// where.type = { [Op.or]: ['PERM_PUNISHMENT_ROLE', 'TEMP_PUNISHMENT_ROLE', 'REMOVE_PUNISHMENT_ROLE'] };
-// break;
-// default:
-// return message.util.reply(`${util.emojis.error} You supplied an invalid case type to filter by.`);
-// }
-// }
+export default class ActivePunishmentsCommand extends BushCommand {
+ public constructor() {
+ super('activePunishments', {
+ aliases: ['active-punishments', 'ap'],
+ category: 'moderation',
+ description: 'Gets a list of all the active punishment in the server.',
+ usage: [`active-punishments [--moderator <user>] [--type <${punishmentTypes.map((v) => `'${v}'`).join('|')}>]`],
+ examples: ['active-punishments'],
+ args: [
+ {
+ id: 'moderator',
+ description: 'Only show active punishments by this moderator.',
+ type: 'user',
+ match: 'option',
+ prompt: 'Only show active punishments from what user?',
+ optional: true,
+ slashType: ApplicationCommandOptionType.User,
+ slashResolve: 'Member'
+ },
+ {
+ id: 'type',
+ description: 'Only show active punishments of this type.',
+ customType: [...punishmentTypes],
+ readableType: punishmentTypes.map((v) => `'${v}'`).join('|'),
+ match: 'option',
+ optional: true,
+ slashType: ApplicationCommandOptionType.String,
+ choices: punishmentTypes.map((v) => ({ name: v, value: v }))
+ }
+ ],
+ slash: true,
+ channel: 'guild',
+ hidden: true,
+ clientPermissions: (m) => util.clientSendAndPermCheck(m),
+ userPermissions: (m) => util.userGuildPermCheck(m, [PermissionFlagsBits.ManageMessages])
+ });
+ }
-// const logs = await ModLog.findAll({
-// where,
-// order: [['createdAt', 'ASC']]
-// });
-// }
-// }
+ public override async exec(
+ message: BushMessage | BushSlashMessage,
+ args: { moderator?: BushGuildMember; type: typeof punishmentTypes[number] }
+ ) {
+ const where: FindOptions<ModLogModel>['where'] = { guild: message.guild!.id };
+ if (args.moderator?.id) where.user = args.moderator.id;
+ if (args.type) {
+ switch (args.type) {
+ case 'ban':
+ where.type = { [Op.or]: ['PERM_BAN', 'TEMP_BAN', 'UNBAN'] };
+ break;
+ case 'kick':
+ where.type = { [Op.or]: ['KICK'] };
+ break;
+ case 'mute':
+ where.type = { [Op.or]: ['PERM_MUTE', 'TEMP_MUTE', 'UNMUTE'] };
+ break;
+ case 'warn':
+ where.type = { [Op.or]: ['WARN'] };
+ break;
+ case 'role':
+ where.type = { [Op.or]: ['PERM_PUNISHMENT_ROLE', 'TEMP_PUNISHMENT_ROLE', 'REMOVE_PUNISHMENT_ROLE'] };
+ break;
+ default:
+ return message.util.reply(`${util.emojis.error} You supplied an invalid case type to filter by.`);
+ }
+ }
+
+ const logs = await ModLog.findAll({
+ where,
+ order: [['createdAt', 'ASC']]
+ });
+ }
+}
+ */
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts
index 25102e0..14bbba6 100644
--- a/src/commands/moderation/ban.ts
+++ b/src/commands/moderation/ban.ts
@@ -6,7 +6,7 @@ import {
type ArgType,
type BushMessage,
type BushSlashMessage,
- type OptionalArgType
+ type OptArgType
} from '#lib';
import assert from 'assert';
import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
@@ -72,8 +72,8 @@ export default class BanCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
args: {
user: ArgType<'user'> | ArgType<'snowflake'>;
- reason_and_duration: OptionalArgType<'contentWithDuration'> | string;
- days: OptionalArgType<'integer'>;
+ reason_and_duration: OptArgType<'contentWithDuration'> | string;
+ days: OptArgType<'integer'>;
force: boolean;
}
) {
diff --git a/src/commands/moderation/block.ts b/src/commands/moderation/block.ts
index 554ef2b..722f08b 100644
--- a/src/commands/moderation/block.ts
+++ b/src/commands/moderation/block.ts
@@ -6,7 +6,7 @@ import {
type ArgType,
type BushMessage,
type BushSlashMessage,
- type OptionalArgType
+ type OptArgType
} from '#lib';
import assert from 'assert';
import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
@@ -61,7 +61,7 @@ export default class BlockCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
args: {
user: ArgType<'user'>;
- reason_and_duration: OptionalArgType<'contentWithDuration'> | string;
+ reason_and_duration: OptArgType<'contentWithDuration'> | string;
force?: ArgType<'boolean'>;
}
) {
diff --git a/src/commands/moderation/evidence.ts b/src/commands/moderation/evidence.ts
index 68d7edc..d60a5b0 100644
--- a/src/commands/moderation/evidence.ts
+++ b/src/commands/moderation/evidence.ts
@@ -1,4 +1,4 @@
-import { BushCommand, ModLog, OptionalArgType, type BushMessage, type BushSlashMessage } from '#lib';
+import { BushCommand, ModLog, OptArgType, type BushMessage, type BushSlashMessage } from '#lib';
import assert from 'assert';
import { ArgumentGeneratorReturn } from 'discord-akairo';
import { ArgumentTypeCasterReturn } from 'discord-akairo/dist/src/struct/commands/arguments/Argument.js';
@@ -64,7 +64,7 @@ export default class EvidenceCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- { case_id: caseID, evidence }: { case_id: string; evidence: OptionalArgType<'string'> }
+ { case_id: caseID, evidence }: { case_id: string; evidence: OptArgType<'string'> }
) {
assert(message.inGuild());
@@ -85,7 +85,7 @@ export default class EvidenceCommand extends BushCommand {
return message.util.reply(`${util.emojis.success} Successfully updated the evidence for case ${util.format.input(caseID)}.`);
}
- public static getEvidence(message: BushMessage | BushSlashMessage, evidenceArg: OptionalArgType<'string'>): null | string {
+ public static getEvidence(message: BushMessage | BushSlashMessage, evidenceArg: OptArgType<'string'>): null | string {
if (evidenceArg && (message as BushMessage).attachments?.size) {
void message.util.reply(`${util.emojis.error} Please either attach an image or a reason not both.`);
return null;
diff --git a/src/commands/moderation/lockdown.ts b/src/commands/moderation/lockdown.ts
index 36f3240..f298ec9 100644
--- a/src/commands/moderation/lockdown.ts
+++ b/src/commands/moderation/lockdown.ts
@@ -8,7 +8,7 @@ import {
type ArgType,
type BushMessage,
type BushSlashMessage,
- type OptionalArgType
+ type OptArgType
} from '#lib';
import assert from 'assert';
import { ApplicationCommandOptionType, ChannelType, Collection, PermissionFlagsBits } from 'discord.js';
@@ -67,8 +67,8 @@ export default class LockdownCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
args: {
- channel: OptionalArgType<'textChannel'> | OptionalArgType<'newsChannel'> | OptionalArgType<'threadChannel'>;
- reason: OptionalArgType<'string'>;
+ channel: OptArgType<'textChannel'> | OptArgType<'newsChannel'> | OptArgType<'threadChannel'>;
+ reason: OptArgType<'string'>;
all: ArgType<'boolean'>;
}
) {
@@ -78,8 +78,8 @@ export default class LockdownCommand extends BushCommand {
public static async lockdownOrUnlockdown(
message: BushMessage | BushSlashMessage,
args: {
- channel: OptionalArgType<'textChannel'> | OptionalArgType<'newsChannel'> | OptionalArgType<'threadChannel'>;
- reason: OptionalArgType<'string'>;
+ channel: OptArgType<'textChannel'> | OptArgType<'newsChannel'> | OptArgType<'threadChannel'>;
+ reason: OptArgType<'string'>;
all: ArgType<'boolean'>;
},
action: 'lockdown' | 'unlockdown'
diff --git a/src/commands/moderation/massBan.ts b/src/commands/moderation/massBan.ts
index 568b6be..f1d85ed 100644
--- a/src/commands/moderation/massBan.ts
+++ b/src/commands/moderation/massBan.ts
@@ -5,7 +5,7 @@ import {
type ArgType,
type BushMessage,
type BushSlashMessage,
- type OptionalArgType
+ type OptArgType
} from '#lib';
import assert from 'assert';
import { ApplicationCommandOptionType, Collection, PermissionFlagsBits } from 'discord.js';
@@ -62,7 +62,7 @@ export default class MassBanCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- args: { users: ArgType<'string'>; reason: OptionalArgType<'string'>; days: OptionalArgType<'integer'> }
+ args: { users: ArgType<'string'>; reason: OptArgType<'string'>; days: OptArgType<'integer'> }
) {
assert(message.inGuild());
diff --git a/src/commands/moderation/massEvidence.ts b/src/commands/moderation/massEvidence.ts
index 62421da..67f5a25 100644
--- a/src/commands/moderation/massEvidence.ts
+++ b/src/commands/moderation/massEvidence.ts
@@ -1,4 +1,4 @@
-import { BushCommand, ModLog, type ArgType, type BushMessage, type BushSlashMessage, type OptionalArgType } from '#lib';
+import { BushCommand, ModLog, type ArgType, type BushMessage, type BushSlashMessage, type OptArgType } from '#lib';
import assert from 'assert';
import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
import { EvidenceCommand } from '../index.js';
@@ -45,7 +45,7 @@ export default class MassEvidenceCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- args: { users: ArgType<'string'>; evidence: OptionalArgType<'string'> }
+ args: { users: ArgType<'string'>; evidence: OptArgType<'string'> }
) {
assert(message.inGuild());
diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts
index e32ece2..d846817 100644
--- a/src/commands/moderation/mute.ts
+++ b/src/commands/moderation/mute.ts
@@ -6,7 +6,7 @@ import {
type ArgType,
type BushMessage,
type BushSlashMessage,
- type OptionalArgType
+ type OptArgType
} from '#lib';
import assert from 'assert';
import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
@@ -60,7 +60,7 @@ export default class MuteCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
args: {
user: ArgType<'user'>;
- reason_and_duration: OptionalArgType<'contentWithDuration'> | string;
+ reason_and_duration: OptArgType<'contentWithDuration'> | string;
force?: ArgType<'boolean'>;
}
) {
diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts
index 8580f2f..a87b2bf 100644
--- a/src/commands/moderation/role.ts
+++ b/src/commands/moderation/role.ts
@@ -6,7 +6,7 @@ import {
type ArgType,
type BushMessage,
type BushSlashMessage,
- type OptionalArgType
+ type OptArgType
} from '#lib';
import { type ArgumentGeneratorReturn } from 'discord-akairo';
import { ApplicationCommandOptionType, PermissionFlagsBits, type Snowflake } from 'discord.js';
@@ -123,7 +123,7 @@ export default class RoleCommand extends BushCommand {
action: 'add' | 'remove';
member: ArgType<'member'>;
role: ArgType<'role'>;
- duration?: OptionalArgType<'duration'>;
+ duration?: OptArgType<'duration'>;
force?: boolean;
}
) {
diff --git a/src/commands/moderation/unban.ts b/src/commands/moderation/unban.ts
index 9973d61..e6ac6d0 100644
--- a/src/commands/moderation/unban.ts
+++ b/src/commands/moderation/unban.ts
@@ -5,7 +5,7 @@ import {
type ArgType,
type BushMessage,
type BushSlashMessage,
- type OptionalArgType
+ type OptArgType
} from '#lib';
import assert from 'assert';
import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
@@ -47,7 +47,7 @@ export default class UnbanCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- { user, reason }: { user: ArgType<'user'>; reason: OptionalArgType<'string'> }
+ { user, reason }: { user: ArgType<'user'>; reason: OptArgType<'string'> }
) {
assert(message.inGuild());
diff --git a/src/commands/moderation/unblock.ts b/src/commands/moderation/unblock.ts
index 34b2075..22c9949 100644
--- a/src/commands/moderation/unblock.ts
+++ b/src/commands/moderation/unblock.ts
@@ -6,7 +6,7 @@ import {
type ArgType,
type BushMessage,
type BushSlashMessage,
- type OptionalArgType
+ type OptArgType
} from '#lib';
import assert from 'assert';
import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
@@ -58,7 +58,7 @@ export default class UnblockCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- args: { user: ArgType<'user'>; reason: OptionalArgType<'string'>; force?: ArgType<'boolean'> }
+ args: { user: ArgType<'user'>; reason: OptArgType<'string'>; force?: ArgType<'boolean'> }
) {
assert(message.inGuild());
assert(message.member);
diff --git a/src/commands/moderation/unlockdown.ts b/src/commands/moderation/unlockdown.ts
index 4694518..253ce37 100644
--- a/src/commands/moderation/unlockdown.ts
+++ b/src/commands/moderation/unlockdown.ts
@@ -1,5 +1,5 @@
import { LockdownCommand } from '#commands';
-import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage, type OptionalArgType } from '#lib';
+import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage, type OptArgType } from '#lib';
import { ApplicationCommandOptionType, ChannelType, PermissionFlagsBits } from 'discord.js';
export default class UnlockdownCommand extends BushCommand {
@@ -55,8 +55,8 @@ export default class UnlockdownCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
args: {
- channel: OptionalArgType<'textChannel'> | OptionalArgType<'newsChannel'> | OptionalArgType<'threadChannel'>;
- reason: OptionalArgType<'string'>;
+ channel: OptArgType<'textChannel'> | OptArgType<'newsChannel'> | OptArgType<'threadChannel'>;
+ reason: OptArgType<'string'>;
all: ArgType<'boolean'>;
}
) {
diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts
index de16cb5..094cadd 100644
--- a/src/commands/moderation/unmute.ts
+++ b/src/commands/moderation/unmute.ts
@@ -7,7 +7,7 @@ import {
type BushGuildMember,
type BushMessage,
type BushSlashMessage,
- type OptionalArgType
+ type OptArgType
} from '#lib';
import assert from 'assert';
import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
@@ -59,7 +59,7 @@ export default class UnmuteCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- { user, reason, force = false }: { user: ArgType<'user'>; reason: OptionalArgType<'string'>; force?: boolean }
+ { user, reason, force = false }: { user: ArgType<'user'>; reason: OptArgType<'string'>; force?: boolean }
) {
assert(message.inGuild());
assert(message.member);
diff --git a/src/commands/moderation/untimeout.ts b/src/commands/moderation/untimeout.ts
index 636b178..cbaf7d1 100644
--- a/src/commands/moderation/untimeout.ts
+++ b/src/commands/moderation/untimeout.ts
@@ -6,7 +6,7 @@ import {
type ArgType,
type BushMessage,
type BushSlashMessage,
- type OptionalArgType
+ type OptArgType
} from '#lib';
import assert from 'assert';
import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
@@ -58,7 +58,7 @@ export default class UntimeoutCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- args: { user: ArgType<'user'>; reason: OptionalArgType<'string'>; force?: ArgType<'boolean'> }
+ args: { user: ArgType<'user'>; reason: OptArgType<'string'>; force?: ArgType<'boolean'> }
) {
assert(message.inGuild());
assert(message.member);
diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts
index 3ab4b0b..87baf4a 100644
--- a/src/commands/moderation/warn.ts
+++ b/src/commands/moderation/warn.ts
@@ -6,7 +6,7 @@ import {
type ArgType,
type BushMessage,
type BushSlashMessage,
- type OptionalArgType
+ type OptArgType
} from '#lib';
import assert from 'assert';
import { ApplicationCommandOptionType, PermissionFlagsBits } from 'discord.js';
@@ -57,7 +57,7 @@ export default class WarnCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- { user, reason, force = false }: { user: ArgType<'user'>; reason: OptionalArgType<'string'>; force?: boolean }
+ { user, reason, force = false }: { user: ArgType<'user'>; reason: OptArgType<'string'>; force?: boolean }
) {
assert(message.inGuild());
assert(message.member);