Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine the invite code before filtering it #2522

Merged
merged 1 commit into from
Apr 17, 2023
Merged

Conversation

mbaruh
Copy link
Member

@mbaruh mbaruh commented Apr 7, 2023

Refines the invite to what it is most likely to be. If the refining process changes the invite code, then that means it originally wasn't a valid invite code. So the refining can find that the invite is actually whitelisted, or maybe it is explictly denied and that there's a specific action that needs to be taken.

For exmaple, for discord.gg/python. it will ignore the dot at the end.

Forward slashes (after discord.gg/) are included in the invite code because it can confuse Discord, so the behavior of blocking these invites stays unchanged for now.

@mbaruh mbaruh added t: bug Something isn't working p: 1 - high High Priority a: filters Related to message filters: (antimalware, antispam, filtering, token_remover) labels Apr 7, 2023
@@ -18,6 +19,13 @@
from bot.exts.filtering.filtering import Filtering


REFINED_INVITE_CODE = re.compile(
r"(?P<invite>[a-zA-Z0-9/]+)" # The supposedly real invite code.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to add a comment showing what an example invite code looks like? Difficult to understand what a real invite code looks like

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's really just a random combination of letters and numbers.

@ChrisLovering ChrisLovering merged commit 85bafc3 into main Apr 17, 2023
@ChrisLovering ChrisLovering deleted the refined_invites branch April 17, 2023 11:56
@@ -18,6 +19,13 @@
from bot.exts.filtering.filtering import Filtering


REFINED_INVITE_CODE = re.compile(
r"(?P<invite>[a-zA-Z0-9/]+)" # The supposedly real invite code.
r"(?:[^a-zA-Z0-9/].*)?" # Ignoring anything that may come after an invalid character.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That isn't quite how discord link parsing works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a: filters Related to message filters: (antimalware, antispam, filtering, token_remover) p: 1 - high High Priority t: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants