small fixes

This commit is contained in:
Erik 2022-04-14 11:44:35 +03:00
parent 963b401283
commit 2e5854b584
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
5 changed files with 9 additions and 10 deletions

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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);

View File

@ -55,10 +55,12 @@ class ModerationCommand extends SlashCommand {
super(client, {
...opts,
options: [
...baseOptions,
...opts.options || []
]
options: opts.overrideOptions ?
opts.options :
[
...baseOptions,
...opts.options || []
]
});
}

View File

@ -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}`);
/*