default amount for prune

This commit is contained in:
Erik 2024-01-15 23:41:33 +02:00
parent 707fd3bb84
commit 76b44e1b71

View File

@ -2,7 +2,7 @@ import { TextChannel } from 'discord.js';
import { CommandOptionType, CommandParams } from '../../../../../@types/Client.js'; import { CommandOptionType, CommandParams } from '../../../../../@types/Client.js';
import DiscordClient from '../../../DiscordClient.js'; import DiscordClient from '../../../DiscordClient.js';
import { Prune } from '../../../infractions/index.js'; import { Prune } from '../../../infractions/index.js';
import { CommandError, ModerationCommand } from '../../../interfaces/index.js'; import { ModerationCommand } from '../../../interfaces/index.js';
import InvokerWrapper from '../../wrappers/InvokerWrapper.js'; import InvokerWrapper from '../../wrappers/InvokerWrapper.js';
const flag = true, const flag = true,
@ -135,14 +135,14 @@ class PruneCommand extends ModerationCommand
// if (!channels) throw new CommandError(interaction, { index: 'MODERATION_MISSING_CHANNELS' }); // if (!channels) throw new CommandError(interaction, { index: 'MODERATION_MISSING_CHANNELS' });
if (!amount) // if (!amount)
throw new CommandError(invoker, { index: 'COMMAND_PRUNE_MISSING_AMOUNT' }); // throw new CommandError(invoker, { index: 'COMMAND_PRUNE_MISSING_AMOUNT' });
// const wrappers = await Promise.all(channels.asChannels.map(channel => this.client.getChannelWrapper(channel))); // const wrappers = await Promise.all(channels.asChannels.map(channel => this.client.getChannelWrapper(channel)));
return this.client.moderation.handleInfraction(Prune, invoker, { return this.client.moderation.handleInfraction(Prune, invoker, {
targets: channels?.asChannels as TextChannel[] || [ invoker.channel ], targets: channels?.asChannels as TextChannel[] || [ invoker.channel ],
data: { data: {
amount: amount.asString amount: amount?.asNumber ?? 100
}, },
args args
}); });