Check if guild is None
This commit is contained in:
parent
521a063fca
commit
bb0ff1c560
@ -35,15 +35,22 @@ class AuthUserTransformer(TransformerABC):
|
|||||||
@ServiceProviderABC.inject
|
@ServiceProviderABC.inject
|
||||||
def _is_technician(user: User, bot: DiscordBotServiceABC, permissions: PermissionServiceABC):
|
def _is_technician(user: User, bot: DiscordBotServiceABC, permissions: PermissionServiceABC):
|
||||||
guild = bot.get_guild(user.server.discord_id)
|
guild = bot.get_guild(user.server.discord_id)
|
||||||
|
if guild is None:
|
||||||
|
return permissions.is_member_technician_by_id(user.discord_id)
|
||||||
|
|
||||||
member = guild.get_member(user.discord_id)
|
member = guild.get_member(user.discord_id)
|
||||||
if member is None:
|
if member is None:
|
||||||
return permissions.is_member_technician_by_id(user.discord_id)
|
return permissions.is_member_technician_by_id(user.discord_id)
|
||||||
|
|
||||||
return permissions.is_member_technician(member)
|
return permissions.is_member_technician(member)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ServiceProviderABC.inject
|
@ServiceProviderABC.inject
|
||||||
def _is_admin(user: User, bot: DiscordBotServiceABC, permissions: PermissionServiceABC):
|
def _is_admin(user: User, bot: DiscordBotServiceABC, permissions: PermissionServiceABC):
|
||||||
guild = bot.get_guild(user.server.discord_id)
|
guild = bot.get_guild(user.server.discord_id)
|
||||||
|
if guild is None:
|
||||||
|
return False
|
||||||
|
|
||||||
member = guild.get_member(user.discord_id)
|
member = guild.get_member(user.discord_id)
|
||||||
if member is None:
|
if member is None:
|
||||||
return False
|
return False
|
||||||
@ -53,6 +60,9 @@ class AuthUserTransformer(TransformerABC):
|
|||||||
@ServiceProviderABC.inject
|
@ServiceProviderABC.inject
|
||||||
def _is_moderator(user: User, bot: DiscordBotServiceABC, permissions: PermissionServiceABC):
|
def _is_moderator(user: User, bot: DiscordBotServiceABC, permissions: PermissionServiceABC):
|
||||||
guild = bot.get_guild(user.server.discord_id)
|
guild = bot.get_guild(user.server.discord_id)
|
||||||
|
if guild is None:
|
||||||
|
return False
|
||||||
|
|
||||||
member = guild.get_member(user.discord_id)
|
member = guild.get_member(user.discord_id)
|
||||||
if member is None:
|
if member is None:
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user