aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/config/joinRoles.ts11
-rw-r--r--src/commands/moderation/ban.ts3
-rw-r--r--src/commands/moderation/kick.ts4
-rw-r--r--src/commands/moderation/mute.ts7
-rw-r--r--src/commands/moderation/unmute.ts3
-rw-r--r--src/commands/moderation/warn.ts3
-rw-r--r--src/commands/utilities/price.ts3
7 files changed, 21 insertions, 13 deletions
diff --git a/src/commands/config/joinRoles.ts b/src/commands/config/joinRoles.ts
index 89a2421..9507d4b 100644
--- a/src/commands/config/joinRoles.ts
+++ b/src/commands/config/joinRoles.ts
@@ -39,12 +39,15 @@ export default class JoinRolesCommand extends BushCommand {
public override async exec(message: BushMessage | BushSlashMessage, { role }: { role: Role }): Promise<unknown> {
const joinRoles = await message.guild!.getSetting('joinRoles');
- const newValue = util.addOrRemoveFromArray(joinRoles.includes(role.id) ? 'remove' : 'add', joinRoles, role.id);
+ const includes = joinRoles.includes(role.id);
+ client.console.debug(joinRoles);
+ const newValue = util.addOrRemoveFromArray(includes ? 'remove' : 'add', joinRoles, role.id);
await message.guild!.setSetting('joinRoles', newValue);
+ client.console.debug(joinRoles);
return await message.util.reply({
- content: `${util.emojis.success} Successfully ${joinRoles.includes(role.id) ? 'removed' : 'added'} <@&${
- role.id
- }> from being assigned to members when they join the server.`,
+ content: `${util.emojis.success} Successfully ${includes ? 'removed' : 'added'} <@&${role.id}> ${
+ includes ? 'from' : 'to'
+ }from being assigned to members when they join the server.`,
allowedMentions: AllowedMentions.none()
});
}
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts
index 3a86244..7f1a67c 100644
--- a/src/commands/moderation/ban.ts
+++ b/src/commands/moderation/ban.ts
@@ -93,7 +93,8 @@ export default class BanCommand extends BushCommand {
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.id) as BushGuildMember;
const useForce = force && message.author.isOwner();
- const canModerateResponse = util.moderationPermissionCheck(message.member!, member, 'ban', true, useForce);
+ if (!message.member) throw new Error(`message.member is null`);
+ const canModerateResponse = util.moderationPermissionCheck(message.member, member, 'ban', true, useForce);
if (canModerateResponse !== true) {
return message.util.reply(canModerateResponse);
diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts
index 8864320..2315712 100644
--- a/src/commands/moderation/kick.ts
+++ b/src/commands/moderation/kick.ts
@@ -62,9 +62,9 @@ export default class KickCommand extends BushCommand {
const member = message.guild!.members.cache.get(user.id) as BushGuildMember;
if (!member) return await message.util.reply(`${util.emojis.error} You cannot kick members that are not in the server.`);
-
+ if (!message.member) throw new Error(`message.member is null`);
const useForce = force && message.author.isOwner();
- const canModerateResponse = util.moderationPermissionCheck(message.member!, member, 'kick', true, useForce);
+ const canModerateResponse = util.moderationPermissionCheck(message.member, member, 'kick', true, useForce);
if (canModerateResponse !== true) {
return message.util.reply(canModerateResponse);
diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts
index e6c9065..7b8689a 100644
--- a/src/commands/moderation/mute.ts
+++ b/src/commands/moderation/mute.ts
@@ -1,4 +1,4 @@
-import { AllowedMentions, BushCommand, BushGuildMember, BushMessage, BushSlashMessage, BushUser } from '@lib';
+import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage, BushUser } from '@lib';
import { Argument } from 'discord-akairo';
export default class MuteCommand extends BushCommand {
@@ -61,11 +61,12 @@ export default class MuteCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
{ user, reason, force }: { user: BushUser; reason?: { duration: number; contentWithoutTime: string }; force: boolean }
): Promise<unknown> {
- const member = message.guild!.members.cache.get(user.id) as BushGuildMember;
+ const member = message.guild!.members.cache.get(user.id);
if (!member) return await message.util.reply(`${util.emojis.error} You cannot kick members that are not in the server.`);
+ if (!message.member) throw new Error(`message.member is null`);
const useForce = force && message.author.isOwner();
- const canModerateResponse = util.moderationPermissionCheck(message.member!, member, 'mute', true, useForce);
+ const canModerateResponse = util.moderationPermissionCheck(message.member, member, 'mute', true, useForce);
const victimBoldTag = `**${member.user.tag}**`;
if (canModerateResponse !== true) {
diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts
index 7e93d31..acbda3e 100644
--- a/src/commands/moderation/unmute.ts
+++ b/src/commands/moderation/unmute.ts
@@ -57,7 +57,8 @@ export default class UnmuteCommand extends BushCommand {
): Promise<unknown> {
const error = util.emojis.error;
const member = message.guild!.members.cache.get(user.id) as BushGuildMember;
- const canModerateResponse = util.moderationPermissionCheck(message.member!, member, 'unmute');
+ if (!message.member) throw new Error(`message.member is null`);
+ const canModerateResponse = util.moderationPermissionCheck(message.member, member, 'unmute');
const victimBoldTag = `**${member.user.tag}**`;
if (canModerateResponse !== true) {
diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts
index 33ac2a3..a9469cf 100644
--- a/src/commands/moderation/warn.ts
+++ b/src/commands/moderation/warn.ts
@@ -61,7 +61,8 @@ export default class WarnCommand extends BushCommand {
): Promise<unknown> {
const member = message.guild!.members.cache.get(user.id) as BushGuildMember;
const useForce = force && message.author.isOwner();
- const canModerateResponse = util.moderationPermissionCheck(message.member!, member, 'warn', true, useForce);
+ if (!message.member) throw new Error(`message.member is null`);
+ const canModerateResponse = util.moderationPermissionCheck(message.member, member, 'warn', true, useForce);
const victimBoldTag = `**${member.user.tag}**`;
if (canModerateResponse !== true) {
diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts
index 921784f..0bdad27 100644
--- a/src/commands/utilities/price.ts
+++ b/src/commands/utilities/price.ts
@@ -1,4 +1,4 @@
-import { MessageEmbed } from 'discord.js';
+import { CommandInteraction, MessageEmbed } from 'discord.js';
import Fuse from 'fuse.js';
import fetch from 'node-fetch';
import { BushCommand, BushMessage } from '../../lib';
@@ -98,6 +98,7 @@ export default class PriceCommand extends BushCommand {
}
public override async exec(message: BushMessage, { item, strict }: { item: string; strict: boolean }): Promise<unknown> {
+ if (message.util.isSlash) await (message.interaction as CommandInteraction).deferReply();
const errors = new Array<string>();
const [bazaar, currentLowestBIN, averageLowestBIN, auctionAverages] = (