mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-09 01:04:16 +02:00
30 lines
934 B
JavaScript
30 lines
934 B
JavaScript
const { Command } = require('discord.js-commando');
|
|
|
|
module.exports = class AddRoleCommand extends Command {
|
|
constructor(client) {
|
|
super(client, {
|
|
name: 'add-role',
|
|
group: 'settings',
|
|
memberName: 'add-role',
|
|
description: 'Joins you to one of the open roles.',
|
|
guildOnly: true,
|
|
args: [
|
|
{
|
|
key: 'role',
|
|
prompt: 'Which role would you like to add?',
|
|
type: 'role'
|
|
}
|
|
]
|
|
});
|
|
}
|
|
|
|
run(msg, args) {
|
|
const { role } = args;
|
|
const roles = msg.guild.settings.get('openRoles');
|
|
if (!roles) return msg.say('No Roles are open to join.');
|
|
if (!roles.has(role.id)) return msg.say('This role is not open.');
|
|
msg.member.addRole(role);
|
|
return msg.say(`You have been given the ${role.name} role.`);
|
|
}
|
|
};
|