From 343f45154199458473f116d608dccb883d94ffe4 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Mon, 28 Mar 2022 01:41:01 +0300 Subject: [PATCH] perm types --- .../settings/administration/PermissionType.js | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/structure/components/settings/administration/PermissionType.js 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