aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/moderation')
-rw-r--r--src/commands/moderation/ban.ts9
-rw-r--r--src/commands/moderation/mute.ts7
-rw-r--r--src/commands/moderation/role.ts8
-rw-r--r--src/commands/moderation/slowmode.ts3
-rw-r--r--src/commands/moderation/unmute.ts2
5 files changed, 23 insertions, 6 deletions
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts
index fea5543..88ad8e4 100644
--- a/src/commands/moderation/ban.ts
+++ b/src/commands/moderation/ban.ts
@@ -87,8 +87,15 @@ export default class BanCommand extends BushCommand {
reason,
days,
force
- }: { user: User | Snowflake; reason?: { duration: number; contentWithoutTime: string }; days?: number; force: boolean }
+ }: {
+ user: User | Snowflake;
+ reason?: { duration: number | null; contentWithoutTime: string };
+ days?: number;
+ force: boolean;
+ }
): Promise<unknown> {
+ if (reason?.duration === null) reason.duration = 0;
+
if (!message.guild) return message.util.reply(`${util.emojis.error} This command cannot be used in dms.`);
const member = message.guild!.members.cache.get((_user as User)?.id);
const user = member?.user ?? (await util.resolveNonCachedUser(_user));
diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts
index fba548b..de79b32 100644
--- a/src/commands/moderation/mute.ts
+++ b/src/commands/moderation/mute.ts
@@ -58,8 +58,13 @@ export default class MuteCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- { user, reason, force }: { user: BushUser; reason?: { duration: number; contentWithoutTime: string }; force: boolean }
+ {
+ user,
+ reason,
+ force
+ }: { user: BushUser; reason?: { duration: number | null; contentWithoutTime: string }; force: boolean }
): Promise<unknown> {
+ if (reason?.duration === null) reason.duration = 0;
const member = message.guild!.members.cache.get(user.id);
if (!member)
return await message.util.reply(
diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts
index 69432ab..fd7b817 100644
--- a/src/commands/moderation/role.ts
+++ b/src/commands/moderation/role.ts
@@ -95,8 +95,14 @@ export default class RoleCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- { action, user, role, duration }: { action: 'add' | 'remove'; user: BushGuildMember; role: BushRole; duration?: number }
+ {
+ action,
+ user,
+ role,
+ duration
+ }: { action: 'add' | 'remove'; user: BushGuildMember; role: BushRole; duration?: number | null }
): Promise<unknown> {
+ if (duration === null) duration = 0;
if (
!message.member!.permissions.has('MANAGE_ROLES') &&
message.member!.id !== message.guild?.ownerId &&
diff --git a/src/commands/moderation/slowmode.ts b/src/commands/moderation/slowmode.ts
index 4b3a976..94e40ca 100644
--- a/src/commands/moderation/slowmode.ts
+++ b/src/commands/moderation/slowmode.ts
@@ -15,8 +15,7 @@ export default class SlowModeCommand extends BushCommand {
args: [
{
id: 'length',
- customType: Argument.union('duration', 'off', 'none', 'disable'),
- default: 0,
+ customType: Argument.union('duration', 'durationSeconds', 'off', 'none', 'disable'),
prompt: {
start: 'What would you like to set the slowmode to?',
retry: '{error} Please set the slowmode to a valid length.',
diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts
index ee4bebe..680c7ba 100644
--- a/src/commands/moderation/unmute.ts
+++ b/src/commands/moderation/unmute.ts
@@ -7,7 +7,7 @@ export default class UnmuteCommand extends BushCommand {
category: 'moderation',
description: {
content: 'unmute a user.',
- usage: 'unmute <member> [reason] [duration]',
+ usage: 'unmute <member> [reason]',
examples: ['unmute 322862723090219008 1 day commands in #general']
},
args: [