aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/dev/__template.ts4
-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
5 files changed, 19 insertions, 10 deletions
diff --git a/src/commands/dev/__template.ts b/src/commands/dev/__template.ts
index 11d9649..6adba08 100644
--- a/src/commands/dev/__template.ts
+++ b/src/commands/dev/__template.ts
@@ -11,16 +11,16 @@ export default class TemplateCommand extends BushCommand {
args: [
{
id: 'required_argument',
- type: 'string',
description: 'This is the first argument.',
+ type: 'string',
prompt: 'What would you like to set your first argument to be?',
retry: '{error} Pick a valid argument.',
slashType: 'STRING'
},
{
id: 'optional_argument',
- type: 'string',
description: 'This is the second argument.',
+ type: 'string',
prompt: 'What would you like to set your second argument to be?',
retry: '{error} Pick a valid argument.',
optional: true,
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]'],