mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
Remove Role Stuff
This commit is contained in:
@@ -5,6 +5,5 @@
|
||||
"joinMsg",
|
||||
"leaveMsg",
|
||||
"staffRole",
|
||||
"singleRole",
|
||||
"openRoles"
|
||||
"singleRole"
|
||||
]
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
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(`The ${role.name} role is not open.`);
|
||||
if (msg.member.roles.has(role.id)) return msg.say(`You already have the ${role.name} role.`);
|
||||
msg.member.addRole(role);
|
||||
return msg.say(`You have been given the ${role.name} role.`);
|
||||
}
|
||||
};
|
||||
@@ -1,51 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
|
||||
module.exports = class OpenRolesCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'open-roles',
|
||||
group: 'settings',
|
||||
memberName: 'open-roles',
|
||||
description: 'Lets you add or remove roles open for anyone to join.',
|
||||
guildOnly: true,
|
||||
args: [
|
||||
{
|
||||
key: 'action',
|
||||
prompt: 'Would you like to `add` or `remove` the role?',
|
||||
type: 'string',
|
||||
validate: action => {
|
||||
if (['add', 'remove'].includes(action.toLowerCase())) return true;
|
||||
return 'Please enter either `add` or `remove`.';
|
||||
},
|
||||
parse: action => action.toLowerCase()
|
||||
},
|
||||
{
|
||||
key: 'role',
|
||||
prompt: 'Which role would you like to add/remove?',
|
||||
type: 'role'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
hasPermission(msg) {
|
||||
return msg.member.hasPermission('ADMINISTRATOR');
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
const { action, role } = args;
|
||||
const roles = msg.guild.settings.get('openRoles', new Set());
|
||||
if (action === 'add') {
|
||||
if (roles.size > 5) return msg.say('Only 5 roles may be open.');
|
||||
if (roles.has(role.id)) return msg.say(`${role.name} is already set to open.`);
|
||||
roles.add(role.id);
|
||||
msg.guild.settings.set('openRoles', roles);
|
||||
return msg.say(`${role.name} has been added to the open roles.`);
|
||||
} else if (action === 'remove') {
|
||||
if (!roles.has(role.id)) return msg.say(`${role.name} is not set to open.`);
|
||||
roles.delete(role.id);
|
||||
msg.guild.settings.set('openRoles', roles);
|
||||
return msg.say(`${role.name} has been remove from the open roles.`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
|
||||
module.exports = class RemoveRoleCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'remove-role',
|
||||
group: 'settings',
|
||||
memberName: 'remove-role',
|
||||
description: 'Removes you from one of the open roles.',
|
||||
guildOnly: true,
|
||||
args: [
|
||||
{
|
||||
key: 'role',
|
||||
prompt: 'Which role would you like to remove?',
|
||||
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(`The ${role.name} role is not open.`);
|
||||
if (!msg.member.roles.has(role.id)) return msg.say(`You do not have the ${role.name} role.`);
|
||||
msg.member.removeRole(role);
|
||||
return msg.say(`You have been removed from the ${role.name} role.`);
|
||||
}
|
||||
};
|
||||
@@ -26,7 +26,6 @@ module.exports = class SettingListCommand extends Command {
|
||||
**Join Message:** ${msg.guild.settings.get('joinMsg', 'Welcome <user>! (Default)')}
|
||||
**Leave Message:** ${msg.guild.settings.get('leaveMsg', 'Bye <user>... (Default)')}
|
||||
**Single Role:** ${singleRole ? (msg.guild.roles.has(singleRole) ? msg.guild.roles.get(singleRole).name : 'Missing') : 'None'}
|
||||
**Open Roles:** ${msg.guild.settings.get('openRoles').size}
|
||||
`);
|
||||
}
|
||||
};
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "19.11.0",
|
||||
"version": "19.10.3",
|
||||
"description": "A Discord Bot",
|
||||
"main": "shardingmanager.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user