forked from Galactic/galactic-bot
63 lines
1.4 KiB
JavaScript
63 lines
1.4 KiB
JavaScript
const { Setting } = require('../../../../interfaces/');
|
|
|
|
class GuildPrefixSetting extends Setting {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
name: 'guildPrefix',
|
|
index: 'prefix',
|
|
module: 'utility',
|
|
display: 'prefix',
|
|
aliases: [
|
|
'prefix'
|
|
],
|
|
guarded: true,
|
|
resolve: 'GUILD',
|
|
default: {
|
|
prefix: '-'
|
|
},
|
|
custom: true
|
|
});
|
|
|
|
this.client = client;
|
|
|
|
}
|
|
|
|
async handle(message, params, operator) {
|
|
|
|
if (operator === 'RESET') {
|
|
return await super._handleReset(message, params);
|
|
}
|
|
|
|
// let { params, parsedArguments } = await this._parseArguments(params);
|
|
|
|
let [ prefix ] = params;
|
|
|
|
const MaxCharacters = 6;
|
|
if(prefix.length > MaxCharacters) return {
|
|
msg: message.format('S_GUILDPREFIX_LENGTH', { length: prefix.length, max: MaxCharacters }),
|
|
error: true
|
|
};
|
|
|
|
await message.guild._updateSettings({ prefix });
|
|
return {
|
|
msg: message.format(`S_${this.name.toUpperCase()}_SUCCESS`, { prefix }),
|
|
error: false
|
|
};
|
|
|
|
}
|
|
|
|
fields(guild) {
|
|
return [
|
|
{
|
|
name: "》Prefix",
|
|
value: `\`${guild.prefix}\``
|
|
}
|
|
];
|
|
}
|
|
|
|
|
|
}
|
|
|
|
module.exports = GuildPrefixSetting; |