Haha-Yes/commands/admin/assignrank.js

36 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-09-08 03:05:52 +02:00
const { Command } = require('discord.js-commando');
2018-09-09 20:34:09 +02:00
module.exports = class AssignRankCommand extends Command {
2018-09-08 03:05:52 +02:00
constructor(client) {
super(client, {
2018-09-09 20:19:15 +02:00
name: 'assignrank',
2018-09-08 03:05:52 +02:00
group: 'admin',
2018-09-09 20:34:09 +02:00
memberName: 'assignrank',
2018-09-08 03:05:52 +02:00
description: 'Assign a rank to the mentionned user',
clientPermissions: ['MANAGE_ROLES'],
2018-09-09 20:33:34 +02:00
userPermissions: ['MANAGE_ROLES'],
2018-09-08 03:05:52 +02:00
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',
}
]
});
}
2018-09-09 21:32:08 +02:00
async run(message, { rank, member }) {
2018-09-08 03:05:52 +02:00
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");
2018-09-09 20:33:34 +02:00
} else
2018-09-08 03:05:52 +02:00
member.addRole(role);
message.say(`You successfully gived the rank **${rank}** to **${member}**`);
}
};