prune work the correct way
This commit is contained in:
parent
77564478ad
commit
e21449a031
3 changed files with 14 additions and 29 deletions
|
@ -9,20 +9,20 @@ module.exports = class PruneCommand extends Command {
|
||||||
description: 'Bulk delete messages.',
|
description: 'Bulk delete messages.',
|
||||||
clientPermissions: ['MANAGE_MESSAGES'],
|
clientPermissions: ['MANAGE_MESSAGES'],
|
||||||
userPermissions: ['MANAGE_MESSAGES'],
|
userPermissions: ['MANAGE_MESSAGES'],
|
||||||
args: [
|
|
||||||
{
|
|
||||||
key: 'amount',
|
|
||||||
prompt: 'How many messages would you like to delete?',
|
|
||||||
type: 'integer',
|
|
||||||
}
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async run(message, { amount }) {
|
async run(message, args) {
|
||||||
if (amount < 2 || amount > 100) {
|
const amount = parseInt(args[0]) + 1;
|
||||||
return message.reply('you need to input a number between 2 and 100.');
|
|
||||||
|
if (isNaN(amount)) {
|
||||||
|
return message.reply('that dosen\'t seem to be a valid number.');
|
||||||
}
|
}
|
||||||
message.channel.bulkDelete(amount, true);
|
else if (amount <= 1 || amount > 100) {
|
||||||
}
|
return message.reply('you need to input a number between 1 and 99.');
|
||||||
};
|
}
|
||||||
|
message.channel.bulkDelete(amount, true).catch(err => {
|
||||||
|
console.error(err);
|
||||||
|
message.channel.send('there was an error trying to prune messages in this channel!');
|
||||||
|
});
|
||||||
|
}}
|
|
@ -1,15 +0,0 @@
|
||||||
const { Command } = require('discord.js-commando');
|
|
||||||
module.exports = class YesCommand extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: 'yes',
|
|
||||||
group: 'fun',
|
|
||||||
memberName: 'yes',
|
|
||||||
description: 'very yes',
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message) {
|
|
||||||
return message.say('haha very yes');
|
|
||||||
}
|
|
||||||
};
|
|
2
index.js
2
index.js
|
@ -6,7 +6,7 @@ const fs = require("fs");
|
||||||
|
|
||||||
// Prefix and ownerID and invite to support server
|
// Prefix and ownerID and invite to support server
|
||||||
const client = new CommandoClient({
|
const client = new CommandoClient({
|
||||||
commandPrefix: 'h3h3',
|
commandPrefix: 'haha ',
|
||||||
owner: '267065637183029248',
|
owner: '267065637183029248',
|
||||||
invite: 'https://discord.gg/SsMCsVY',
|
invite: 'https://discord.gg/SsMCsVY',
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue