mirror of
https://github.com/janderedev/automod.git
synced 2024-12-22 18:55:28 +00:00
add custom rule channel filtering
This commit is contained in:
parent
66babfc40e
commit
1152108621
|
@ -11,6 +11,11 @@ async function messageContentTrigger(message: Message, trigger: CustomRuleTrigge
|
||||||
|
|
||||||
let matched = false;
|
let matched = false;
|
||||||
if (trigger.matcher) {
|
if (trigger.matcher) {
|
||||||
|
if (trigger.channelFilter) {
|
||||||
|
if (trigger.channelFilter.mode == 'WHITELIST' && !trigger.channelFilter.channels.includes(message.channel_id)) return false;
|
||||||
|
if (trigger.channelFilter.mode == 'BLACKLIST' && trigger.channelFilter.channels.includes(message.channel_id)) return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (trigger.matcher instanceof RegExp) {
|
if (trigger.matcher instanceof RegExp) {
|
||||||
/**
|
/**
|
||||||
* Since users will eventually be able to provide regexes, we need to protect
|
* Since users will eventually be able to provide regexes, we need to protect
|
||||||
|
|
|
@ -10,6 +10,13 @@ class CustomRuleTrigger {
|
||||||
|
|
||||||
userFilter?: 'user' | 'bot' | 'any';
|
userFilter?: 'user' | 'bot' | 'any';
|
||||||
|
|
||||||
|
channelFilter?: {
|
||||||
|
// Whitelist only triggers the rule in specified channels,
|
||||||
|
// Blacklist only triggers the rule in channels not specified
|
||||||
|
mode: 'WHITELIST'|'BLACKLIST',
|
||||||
|
channels: string[],
|
||||||
|
}
|
||||||
|
|
||||||
// The minimum delay between rule matches. If omitted, rule matches every message
|
// The minimum delay between rule matches. If omitted, rule matches every message
|
||||||
timeout?: {
|
timeout?: {
|
||||||
perUser?: number;
|
perUser?: number;
|
||||||
|
|
Loading…
Reference in a new issue