linkfilter whitelist mode
This commit is contained in:
parent
7c58b3e831
commit
2aac46ffc3
@ -2,6 +2,9 @@
|
|||||||
[SETTING_FILTER_WHITELIST]
|
[SETTING_FILTER_WHITELIST]
|
||||||
》 Whitelist
|
》 Whitelist
|
||||||
|
|
||||||
|
[SETTING_FILTER_WHITELISTMODE]
|
||||||
|
》 Whitelist mode
|
||||||
|
|
||||||
[SETTING_FILTER_GREYLIST]
|
[SETTING_FILTER_GREYLIST]
|
||||||
》 Greylist
|
》 Greylist
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ class LinkFilterSetting extends FilterSetting {
|
|||||||
module: 'moderation',
|
module: 'moderation',
|
||||||
display: 'Link Filter',
|
display: 'Link Filter',
|
||||||
default: {
|
default: {
|
||||||
|
whitelistMode: false,
|
||||||
enabled: false,
|
enabled: false,
|
||||||
silent: false,
|
silent: false,
|
||||||
blacklist: [],
|
blacklist: [],
|
||||||
@ -30,6 +31,7 @@ class LinkFilterSetting extends FilterSetting {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
definitions: {
|
definitions: {
|
||||||
|
whitelistMode: 'BOOLEAN',
|
||||||
enabled: 'BOOLEAN',
|
enabled: 'BOOLEAN',
|
||||||
silent: 'BOOLEAN',
|
silent: 'BOOLEAN',
|
||||||
blacklist: { ARRAY: 'STRING' },
|
blacklist: { ARRAY: 'STRING' },
|
||||||
@ -73,6 +75,11 @@ class LinkFilterSetting extends FilterSetting {
|
|||||||
name: 'enabled',
|
name: 'enabled',
|
||||||
description: 'Toggle enable state'
|
description: 'Toggle enable state'
|
||||||
}),
|
}),
|
||||||
|
new CommandOption({
|
||||||
|
type: 'BOOLEAN',
|
||||||
|
name: 'whitelist',
|
||||||
|
description: 'Toggle whitelist mode'
|
||||||
|
}),
|
||||||
new CommandOption({
|
new CommandOption({
|
||||||
type: 'BOOLEAN',
|
type: 'BOOLEAN',
|
||||||
name: 'silent',
|
name: 'silent',
|
||||||
@ -94,9 +101,11 @@ class LinkFilterSetting extends FilterSetting {
|
|||||||
const list = opts.list?.value;
|
const list = opts.list?.value;
|
||||||
const enabled = opts.enabled?.value;
|
const enabled = opts.enabled?.value;
|
||||||
const silent = opts.silent?.value;
|
const silent = opts.silent?.value;
|
||||||
|
const whitelistMode = opts.whitelist?.value;
|
||||||
|
|
||||||
if (typeof silent === 'boolean') setting.silent = silent;
|
if (typeof silent === 'boolean') setting.silent = silent;
|
||||||
if (typeof enabled === 'boolean') setting.enabled = enabled;
|
if (typeof enabled === 'boolean') setting.enabled = enabled;
|
||||||
|
if (typeof whitelistMode === 'boolean') setting.whitelistMode = whitelistMode;
|
||||||
|
|
||||||
if (method === 'edit' && list !== 'actions')
|
if (method === 'edit' && list !== 'actions')
|
||||||
return { error: true, index: 'SETTING_FILTER_EDIT_INVALID' };
|
return { error: true, index: 'SETTING_FILTER_EDIT_INVALID' };
|
||||||
@ -157,7 +166,14 @@ class LinkFilterSetting extends FilterSetting {
|
|||||||
}, { code: true }),
|
}, { code: true }),
|
||||||
inline: true
|
inline: true
|
||||||
},
|
},
|
||||||
{ name: '\u200b', value: '\u200b', inline: true },
|
{
|
||||||
|
name: 'SETTING_FILTER_WHITELISTMODE',
|
||||||
|
value: guild.format('GENERAL_STATE', {
|
||||||
|
bool: Boolean(setting.whitelistMode)
|
||||||
|
}, { code: true }),
|
||||||
|
inline: true
|
||||||
|
},
|
||||||
|
//{ name: '\u200b', value: '\u200b', inline: true },
|
||||||
{
|
{
|
||||||
name: 'SETTING_FILTER_WHITELIST',
|
name: 'SETTING_FILTER_WHITELIST',
|
||||||
value: setting.whitelist.join(', ') || '**N/A**',
|
value: setting.whitelist.join(', ') || '**N/A**',
|
||||||
|
Loading…
Reference in New Issue
Block a user