From a14ef88cf99133396a59d3a094044367aaac4088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Bersier?= Date: Sat, 8 Sep 2018 03:05:52 +0200 Subject: [PATCH] --- commands/admin/giverank.js | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 commands/admin/giverank.js diff --git a/commands/admin/giverank.js b/commands/admin/giverank.js new file mode 100644 index 0000000..123a9ba --- /dev/null +++ b/commands/admin/giverank.js @@ -0,0 +1,36 @@ +const { Command } = require('discord.js-commando'); +module.exports = class GiveRankCommand extends Command { + constructor(client) { + super(client, { + name: 'giverank', + group: 'admin', + memberName: 'giverank', + description: 'Assign a rank to the mentionned user', + clientPermissions: ['MANAGE_ROLES'], + userPermissions: ['MANAGE_ROLES'], + guildOnly: true, + args: [ + { + key: 'member', + prompt: 'Wich member should get the rank', + type: 'member', + }, + { + key: 'rank', + prompt: 'Wich rank to give to the user?', + type: 'string', + } + ] + }); + } + + run(message, { rank, member }) { + const role = message.guild.roles.find('name', rank); + member = message.mentions.members.first(); + if (!role) { + message.say("The rank you tried to assign dosent exist ( or bot have a lower rank than the one you tried to assign"); + } else + member.addRole(role); + message.say(`You successfully gived the rank **${rank}** to **${member}**`); + } +}; \ No newline at end of file