forked from Galactic/galactic-bot
stickyrole setting
This commit is contained in:
parent
66a9b997d0
commit
7ebca4bae2
65
structure/client/components/settings/utility/StickyRole.js
Normal file
65
structure/client/components/settings/utility/StickyRole.js
Normal file
@ -0,0 +1,65 @@
|
||||
const { Setting } = require('../../../../interfaces/');
|
||||
|
||||
class StickyRoleSetting extends Setting {
|
||||
|
||||
constructor(client) {
|
||||
|
||||
super(client, {
|
||||
name: 'stickyrole',
|
||||
module: 'utility',
|
||||
aliases: [
|
||||
'sticky'
|
||||
],
|
||||
usage: '<value>',
|
||||
examples: [
|
||||
'stickyrole on'
|
||||
],
|
||||
guarded: false,
|
||||
resolve: 'GUILD',
|
||||
default: {
|
||||
stickyrole: {
|
||||
enabled: false
|
||||
}
|
||||
},
|
||||
custom: true,
|
||||
premium: 1
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async handle(message, params) {
|
||||
|
||||
const { guild } = message;
|
||||
const setting = guild._settings[this.index];
|
||||
const { resolver } = this.client;
|
||||
const langParams = {};
|
||||
let index = null;
|
||||
|
||||
if (resolver.resolveBoolean(params[0]) !== null) {
|
||||
setting.enabled = resolver.resolveBoolean(params[0]);
|
||||
index = 'S_STICKYROLE_TOGGLE';
|
||||
langParams.toggle = message.format('ON_OFF_TOGGLE', { toggle: setting.enabled }, true);
|
||||
}
|
||||
|
||||
await message.guild._updateSettings({ [this.index]: setting });
|
||||
return {
|
||||
error: false,
|
||||
msg: message.format(index, langParams)
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
async fields(guild) {
|
||||
const setting = guild._settings[this.index] || this.default[this.index];
|
||||
return [
|
||||
{
|
||||
name: '》Enabled',
|
||||
value: setting.enabled,
|
||||
inline: false
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = StickyRoleSetting;
|
Loading…
Reference in New Issue
Block a user