This commit is contained in:
Erik 2022-03-28 01:41:42 +03:00
parent 96e0b5f85c
commit 5c80bbe715
Signed by untrusted user: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -28,11 +28,10 @@ class FilterSetting extends Setting {
result = await this._removeAction(interaction, actions);
index = 'SETTING_FILTER_ACTION_REMOVE';
} else if (method === 'list') {
this._listActions(interaction, actions);
return;
return this._listActions(interaction, actions);
} else if (method === 'reset') {
result = {};
actions = [];
actions.splice(0);
index = 'SETTING_FILTER_ACTION_RESET';
}
this.client.logger.debug(`_action result: ${inspect(result)}`);
@ -72,13 +71,14 @@ class FilterSetting extends Setting {
this.client.logger.debug(`_createAction content: ${action}`);
const { resolver } = this.client;
const infType = resolver.resolveInfraction(action);
let infType = resolver.resolveInfraction(action);
if ((!infType
|| !validInfractions.includes(infType))
&& !['del', 'delete'].includes(action)) return {
error: true,
message: interaction.format('SETTING_FILTER_INVALID_INFRACTION', { valid: validInfractions.join('`, `') })
};
if (!infType && ['del', 'delete'].includes(action)) infType = 'DELETE';
actionObject.type = infType;
//Add a duration to the action
@ -176,6 +176,16 @@ class FilterSetting extends Setting {
}
async _listActions(interaction, actions) {
if (!actions.length) return { content: interaction.format('SETTING_FILTER_NOACTIONS') };
return {
content: interaction.format('SETTING_FILTER_CURRENT_ACTIONS'),
embeds: [this._createActionEmbed(interaction, actions)]
};
}
async _createTrigger() {
throw new Error(`${this.name} requires an implementation for \`_createTrigger\``);
}
@ -351,9 +361,9 @@ class FilterSetting extends Setting {
name: `**[${actions.indexOf(action)}]** ${action.type}`,
value: interaction.format('SETTING_FILTER_ACTION_PROPERTIES', {
duration: action.duration ? Util.humanise(action.duration) : 'INF',
points: action.points || interaction.format('ON_OFF_TOGGLE', { toggle: false }, true),
prune: interaction.format('ON_OFF_TOGGLE', { toggle: action.prune }, true),
force: interaction.format('ON_OFF_TOGGLE', { toggle: action.force }, true),
points: action.points || interaction.format('GENERAL_STATE', { bool: false }, { code: true }),
prune: interaction.format('GENERAL_STATE', { bool: action.prune }, { code: true }),
force: interaction.format('GENERAL_STATE', { bool: action.force }, { code: true }),
trigger: action.trigger instanceof Array ? action.trigger.join(', ') : '`' + action.trigger + '`'
}),
inline: true