From bdd0da38ab013bbbae9c32d6c6c9e43885c527c0 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Sun, 25 Feb 2024 13:42:09 +0100 Subject: [PATCH] Check if guild is None in can user see check --- bot/src/bot_graphql/abc/query_abc.py | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/bot/src/bot_graphql/abc/query_abc.py b/bot/src/bot_graphql/abc/query_abc.py index d89a17da..9dae04ba 100644 --- a/bot/src/bot_graphql/abc/query_abc.py +++ b/bot/src/bot_graphql/abc/query_abc.py @@ -91,9 +91,7 @@ class QueryABC(ObjectType): for u in user.users: guild = bot.get_guild(u.server.discord_id) - if guild is None: - return False - if permissions.is_member_technician(guild.get_member(u.discord_id)): + if guild is not None and permissions.is_member_technician(guild.get_member(u.discord_id)): return True if config.get_configuration(MAINTENANCE): @@ -114,7 +112,7 @@ class QueryABC(ObjectType): u: User = u guild = bot.get_guild(u.server.discord_id) if guild is None: - return False + continue member = guild.get_member(u.discord_id) if permissions.is_member_moderator(member) and u.server.id == element.server.id: access = True @@ -126,7 +124,7 @@ class QueryABC(ObjectType): u: User = u guild = bot.get_guild(u.server.discord_id) if guild is None: - return False + continue member = guild.get_member(u.discord_id) if permissions.is_member_moderator(member) and u.server.id == element.auto_role.server.id: access = True @@ -144,7 +142,7 @@ class QueryABC(ObjectType): u: User = u guild = bot.get_guild(u.server.discord_id) if guild is None: - return False + continue member = guild.get_member(u.discord_id) if permissions.is_member_moderator(member): access = True @@ -169,7 +167,7 @@ class QueryABC(ObjectType): u: User = u guild = bot.get_guild(u.server.discord_id) if guild is None: - return False + continue member = guild.get_member(u.discord_id) if u.id == element.id or permissions.is_member_moderator(member): access = True @@ -180,7 +178,7 @@ class QueryABC(ObjectType): u: User = u guild = bot.get_guild(u.server.discord_id) if guild is None: - return False + continue member = guild.get_member(u.discord_id) if u.id == element.user.id or permissions.is_member_moderator(member): access = True @@ -191,7 +189,7 @@ class QueryABC(ObjectType): u: User = u guild = bot.get_guild(u.server.discord_id) if guild is None: - return False + continue member = guild.get_member(u.discord_id) if u.id == element.user.id or permissions.is_member_moderator(member): access = True @@ -202,7 +200,7 @@ class QueryABC(ObjectType): u: User = u guild = bot.get_guild(u.server.discord_id) if guild is None: - return False + continue member = guild.get_member(u.discord_id) if u.id == element.user.id or permissions.is_member_moderator(member): access = True @@ -213,7 +211,7 @@ class QueryABC(ObjectType): u: User = u guild = bot.get_guild(u.server.discord_id) if guild is None: - return False + continue member = guild.get_member(u.discord_id) if u.id == element.user.id or permissions.is_member_moderator(member): access = True @@ -224,7 +222,7 @@ class QueryABC(ObjectType): u: User = u guild = bot.get_guild(u.server.discord_id) if guild is None: - return False + continue member = guild.get_member(u.discord_id) if permissions.is_member_technician(member): access = True @@ -236,7 +234,7 @@ class QueryABC(ObjectType): u: User = u guild = bot.get_guild(u.server.discord_id) if guild is None: - return False + continue member = guild.get_member(u.discord_id) if permissions.is_member_moderator(member) and u.server.id == element.server.id: access = True @@ -248,7 +246,7 @@ class QueryABC(ObjectType): u: User = u guild = bot.get_guild(u.server.discord_id) if guild is None: - return False + continue member = guild.get_member(u.discord_id) if permissions.is_member_moderator(member) and u.server.id == element.server.id: access = True @@ -259,7 +257,7 @@ class QueryABC(ObjectType): u: User = u guild = bot.get_guild(u.server.discord_id) if guild is None: - return False + continue member = guild.get_member(u.discord_id) if permissions.is_member_technician(member): access = True