mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-18 08:43:57 +00:00
fix(bots/discord): correct whitelist logic
This commit is contained in:
@@ -87,7 +87,7 @@ export const getResponseFromText = async (
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we still don't have a response config, we can match all regexes after the initial label trigger
|
// If we still don't have a response config, we can match all regexes after the initial label trigger
|
||||||
if (!responseConfig.triggers) {
|
if (!responseConfig.triggers && ocrMode) {
|
||||||
logger.debug('No match from NLP, doing after regexes')
|
logger.debug('No match from NLP, doing after regexes')
|
||||||
for (let i = 0; i < responses.length; i++) {
|
for (let i = 0; i < responses.length; i++) {
|
||||||
const {
|
const {
|
||||||
@@ -122,17 +122,19 @@ export const messageMatchesFilter = (message: Message, filter: NonNullable<Confi
|
|||||||
// If matches whitelist but also matches blacklist, will return false
|
// If matches whitelist but also matches blacklist, will return false
|
||||||
// If matches only whitelist, will return true
|
// If matches only whitelist, will return true
|
||||||
// If matches neither, will return true
|
// If matches neither, will return true
|
||||||
return whitelist
|
return (
|
||||||
? (whitelist.channels?.includes(message.channelId) ?? true) ||
|
(whitelist
|
||||||
(whitelist.roles?.some(role => memberRoles.has(role)) ?? true) ||
|
? whitelist.channels?.includes(message.channelId) ||
|
||||||
(whitelist.users?.includes(message.author.id) ?? true)
|
whitelist.roles?.some(role => memberRoles.has(role)) ||
|
||||||
: true &&
|
whitelist.users?.includes(message.author.id)
|
||||||
!(
|
: true) &&
|
||||||
blacklist &&
|
!(
|
||||||
(blacklist.channels?.includes(message.channelId) ||
|
blacklist &&
|
||||||
blacklist.roles?.some(role => memberRoles.has(role)) ||
|
(blacklist.channels?.includes(message.channelId) ||
|
||||||
blacklist.users?.includes(message.author.id))
|
blacklist.roles?.some(role => memberRoles.has(role)) ||
|
||||||
)
|
blacklist.users?.includes(message.author.id))
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const handleUserResponseCorrection = async (
|
export const handleUserResponseCorrection = async (
|
||||||
|
|||||||
Reference in New Issue
Block a user