This commit is contained in:
Erik 2020-09-21 21:48:46 +03:00
parent 945781ae27
commit 4dda6b98fb

View File

@ -121,6 +121,15 @@ module.exports = class WordFilter extends Setting {
} else if (['action', 'actions'].includes(method)) {
/**
* TODO:
* Refactor this somehow so I can use the same stuff on all of the filter settings
* Maybe a bunch of static methods in the setting superclass?
* Alternatively have an action builder on the client.
*
* Either way, the trigger part would need to be implemented per setting
*/
const submethod = args.shift().toLowerCase();
const resolved = await resolver.resolveMethod([submethod], null, null, null, null, false, ['add', 'remove', 'edit', 'list']);
if (!resolved) return { error: true, msg: message.format('ERR_INVALID_METHOD', { method: submethod }) };
@ -143,7 +152,7 @@ module.exports = class WordFilter extends Setting {
if (result.error) return result;
//setting.actions.push(result);
console.log(result);
//console.log(result);
langParams = {
type: result.action,
duration: result.duration ? resolver.timeAgo(result.duration) : 'INF',
@ -469,7 +478,6 @@ module.exports = class WordFilter extends Setting {
async _editType(message, setting, action) {
const response = await message.prompt(message.format('S_WORDFILTER_ACTION_EDIT_TYPE', { valid: validInfractions.join('`, `') }), { time: 120 * 1000 });
const { resolver } = this.client;
if (!response) return { error: true, msg: message.format('ERR_TIMEOUT') };
if (['cancel', 'abort', 'exit'].includes(response.content.toLowerCase())) return {