galactic-bot/structure/interfaces/Setting.js

45 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-04-08 18:08:46 +02:00
const Component = require('./Component.js');
2020-04-08 16:27:34 +02:00
2020-04-08 18:08:46 +02:00
class Setting extends Component {
2020-04-08 16:27:34 +02:00
2020-04-08 18:08:46 +02:00
constructor(client, opts = {}) {
if(!opts) return null;
super(client, {
id: opts.name,
type: 'setting',
guarded: opts.guarded,
disabled: opts.disabled
});
this.name = opts.name;
this.module = opts.module;
this.restricted = Boolean(opts.restricted);
2020-05-05 15:33:14 +02:00
this.description = `S_${opts.name}_DESCRIPTION`;
this.examples = `S_${opts.name}_EXAMPLES`;
2020-04-08 18:08:46 +02:00
this.archiveable = Boolean(opts.archiveable);
this.index = opts.index || opts.name;
this.aliases = opts.aliases || [];
this.resolve = (opts.resolve && Constants.Resolves.includes(opts.resolve)) ? opts.resolve : 'GUILD';
this.default = opts.default;
this.memberPermissions = opts.memberPermissions || [];
this.clientPermissions = opts.clientPermissions || [];
}
2020-05-05 01:35:01 +02:00
2020-04-08 18:08:46 +02:00
2020-04-08 16:27:34 +02:00
}
2020-04-08 18:08:46 +02:00
module.exports = Setting;
const Constants = {
Resolves: [
'GUILD',
'USER'
]
};