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