aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-12-29 22:12:48 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-12-29 22:12:48 -0500
commit1182f63498c856111762e2766d6cdddf063f2a97 (patch)
tree1610dfa9f76d15fd5731a900b854d62d08438ddc /src/commands/moderation
parenta540b4083b7a5662ec49b7576b215fe5d3153358 (diff)
downloadtanzanite-1182f63498c856111762e2766d6cdddf063f2a97.tar.gz
tanzanite-1182f63498c856111762e2766d6cdddf063f2a97.tar.bz2
tanzanite-1182f63498c856111762e2766d6cdddf063f2a97.zip
misc improvements
Diffstat (limited to 'src/commands/moderation')
-rw-r--r--src/commands/moderation/lockdown.ts2
-rw-r--r--src/commands/moderation/mute.ts19
-rw-r--r--src/commands/moderation/role.ts2
-rw-r--r--src/commands/moderation/unlockdown.ts2
4 files changed, 17 insertions, 8 deletions
diff --git a/src/commands/moderation/lockdown.ts b/src/commands/moderation/lockdown.ts
index 7a0b9d8..b9febbd 100644
--- a/src/commands/moderation/lockdown.ts
+++ b/src/commands/moderation/lockdown.ts
@@ -16,7 +16,7 @@ import { Collection } from 'discord.js';
export default class LockdownCommand extends BushCommand {
public constructor() {
super('lockdown', {
- aliases: ['lockdown'],
+ aliases: ['lockdown', 'lock'],
category: 'moderation',
description: 'Allows you to lockdown a channel or all configured channels.',
usage: ['lockdown [channel] [reason] [--all]'],
diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts
index ae37fed..eeffc6c 100644
--- a/src/commands/moderation/mute.ts
+++ b/src/commands/moderation/mute.ts
@@ -1,4 +1,13 @@
-import { AllowedMentions, BushCommand, Moderation, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
+import {
+ AllowedMentions,
+ BushCommand,
+ Moderation,
+ type ArgType,
+ type BushMessage,
+ type BushSlashMessage,
+ type OptionalArgType
+} from '#lib';
+import assert from 'assert';
export default class MuteCommand extends BushCommand {
public constructor() {
@@ -19,7 +28,7 @@ export default class MuteCommand extends BushCommand {
},
{
id: 'reason',
- description: 'The reason for the mute.',
+ description: 'The reason and duration of the mute.',
type: 'contentWithDuration',
match: 'rest',
prompt: 'Why should this user be muted and for how long?',
@@ -47,9 +56,9 @@ export default class MuteCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- args: { user: ArgType<'user'>; reason?: ArgType<'contentWithDuration'> | string; force: boolean }
+ args: { user: ArgType<'user'>; reason: OptionalArgType<'contentWithDuration'> | string; force?: ArgType<'boolean'> }
) {
- const reason: { duration: number | null; contentWithoutTime: string | null } = args.reason
+ const reason = args.reason
? typeof args.reason === 'string'
? await util.arg.cast('contentWithDuration', message, args.reason)
: args.reason
@@ -60,7 +69,7 @@ export default class MuteCommand extends BushCommand {
if (!member)
return await message.util.reply(`${util.emojis.error} The user you selected is not in the server or is not a valid user.`);
- if (!message.member) throw new Error(`message.member is null`);
+ assert(message.member);
const useForce = args.force && message.author.isOwner();
const canModerateResponse = await Moderation.permissionCheck(message.member, member, 'mute', true, useForce);
diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts
index 2375bff..9fd34b5 100644
--- a/src/commands/moderation/role.ts
+++ b/src/commands/moderation/role.ts
@@ -130,7 +130,7 @@ export default class RoleCommand extends BushCommand {
const a = mappings.roleMap[i];
if (a.id === args.role.id) mappedRole = a;
}
- if (!mappedRole! || !Reflect.has(mappings.roleWhitelist, mappedRole.name)) {
+ if (!mappedRole! || !(mappedRole.name in mappings.roleWhitelist)) {
return await message.util.reply({
content: `${util.emojis.error} <@&${args.role.id}> is not whitelisted, and you do not have manage roles permission.`,
allowedMentions: AllowedMentions.none()
diff --git a/src/commands/moderation/unlockdown.ts b/src/commands/moderation/unlockdown.ts
index 87b27eb..24af305 100644
--- a/src/commands/moderation/unlockdown.ts
+++ b/src/commands/moderation/unlockdown.ts
@@ -4,7 +4,7 @@ import LockdownCommand from './lockdown.js';
export default class UnlockdownCommand extends BushCommand {
public constructor() {
super('unlockdown', {
- aliases: ['unlockdown'],
+ aliases: ['unlockdown', 'unlock'],
category: 'moderation',
description: 'Allows you to unlockdown a channel or all configured channels.',
usage: ['unlockdown [channel] [reason] [--all]'],