perm types

This commit is contained in:
Erik 2022-03-28 01:41:01 +03:00
parent e1c2f4a554
commit 343f451541
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -0,0 +1,53 @@
const { Setting, CommandOption } = require('../../../interfaces/');
class PermissionType extends Setting {
constructor(client) {
super(client, {
name: 'permissions',
description: 'Change between discord and bot based permissions',
module: 'administration',
display: 'Permission Type',
default: {
type: 'discord'
},
definitions: {
type: 'STRING'
},
commandOptions: [
new CommandOption({
type: 'STRING',
name: 'type',
choices: [
{ name: 'discord', value: 'discord' },
{ name: 'both', value: 'both' },
{ name: 'grant', value: 'grant' }
]
})
]
});
}
async execute(interaction, opts, setting) {
const { type } = opts;
setting.type = type.value;
return { index: 'SETTING_SUCCESS_ALT' };
}
async fields(guild) {
const setting = guild._settings[this.name];
return [
{
name: 'SETTING_PERMISSION_TYPE_FIELD',
value: '`' + setting.type + '`'
}
];
}
}
module.exports = PermissionType;