From e6a025e5f64e7277b1e1ac9ee7128597d7694692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Sun, 16 Sep 2018 21:02:11 +0200 Subject: [PATCH 1/3] Put in "utility" categorie --- commands/{thing => utility}/avatar.js | 2 +- commands/utility/server.js | 25 +++++++++++++++++++++++++ commands/{thing => utility}/stats.js | 2 +- index.js | 3 ++- 4 files changed, 29 insertions(+), 3 deletions(-) rename commands/{thing => utility}/avatar.js (95%) create mode 100644 commands/utility/server.js rename commands/{thing => utility}/stats.js (94%) diff --git a/commands/thing/avatar.js b/commands/utility/avatar.js similarity index 95% rename from commands/thing/avatar.js rename to commands/utility/avatar.js index 4f1ada16..b207203d 100644 --- a/commands/thing/avatar.js +++ b/commands/utility/avatar.js @@ -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.', }); diff --git a/commands/utility/server.js b/commands/utility/server.js new file mode 100644 index 00000000..75c11af5 --- /dev/null +++ b/commands/utility/server.js @@ -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); + } +}; \ No newline at end of file diff --git a/commands/thing/stats.js b/commands/utility/stats.js similarity index 94% rename from commands/thing/stats.js rename to commands/utility/stats.js index da1a5064..28d05c72 100644 --- a/commands/thing/stats.js +++ b/commands/utility/stats.js @@ -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.', }); diff --git a/index.js b/index.js index 478cc3b7..b4a58bac 100644 --- a/index.js +++ b/index.js @@ -15,10 +15,11 @@ const client = new CommandoClient({ client.registry .registerDefaultTypes() .registerGroups([ - ['thing', 'some things i guess? i dont know how to name it'], + ['thing', 'Some things i guess? i dont know how to name it'], ['admin', 'Commands to make admin life easier'], ['owner', 'Commands the owner can use to manage the bot'], ['fun', 'Fun commands'], + ['utility', 'Some usefull commands'], ]) .registerDefaultGroups() .registerDefaultCommands() From e6f4a95847828ab9011027dbf52b4ac80db772c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Sun, 16 Sep 2018 21:58:14 +0200 Subject: [PATCH 2/3] Fixed prune ? i think with a stupid way --- commands/admin/prune.js | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/commands/admin/prune.js b/commands/admin/prune.js index e4965667..b366f4e8 100644 --- a/commands/admin/prune.js +++ b/commands/admin/prune.js @@ -7,22 +7,23 @@ module.exports = class PruneCommand extends Command { group: 'admin', memberName: 'prune', description: 'Bulk delete messages.', - clientPermissions: ['MANAGE_MESSAGES'], - userPermissions: ['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!'); - }); -}} \ No newline at end of file From 39db016f477121f73964b405f7d7f30524c6a167 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Mon, 17 Sep 2018 14:54:05 +0200 Subject: [PATCH 3/3] Removed "Thing" commands categorie and moved to utility --- commands/{thing => utility}/invite.js | 0 commands/{thing => utility}/updoot.js | 0 index.js | 5 ++--- 3 files changed, 2 insertions(+), 3 deletions(-) rename commands/{thing => utility}/invite.js (100%) rename commands/{thing => utility}/updoot.js (100%) diff --git a/commands/thing/invite.js b/commands/utility/invite.js similarity index 100% rename from commands/thing/invite.js rename to commands/utility/invite.js diff --git a/commands/thing/updoot.js b/commands/utility/updoot.js similarity index 100% rename from commands/thing/updoot.js rename to commands/utility/updoot.js diff --git a/index.js b/index.js index b4a58bac..91cba2ad 100644 --- a/index.js +++ b/index.js @@ -15,11 +15,10 @@ const client = new CommandoClient({ client.registry .registerDefaultTypes() .registerGroups([ - ['thing', 'Some things i guess? i dont know how to name it'], - ['admin', 'Commands to make admin life easier'], - ['owner', 'Commands the owner can use to manage the bot'], ['fun', 'Fun commands'], ['utility', 'Some usefull commands'], + ['admin', 'Commands to make admin life easier'], + ['owner', 'Commands the owner can use to manage the bot'], ]) .registerDefaultGroups() .registerDefaultCommands()