automod: only match highlighted links in match_links by default
This commit is contained in:
parent
96f44b873e
commit
37704069f1
2 changed files with 7 additions and 0 deletions
|
@ -116,6 +116,7 @@ const defaultMatchLinksTrigger: Partial<TMatchLinksTrigger> = {
|
||||||
match_usernames: false,
|
match_usernames: false,
|
||||||
match_nicknames: false,
|
match_nicknames: false,
|
||||||
match_custom_status: false,
|
match_custom_status: false,
|
||||||
|
only_real_links: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultMatchAttachmentTypeTrigger: Partial<TMatchAttachmentTypeTrigger> = {
|
const defaultMatchAttachmentTypeTrigger: Partial<TMatchAttachmentTypeTrigger> = {
|
||||||
|
@ -456,6 +457,11 @@ export class AutomodPlugin extends ZeppelinPlugin<TConfigSchema, ICustomOverride
|
||||||
const links = getUrlsInString(str, true);
|
const links = getUrlsInString(str, true);
|
||||||
|
|
||||||
for (const link of links) {
|
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();
|
const normalizedHostname = link.hostname.toLowerCase();
|
||||||
|
|
||||||
// Exclude > Include
|
// Exclude > Include
|
||||||
|
|
|
@ -174,6 +174,7 @@ export const MatchLinksTrigger = t.type({
|
||||||
exclude_words: tNullable(t.array(t.string)),
|
exclude_words: tNullable(t.array(t.string)),
|
||||||
include_regex: tNullable(t.array(TSafeRegex)),
|
include_regex: tNullable(t.array(TSafeRegex)),
|
||||||
exclude_regex: tNullable(t.array(TSafeRegex)),
|
exclude_regex: tNullable(t.array(TSafeRegex)),
|
||||||
|
only_real_links: t.boolean,
|
||||||
match_messages: t.boolean,
|
match_messages: t.boolean,
|
||||||
match_embeds: t.boolean,
|
match_embeds: t.boolean,
|
||||||
match_visible_names: t.boolean,
|
match_visible_names: t.boolean,
|
||||||
|
|
Loading…
Add table
Reference in a new issue