premium and exact matching

This commit is contained in:
Erik 2020-07-11 23:40:25 +03:00
parent 978f7eabd9
commit 4583302799

View File

@ -68,7 +68,7 @@ class SettingsCommand extends Command {
return await this._handleReset(prompt, message, type); return await this._handleReset(prompt, message, type);
} }
const settings = this.client.resolver.components(target, 'setting', false).sort(c=>c.resolve === type); const settings = this.client.resolver.components(target, 'setting', true).sort(c=>c.resolve === type);
const [ setting ] = settings; const [ setting ] = settings;
if(!setting) { if(!setting) {
await message.respond(message.format('C_SETTINGS_NONEXISTANT'), { emoji: 'failure' }); await message.respond(message.format('C_SETTINGS_NONEXISTANT'), { emoji: 'failure' });
@ -98,6 +98,8 @@ class SettingsCommand extends Command {
return message.respond(msg, { emoji: 'success' }); return message.respond(msg, { emoji: 'success' });
} }
if (setting.premium > message.guild.premium) return message.formattedRespond('PREMIUM_REQUIRED', { emoji: 'failure', params: { tier: message.guild.premium, required: setting.premium } });
const response = await setting.handle(message, parameters); const response = await setting.handle(message, parameters);
if(response.ignore) return undefined; if(response.ignore) return undefined;
message.respond(response.msg, { emoji: response.error ? 'failure' : 'success', embed: response.embed || null }); message.respond(response.msg, { emoji: response.error ? 'failure' : 'success', embed: response.embed || null });