put point expiration behind a condition

This commit is contained in:
Erik 2021-05-06 20:22:18 +03:00
parent fde694b36a
commit 10d4c5cebf

View File

@ -70,19 +70,21 @@ module.exports = class FilterSetting extends Setting {
}
// Expiration
response = await message.prompt(message.format('S_FILTER_ACTION_ADD_EXPIRATION'));
if (!response) return { error: true, msg: message.format('ERR_TIMEOUT') };
if (['cancel', 'abort', 'exit'].includes(action.toLowerCase())) return {
error: true,
msg: message.format('ERR_CANCEL')
};
if (actionObject.points) {
response = await message.prompt(message.format('S_FILTER_ACTION_ADD_EXPIRATION'));
if (!response) return { error: true, msg: message.format('ERR_TIMEOUT') };
if (['cancel', 'abort', 'exit'].includes(action.toLowerCase())) return {
error: true,
msg: message.format('ERR_CANCEL')
};
if (!['no', 'n'].includes(response.content.toLowerCase())) {
if (!['no', 'n'].includes(response.content.toLowerCase())) {
const time = resolver.resolveTime(response.content);
if (!time) message.formattedRespond('S_FILTER_ACTION_ADD_EXPIRATION_FAIL');
else actionObject.expiration = time;
const time = resolver.resolveTime(response.content);
if (!time) message.formattedRespond('S_FILTER_ACTION_ADD_EXPIRATION_FAIL');
else actionObject.expiration = time;
}
}
}