mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-26 06:57:04 +01:00
no sleep in get_channel_permission
This commit is contained in:
parent
95b2426b35
commit
db1643595f
@ -262,22 +262,18 @@ def get_channel_permission(channel, guild_id, guild_owner, guild_roles, member_r
|
|||||||
|
|
||||||
role_positions = {}
|
role_positions = {}
|
||||||
for role in guild_roles:
|
for role in guild_roles:
|
||||||
time.sleep(0)
|
|
||||||
role_positions[str(role["id"])] = role["position"]
|
role_positions[str(role["id"])] = role["position"]
|
||||||
member_roles = sorted(member_roles, key=lambda x: role_positions.get(str(x), -1), reverse=True)
|
member_roles = sorted(member_roles, key=lambda x: role_positions.get(str(x), -1), reverse=True)
|
||||||
|
|
||||||
# @everyone
|
# @everyone
|
||||||
for role in guild_roles:
|
for role in guild_roles:
|
||||||
time.sleep(0)
|
|
||||||
if role["id"] == guild_id:
|
if role["id"] == guild_id:
|
||||||
channel_perm |= role["permissions"]
|
channel_perm |= role["permissions"]
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# User Guild Roles
|
# User Guild Roles
|
||||||
for m_role in member_roles:
|
for m_role in member_roles:
|
||||||
time.sleep(0)
|
|
||||||
for g_role in guild_roles:
|
for g_role in guild_roles:
|
||||||
time.sleep(0)
|
|
||||||
if g_role["id"] == m_role:
|
if g_role["id"] == m_role:
|
||||||
channel_perm |= g_role["permissions"]
|
channel_perm |= g_role["permissions"]
|
||||||
continue
|
continue
|
||||||
@ -295,7 +291,6 @@ def get_channel_permission(channel, guild_id, guild_owner, guild_roles, member_r
|
|||||||
|
|
||||||
# channel specific
|
# channel specific
|
||||||
for overwrite in channel["permission_overwrites"]:
|
for overwrite in channel["permission_overwrites"]:
|
||||||
time.sleep(0)
|
|
||||||
if overwrite["type"] == "role" and overwrite["id"] in member_roles:
|
if overwrite["type"] == "role" and overwrite["id"] in member_roles:
|
||||||
denies |= overwrite["deny"]
|
denies |= overwrite["deny"]
|
||||||
allows |= overwrite["allow"]
|
allows |= overwrite["allow"]
|
||||||
@ -304,7 +299,6 @@ def get_channel_permission(channel, guild_id, guild_owner, guild_roles, member_r
|
|||||||
|
|
||||||
# member specific
|
# member specific
|
||||||
for overwrite in channel["permission_overwrites"]:
|
for overwrite in channel["permission_overwrites"]:
|
||||||
time.sleep(0)
|
|
||||||
if overwrite["type"] == "member" and overwrite["id"] == str(session.get("user_id")):
|
if overwrite["type"] == "member" and overwrite["id"] == str(session.get("user_id")):
|
||||||
channel_perm = (channel_perm & ~overwrite['deny']) | overwrite['allow']
|
channel_perm = (channel_perm & ~overwrite['deny']) | overwrite['allow']
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user