diff --git a/src/structure/components/settings/administration/PermissionType.js b/src/structure/components/settings/administration/PermissionType.js new file mode 100644 index 0000000..2ace0d2 --- /dev/null +++ b/src/structure/components/settings/administration/PermissionType.js @@ -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; \ No newline at end of file