testing thing

This commit is contained in:
Loïc Bersier 2018-09-09 20:19:15 +02:00
parent 60d6c6bd2c
commit 18b9aa86e4

View file

@ -1,13 +1,12 @@
const { Command } = require('discord.js-commando'); const { Command } = require('discord.js-commando');
module.exports = class GiveRankCommand extends Command { module.exports = class GAssignRankCommand extends Command {
constructor(client) { constructor(client) {
super(client, { super(client, {
name: 'giverank', name: 'assignrank',
group: 'admin', group: 'admin',
memberName: 'giverank', memberName: 'Assignrank',
description: 'Assign a rank to the mentionned user', description: 'Assign a rank to the mentionned user',
clientPermissions: ['MANAGE_ROLES'], clientPermissions: ['MANAGE_ROLES'],
userPermissions: ['MANAGE_ROLES'],
guildOnly: true, guildOnly: true,
args: [ args: [
{ {
@ -27,9 +26,12 @@ module.exports = class GiveRankCommand extends Command {
run(message, { rank, member }) { run(message, { rank, member }) {
const role = message.guild.roles.find('name', rank); const role = message.guild.roles.find('name', rank);
member = message.mentions.members.first(); member = message.mentions.members.first();
if (!message.mentions.users.size) {
return message.channel.send(`You succesfully gived the rank **${rank}** to yourself: ${message.author.addRole(role)}`);
}
if (!role) { 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"); message.say("The rank you tried to assign dosent exist ( or bot have a lower rank than the one you tried to assign");
} else } else if (userPermissions = 'MANAGE_ROLES')
member.addRole(role); member.addRole(role);
message.say(`You successfully gived the rank **${rank}** to **${member}**`); message.say(`You successfully gived the rank **${rank}** to **${member}**`);
} }