From 2e5854b5843aa1c1b1a7ac5ee7f6150eb843c4d3 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Thu, 14 Apr 2022 11:44:35 +0300 Subject: [PATCH] small fixes --- src/structure/components/infractions/Prune.js | 3 +-- src/structure/components/infractions/Unban.js | 2 +- src/structure/components/observers/CommandHandler.js | 2 -- src/structure/interfaces/commands/ModerationCommand.js | 10 ++++++---- src/structure/interfaces/commands/SlashCommand.js | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/structure/components/infractions/Prune.js b/src/structure/components/infractions/Prune.js index 6f23c8e..bdb7720 100644 --- a/src/structure/components/infractions/Prune.js +++ b/src/structure/components/infractions/Prune.js @@ -33,7 +33,6 @@ class PruneInfraction extends Infraction { async execute() { - console.log('executing'); const { amount, message } = this.data; let messages = await this.fetchMessages(message, amount); //Collection, not array. if (messages.size === 0) return this._fail('C_PRUNE_NOTFETCHED'); @@ -74,7 +73,7 @@ class PruneInfraction extends Infraction { } }; - await bulkDelete(messages.array()); + await bulkDelete(messages.map((msg) => msg)); return amount; } diff --git a/src/structure/components/infractions/Unban.js b/src/structure/components/infractions/Unban.js index 3f179df..7c330ef 100644 --- a/src/structure/components/infractions/Unban.js +++ b/src/structure/components/infractions/Unban.js @@ -51,7 +51,7 @@ class UnbanInfraction extends Infraction { let ban = null; try { - ban = await this.guild.fetchBan(this.target.id); + ban = await this.guild.bans.fetch(this.target.id); } catch (e) { if (e.code !== 10026) this.client.logger.error(e); } diff --git a/src/structure/components/observers/CommandHandler.js b/src/structure/components/observers/CommandHandler.js index 1e03c6c..ae17d1a 100644 --- a/src/structure/components/observers/CommandHandler.js +++ b/src/structure/components/observers/CommandHandler.js @@ -136,8 +136,6 @@ class CommandHandler extends Observer { // Find the option through the subcommand incase the subcommands have options with the same name const _subcommand = command.subcommand(subcommand?.name) || command; - // btw d.js already takes care of this, we don't need to do our own value parsing - // unless we want to add support for custom stuff for (const option of interaction.optionsWithoutSubcommands) { // iterate through the received options const matched = _subcommand.options.find((o) => o.name === option.name); diff --git a/src/structure/interfaces/commands/ModerationCommand.js b/src/structure/interfaces/commands/ModerationCommand.js index 06d8130..2431d41 100644 --- a/src/structure/interfaces/commands/ModerationCommand.js +++ b/src/structure/interfaces/commands/ModerationCommand.js @@ -55,10 +55,12 @@ class ModerationCommand extends SlashCommand { super(client, { ...opts, - options: [ - ...baseOptions, - ...opts.options || [] - ] + options: opts.overrideOptions ? + opts.options : + [ + ...baseOptions, + ...opts.options || [] + ] }); } diff --git a/src/structure/interfaces/commands/SlashCommand.js b/src/structure/interfaces/commands/SlashCommand.js index 709ab71..5a1cf32 100644 --- a/src/structure/interfaces/commands/SlashCommand.js +++ b/src/structure/interfaces/commands/SlashCommand.js @@ -13,7 +13,7 @@ class SlashCommand extends Command { * @memberof SlashCommand */ constructor(client, options = {}) { - if (!options) return null; + if (!options) throw new Error('Slash command missing defining options'); if (!options.description?.length) throw new Error(`Slash commands MUST have a description: ${options.name}`); /*