const { Setting } = require('../../../../interfaces/'); const options = require('../../../../../options.json'); 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 }); } async handle(message, params) { const [ prefix ] = params; const MaxCharacters = 6; if(prefix.length > MaxCharacters) return { msg: message.format('S_GUILDPREFIX_LENGTH', { length: prefix.length, max: MaxCharacters }), error: true }; if(prefix.includes(' ')) return { msg: message.format('S_GUILDPREFIX_SPACES'), error: true }; await message.guild._updateSettings({ [this.index]: prefix }); return { msg: message.format('S_GUILDPREFIX_SUCCESS', { prefix }), error: false }; } fields(guild) { return { name: '》Prefix', value: `\`${guild.prefix}\`` }; } } module.exports = GuildPrefixSetting;