galactic-bot/structure/client/components/settings/utility/Premium.js

47 lines
1.1 KiB
JavaScript

const { Setting } = require('../../../../interfaces/');
class PremiumSetting extends Setting {
constructor(client) {
super(client, {
name: 'premium',
module: 'utility',
guarded: true,
resolve: 'GUILD',
default: {
premium: 0
},
archivable: false
});
}
async handle(message, params) {
const [ type ] = params;
const int = parseInt(type);
if(!message.author.developer) return { error: true, ignore: true };
if(![0, 1, 2, 3].includes(int)) return {
msg: `Invalid premium type, must be \`0\`, \`1\`, \`2\`, or \`3\`.`,
error: true
};
await message.guild._updateSettings({ [this.index]: int });
return {
msg: `Successfully set the premium type to \`${int}\`.`,
error: false
};
}
fields(guild) {
return {
name: "》Premium",
value: `\`${guild.premium}\``
};
}
}
module.exports = PremiumSetting;