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) { 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 }; if (prefix === 'reset') prefix = this.default.prefix; 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;