This commit is contained in:
Loic Bersier 2018-09-17 16:30:56 +02:00
commit 100bdb0edf
7 changed files with 45 additions and 19 deletions

View file

@ -7,22 +7,23 @@ module.exports = class PruneCommand extends Command {
group: 'admin',
memberName: 'prune',
description: 'Bulk delete messages.',
clientPermissions: ['MANAGE_MESSAGES'],
clientPermissions: ['READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'],
userPermissions: ['MANAGE_MESSAGES'],
args: [
{
key: 'amount',
prompt: 'How many messages would you like to delete? ( choose a number between 1 & 99 )',
type: 'integer',
min: '1',
max: '99'
}
]
});
}
async run(message, args) {
const amount = parseInt(args[0]) + 1;
run(message, { amount }) {
amount = amount+1
message.channel.bulkDelete(amount, true);
}
};
if (isNaN(amount)) {
return message.reply('that dosen\'t seem to be a valid number.');
}
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!');
});
}}

View file

@ -3,7 +3,7 @@ module.exports = class AvatarCommand extends Command {
constructor(client) {
super(client, {
name: 'avatar',
group: 'thing',
group: 'utility',
memberName: 'avatar',
description: 'Send the avatar of the mentionned user.',
});

View file

@ -0,0 +1,25 @@
const { Command } = require('discord.js-commando');
const Discord = require('discord.js');
module.exports = class ServerCommand extends Command {
constructor(client) {
super(client, {
name: 'server',
group: 'utility',
memberName: 'server',
description: 'very yes',
});
}
async run(message) {
const serverStatsEmbed = new Discord.RichEmbed()
.setColor('#0099ff')
.setTitle('Stats of the server')
.setDescription('Some description here')
.setThumbnail(message.guild.iconURL)
.addField(`Member: **${message.guild.memberCount}** \n Channel: **${message.guild.channels}**`)
.addBlankField()
.setTimestamp()
message.say(serverStatsEmbed);
}
};

View file

@ -3,7 +3,7 @@ module.exports = class MeowCommand extends Command {
constructor(client) {
super(client, {
name: 'stats',
group: 'thing',
group: 'utility',
memberName: 'stats',
description: 'Show bot stats.',
});

View file

@ -15,10 +15,10 @@ const client = new CommandoClient({
client.registry
.registerDefaultTypes()
.registerGroups([
['thing', 'some things i guess? i dont know how to name it'],
['fun', 'Fun commands'],
['utility', 'Some usefull commands'],
['admin', 'Commands to make admin life easier'],
['owner', 'Commands the owner can use to manage the bot'],
['fun', 'Fun commands'],
])
.registerDefaultGroups()
.registerDefaultCommands()