forked from Galactic/galactic-bot
clean up reset prompt
This commit is contained in:
parent
7043e8f259
commit
fa1258b9ea
@ -26,6 +26,9 @@ Respond with what you want to **remove** from the **{list}** list.
|
||||
[SETTING_PROMPT_SET]
|
||||
Respond with what you want to **set** the **{list}** list to.
|
||||
|
||||
[SETTING_PROMPT_RESET]
|
||||
Are you sure you want to reset the option?
|
||||
|
||||
// General filter stuff
|
||||
[SETTING_FILTER_ACTION_ADD]
|
||||
Successfully added a **{type}** action for {trigger} filter events.
|
||||
|
@ -55,6 +55,9 @@ class IgnoreSetting extends Setting {
|
||||
params: { list: list.value }
|
||||
});
|
||||
if (response.error) return response;
|
||||
if (method.value === 'reset' && !this.client.resolver.resolveBoolean(response)) {
|
||||
return { index: 'SETTING_NO_CHANGE' };
|
||||
}
|
||||
const params = Util.parseQuotes(response).map(([param]) => param);
|
||||
|
||||
let values = [];
|
||||
|
@ -69,6 +69,9 @@ class ProtectionSetting extends Setting {
|
||||
params: { list: 'roles' }
|
||||
});
|
||||
if (response.error) return response;
|
||||
if (roles.value === 'reset' && !this.client.resolver.resolveBoolean(response)) {
|
||||
return { index: 'SETTING_NO_CHANGE' };
|
||||
}
|
||||
|
||||
const { guild } = interaction;
|
||||
const params = Util.parseQuotes(response).map(([param]) => param);
|
||||
|
@ -107,14 +107,23 @@ class DmInfraction extends Setting {
|
||||
if (anonymous) setting.anonymous = anonymous.value;
|
||||
|
||||
if (infractions) {
|
||||
const extra = `\n\n${interaction.format('SETTING_DMINFRACTION_VALID', {
|
||||
valid: Infractions.join(`, `)
|
||||
})}`;
|
||||
const reset = infractions.value === 'reset';
|
||||
const response = await this._prompt(interaction, {
|
||||
message: `${interaction.format(`SETTING_PROMPT_${infractions.value.toUpperCase()}`, {
|
||||
list: 'infractions'
|
||||
})}\n\n${interaction.format('SETTING_DMINFRACTION_VALID', {
|
||||
valid: Infractions.join(`, `)
|
||||
})}`
|
||||
})}${reset ? '' : extra}`
|
||||
});
|
||||
if (response.error) return response;
|
||||
if (reset) {
|
||||
if (this.client.resolver.resolveBoolean(response)) {
|
||||
setting.infractions = [...Infractions];
|
||||
return { index };
|
||||
}
|
||||
return { index: 'SETTING_NO_CHANGE' };
|
||||
}
|
||||
|
||||
const infs = response.split(' ')
|
||||
.map((inf) => this.client.resolver.resolveInfraction(inf))
|
||||
|
@ -114,6 +114,9 @@ class MessageLog extends Setting {
|
||||
time
|
||||
});
|
||||
if (content.error) return content;
|
||||
if (method.value === 'reset' && !this.client.resolver.resolveBoolean(content)) {
|
||||
return { index: 'SETTING_NO_CHANGE' };
|
||||
}
|
||||
|
||||
const words = Util.parseQuotes(content).map(([word]) => word);
|
||||
|
||||
|
@ -85,14 +85,23 @@ class ModerationLog extends Setting {
|
||||
if (enabled) setting.enabled = enabled.value;
|
||||
|
||||
if (infractions) {
|
||||
const extra = `\n\n${interaction.format('SETTING_DMINFRACTION_VALID', {
|
||||
valid: Infractions.join(`, `)
|
||||
})}`;
|
||||
const reset = infractions.value === 'reset';
|
||||
const response = await this._prompt(interaction, {
|
||||
message: `${interaction.format(`SETTING_PROMPT_${infractions.value.toUpperCase()}`, {
|
||||
list: 'infractions'
|
||||
})}\n\n${interaction.format('SETTING_DMINFRACTION_VALID', {
|
||||
valid: Infractions.join(`, `)
|
||||
})}`
|
||||
})}${reset ? '' : extra}`
|
||||
});
|
||||
if (response.error) return response;
|
||||
if (reset) {
|
||||
if (this.client.resolver.resolveBoolean(response)) {
|
||||
setting.infractions = [...Infractions];
|
||||
return { index };
|
||||
}
|
||||
return { index: 'SETTING_NO_CHANGE' };
|
||||
}
|
||||
|
||||
const infs = response.split(' ')
|
||||
.map((inf) => this.client.resolver.resolveInfraction(inf))
|
||||
|
@ -52,6 +52,9 @@ class Grantable extends Setting {
|
||||
params: { list: 'roles' }
|
||||
});
|
||||
if (response.error) return response;
|
||||
if (roles.value === 'reset' && !this.client.resolver.resolveBoolean(response)) {
|
||||
return { index: 'SETTING_NO_CHANGE' };
|
||||
}
|
||||
|
||||
const { guild } = interaction;
|
||||
const params = Util.parseQuotes(response).map(([param]) => param);
|
||||
|
@ -107,6 +107,9 @@ class InviteFilterSetting extends FilterSetting {
|
||||
time
|
||||
});
|
||||
if (content.error) return content;
|
||||
if (method.value === 'reset' && !this.client.resolver.resolveBoolean(content)) {
|
||||
return { index: 'SETTING_NO_CHANGE' };
|
||||
}
|
||||
|
||||
const words = Util.parseQuotes(content).map(([word]) => word);
|
||||
let params = [];
|
||||
|
@ -125,6 +125,9 @@ class LinkFilterSetting extends FilterSetting {
|
||||
time
|
||||
});
|
||||
if (content.error) return content;
|
||||
if (method.value === 'reset' && !this.client.resolver.resolveBoolean(content)) {
|
||||
return { index: 'SETTING_NO_CHANGE' };
|
||||
}
|
||||
|
||||
const words = Util.parseQuotes(content).map(([word]) => word),
|
||||
invalid = [];
|
||||
|
@ -101,6 +101,9 @@ class MentionFilter extends FilterSetting {
|
||||
time
|
||||
});
|
||||
if (content.error) return content;
|
||||
if (method.value === 'reset' && !this.client.resolver.resolveBoolean(content)) {
|
||||
return { index: 'SETTING_NO_CHANGE' };
|
||||
}
|
||||
|
||||
const words = Util.parseQuotes(content).map(([word]) => word);
|
||||
let params = [];
|
||||
|
@ -116,6 +116,9 @@ class WordFilterSetting extends FilterSetting {
|
||||
time
|
||||
});
|
||||
if (content.error) return content;
|
||||
if (method.value === 'reset' && !this.client.resolver.resolveBoolean(content)) {
|
||||
return { index: 'SETTING_NO_CHANGE' };
|
||||
}
|
||||
|
||||
const words = Util.parseQuotes(content).map(([word]) => word),
|
||||
invalid = [];
|
||||
|
@ -80,6 +80,9 @@ class WordWatcher extends FilterSetting {
|
||||
time
|
||||
});
|
||||
if (content.error) return content;
|
||||
if (method.value === 'reset' && !this.client.resolver.resolveBoolean(content)) {
|
||||
return { index: 'SETTING_NO_CHANGE' };
|
||||
}
|
||||
|
||||
const words = Util.parseQuotes(content).map(([word]) => word),
|
||||
invalid = [];
|
||||
|
@ -56,6 +56,9 @@ class Autorole extends Setting {
|
||||
time
|
||||
});
|
||||
if (content.error) return content;
|
||||
if (method.value === 'reset' && !this.client.resolver.resolveBoolean(content)) {
|
||||
return { index: 'SETTING_NO_CHANGE' };
|
||||
}
|
||||
|
||||
const words = Util.parseQuotes(content).map(([word]) => word);
|
||||
const params = (await guild.resolveRoles(words)).filter((r) => !r.managed);
|
||||
|
@ -48,6 +48,10 @@ class SelfroleSetting extends Setting {
|
||||
params: { list: 'roles' }
|
||||
});
|
||||
if (response.error) return response;
|
||||
if (roles.value === 'reset' && !this.client.resolver.resolveBoolean(response)) {
|
||||
return { index: 'SETTING_NO_CHANGE' };
|
||||
}
|
||||
|
||||
const params = Util.parseQuotes(response).map(([param]) => param);
|
||||
const values = (await guild.resolveRoles(params)).filter((r) => !r.managed).map((r) => r.id);
|
||||
this[roles.value](setting.roles, values);
|
||||
|
@ -56,6 +56,9 @@ class Autorole extends Setting {
|
||||
time
|
||||
});
|
||||
if (content.error) return content;
|
||||
if (method.value === 'reset' && !this.client.resolver.resolveBoolean(content)) {
|
||||
return { index: 'SETTING_NO_CHANGE' };
|
||||
}
|
||||
|
||||
const words = Util.parseQuotes(content).map(([word]) => word);
|
||||
const params = (await guild.resolveRoles(words)).filter((r) => !r.managed);
|
||||
|
Loading…
Reference in New Issue
Block a user