From ffecf1ed155342b5cd8dca114099d19084b236a4 Mon Sep 17 00:00:00 2001 From: kennnyshiwa <44236678+kennnyshiwa@users.noreply.github.com> Date: Thu, 2 Apr 2020 03:11:12 -0400 Subject: [PATCH] Fix `redbot.core.utils.common_filters.INVITE_URL_RE` regex (#3717) * Fix invite_url_re Found that the regex used previously could falsely catch strings such as discord member and discord gggggg which aren't invites and shouldn't be caught, testing with this regex string still catches all invite url variations while allowing these other previously caught strings to keep working * Update redbot/core/utils/common_filters.py Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com> Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com> --- redbot/core/utils/common_filters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redbot/core/utils/common_filters.py b/redbot/core/utils/common_filters.py index 608a6be52..d758a3565 100644 --- a/redbot/core/utils/common_filters.py +++ b/redbot/core/utils/common_filters.py @@ -16,7 +16,7 @@ __all__ = [ # regexes URL_RE = re.compile(r"(https?|s?ftp)://(\S+)", re.I) -INVITE_URL_RE = re.compile(r"(discord.gg|discordapp.com/invite|discord.me)(\S+)", re.I) +INVITE_URL_RE = re.compile(r"(discord\.(?:gg|io|me|li)|discordapp\.com\/invite)\/(\S+)", re.I) MASS_MENTION_RE = re.compile(r"(@)(?=everyone|here)") # This only matches the @ for sanitizing