From 2634865fa0e4f3a3bd2494c8306820c71aee6487 Mon Sep 17 00:00:00 2001 From: sco1 Date: Sat, 29 Dec 2018 21:06:35 -0500 Subject: Remove invite filter deblanking Clarify inline help/comments --- bot/cogs/filtering.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/bot/cogs/filtering.py b/bot/cogs/filtering.py index 0ba1e49c5..c21b45648 100644 --- a/bot/cogs/filtering.py +++ b/bot/cogs/filtering.py @@ -217,16 +217,12 @@ class Filtering: async def _has_invites(self, text: str) -> bool: """ - Returns True if the text contains an invite which - is not on the guild_invite_whitelist in config.yml. + Returns True if the text contains an invite which is not on the guild_invite_whitelist in + config.yml - Also catches a lot of common ways to try to cheat the system. + Attempts to catch some of common ways to try to cheat the system. """ - # Remove spaces to prevent cases like - # d i s c o r d . c o m / i n v i t e / s e x y t e e n s - text = text.replace(" ", "") - # Remove backslashes to prevent escape character aroundfuckery like # discord\.gg/gdudes-pony-farm text = text.replace("\\", "") @@ -240,8 +236,9 @@ class Filtering: response = await response.json() guild = response.get("guild") if guild is None: - # We don't have whitelisted Group DMs so we can - # go ahead and return a positive for any group DM + # Lack of a "guild" key in the JSON response indicates either an group DM invite, an + # expired invite, or an invalid invite. The API does not currently differentiate + # between invalid and expired invites return True guild_id = int(guild.get("id")) -- cgit v1.2.3 From a999fbbead4c86ee77bb727820ccef1bfc6c300e Mon Sep 17 00:00:00 2001 From: sco1 Date: Sat, 29 Dec 2018 21:08:37 -0500 Subject: Remove the cursed trailing whitespace --- bot/cogs/filtering.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bot/cogs/filtering.py b/bot/cogs/filtering.py index c21b45648..f5811d9d2 100644 --- a/bot/cogs/filtering.py +++ b/bot/cogs/filtering.py @@ -217,7 +217,7 @@ class Filtering: async def _has_invites(self, text: str) -> bool: """ - Returns True if the text contains an invite which is not on the guild_invite_whitelist in + Returns True if the text contains an invite which is not on the guild_invite_whitelist in config.yml Attempts to catch some of common ways to try to cheat the system. @@ -237,7 +237,7 @@ class Filtering: guild = response.get("guild") if guild is None: # Lack of a "guild" key in the JSON response indicates either an group DM invite, an - # expired invite, or an invalid invite. The API does not currently differentiate + # expired invite, or an invalid invite. The API does not currently differentiate # between invalid and expired invites return True -- cgit v1.2.3