automod: only match highlighted links in match_links by default

This commit is contained in:
Dragory 2020-04-17 23:28:09 +03:00
parent 96f44b873e
commit 37704069f1
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1
2 changed files with 7 additions and 0 deletions

View file

@ -116,6 +116,7 @@ const defaultMatchLinksTrigger: Partial<TMatchLinksTrigger> = {
match_usernames: false,
match_nicknames: false,
match_custom_status: false,
only_real_links: true,
};
const defaultMatchAttachmentTypeTrigger: Partial<TMatchAttachmentTypeTrigger> = {
@ -456,6 +457,11 @@ export class AutomodPlugin extends ZeppelinPlugin<TConfigSchema, ICustomOverride
const links = getUrlsInString(str, true);
for (const link of links) {
// "real link" = a link that Discord highlights
if (trigger.only_real_links && !link.input.match(/^https?:\/\//i)) {
continue;
}
const normalizedHostname = link.hostname.toLowerCase();
// Exclude > Include

View file

@ -174,6 +174,7 @@ export const MatchLinksTrigger = t.type({
exclude_words: tNullable(t.array(t.string)),
include_regex: tNullable(t.array(TSafeRegex)),
exclude_regex: tNullable(t.array(TSafeRegex)),
only_real_links: t.boolean,
match_messages: t.boolean,
match_embeds: t.boolean,
match_visible_names: t.boolean,