diff options
| author | 2018-12-28 23:20:32 -0500 | |
|---|---|---|
| committer | 2018-12-28 23:20:32 -0500 | |
| commit | e6d761ecfd1359354ec3889a667c986d40e7376e (patch) | |
| tree | 41f1778d50bf1c596d326e37214d90e055fa5ce5 | |
| parent | Merge pull request #224 from python-discord/charinfo (diff) | |
| parent | Merge branch 'master' into group-dm-invites (diff) | |
Merge pull request #227 from python-discord/group-dm-invites
invite filter: remove redundant channel None check
| -rw-r--r-- | bot/cogs/filtering.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/bot/cogs/filtering.py b/bot/cogs/filtering.py index b6ce501fc..0ba1e49c5 100644 --- a/bot/cogs/filtering.py +++ b/bot/cogs/filtering.py @@ -238,15 +238,13 @@ class Filtering: f"{URLs.discord_invite_api}/{invite}" ) response = await response.json() - if response.get("guild") is None: - # If we have a valid invite which is not a guild invite - # it might be a DM channel invite - if response.get("channel") is not None: - # We don't have whitelisted Group DMs so we can - # go ahead and return a positive for any group DM - return True + 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 + return True - guild_id = int(response.get("guild").get("id")) + guild_id = int(guild.get("id")) if guild_id not in Filter.guild_invite_whitelist: return True |