2020-05-06 01:40:46 +02:00
|
|
|
const { Setting } = require('../../../../interfaces/');
|
|
|
|
|
|
|
|
class GuildPrefixSetting extends Setting {
|
|
|
|
|
2020-05-07 17:08:07 +02:00
|
|
|
constructor(client) {
|
2020-05-06 01:40:46 +02:00
|
|
|
|
|
|
|
super(client, {
|
|
|
|
name: 'guildPrefix',
|
|
|
|
index: 'prefix',
|
|
|
|
module: 'utility',
|
|
|
|
display: 'prefix',
|
|
|
|
aliases: [
|
|
|
|
'prefix'
|
|
|
|
],
|
|
|
|
guarded: true,
|
|
|
|
resolve: 'GUILD',
|
|
|
|
default: {
|
2020-05-07 17:08:07 +02:00
|
|
|
prefix: '-'
|
2020-05-06 01:40:46 +02:00
|
|
|
},
|
|
|
|
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_GPREFIX_LENGTH', { length: prefix.length, max: MaxCharacters }),
|
|
|
|
error: true
|
|
|
|
};
|
|
|
|
|
|
|
|
await message.guild._updateSettings({ prefix });
|
2020-05-07 17:08:07 +02:00
|
|
|
return {
|
2020-05-06 01:40:46 +02:00
|
|
|
msg: message.format(`S_${this.name.toUpperCase()}_SUCCESS`, { prefix }),
|
2020-05-07 17:08:07 +02:00
|
|
|
error: false
|
|
|
|
};
|
2020-05-06 01:40:46 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = GuildPrefixSetting;
|