mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-26 22:32:52 +02:00
Single-Role Mode
This commit is contained in:
@@ -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`.';
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -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}.`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user