Single-Role Mode

This commit is contained in:
Daniel Odendahl Jr
2017-05-04 20:43:53 +00:00
parent b1444572d1
commit e560359445
4 changed files with 42 additions and 5 deletions
+3 -3
View File
@@ -11,12 +11,12 @@ module.exports = class ClearSettingCommand extends Command {
args: [
{
key: 'setting',
prompt: 'What setting do you want to clear? `modLog`, `memberLog`, or `staffRole`?',
prompt: 'What setting do you want to clear? `modLog`, `memberLog`, `staffRole`, or `singleRole`?',
type: 'string',
validate: setting => {
if(['modLog', 'memberLog', 'staffRole'].includes(setting))
if(['modLog', 'memberLog', 'staffRole', 'singleRole'].includes(setting))
return true;
return 'Please enter either `modLog`, `memberLog`, or `staffRole`.';
return 'Please enter either `modLog`, `memberLog`, `staffRole`, or `singleRole`.';
}
}
]
+30
View File
@@ -0,0 +1,30 @@
const { Command } = require('discord.js-commando');
module.exports = class SingleRoleCommand extends Command {
constructor(client) {
super(client, {
name: 'singlerole',
group: 'util',
memberName: 'singlerole',
description: 'Sets a single role that is able to use commands.',
guildOnly: true,
args: [
{
key: 'role',
prompt: 'What role should be able to use commands?',
type: 'role'
}
]
});
}
hasPermission(msg) {
return msg.member.hasPermission('ADMINISTRATOR');
}
run(msg, args) {
const { role } = args;
msg.guild.settings.set('singleRole', role.id);
return msg.say(`Single role mode has been enabled with the role ${role.name}.`);
}
};