Custom Staff Role

This commit is contained in:
Daniel Odendahl Jr
2017-04-30 15:01:46 +00:00
parent b358602ebb
commit 2f831418fb
8 changed files with 67 additions and 6 deletions
+33
View File
@@ -0,0 +1,33 @@
const { Command } = require('discord.js-commando');
module.exports = class ClearSettingCommand extends Command {
constructor(client) {
super(client, {
name: 'clearsetting',
group: 'util',
memberName: 'clearsetting',
description: 'Removes a custom-set Mod Channel, Member Channel, or Staff Role.',
guildOnly: true,
args: [{
key: 'setting',
prompt: 'What setting do you want to clear? `modLog`, `memberLog`, or `staffRole`?',
type: 'string',
validate: setting => {
if (['modLog', 'memberLog', 'staffRole'].includes(setting))
return true;
return 'Please enter either `modLog`, `memberLog`, or `staffRole`.';
}
}]
});
}
hasPermission(msg) {
return msg.member.permissions.has('ADMINISTRATOR');
}
run(message, args) {
const { setting } = args;
message.guild.settings.remove(setting);
return message.say(`${setting} has been removed from your guild settings.`);
}
};
+28
View File
@@ -0,0 +1,28 @@
const { Command } = require('discord.js-commando');
module.exports = class StaffRoleCommand extends Command {
constructor(client) {
super(client, {
name: 'staffrole',
group: 'util',
memberName: 'staffrole',
description: 'Sets the role that can use Mod Commands without perms.',
guildOnly: true,
args: [{
key: 'role',
prompt: 'What role should be staff?',
type: 'role'
}]
});
}
hasPermission(msg) {
return msg.member.permissions.has('ADMINISTRATOR');
}
run(message, args) {
const { role } = args;
message.guild.settings.set('staffRole', role.name);
return message.say(`Server Staff role set to ${role.name}.`);
}
};