mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-14 18:11:23 +01:00
More time sleep 0
This commit is contained in:
parent
e9e2471e41
commit
81de5572e6
@ -179,9 +179,11 @@ def get_online_embed_user_keys(guild_id="*", user_type=None):
|
|||||||
user_type = [user_type]
|
user_type = [user_type]
|
||||||
usrs = {}
|
usrs = {}
|
||||||
for utype in user_type:
|
for utype in user_type:
|
||||||
|
time.sleep(0)
|
||||||
usrs[utype] = []
|
usrs[utype] = []
|
||||||
keys = redis_store.keys("MemberPresence/{}/{}/*".format(guild_id, utype))
|
keys = redis_store.keys("MemberPresence/{}/{}/*".format(guild_id, utype))
|
||||||
for key in keys:
|
for key in keys:
|
||||||
|
time.sleep(0)
|
||||||
client_key = key.split("/")[-1]
|
client_key = key.split("/")[-1]
|
||||||
usrs[utype].append(client_key)
|
usrs[utype].append(client_key)
|
||||||
return usrs
|
return usrs
|
||||||
@ -198,6 +200,7 @@ def get_member_roles(guild_id, user_id):
|
|||||||
roles = q["roles"]
|
roles = q["roles"]
|
||||||
role_converted = []
|
role_converted = []
|
||||||
for role in roles:
|
for role in roles:
|
||||||
|
time.sleep(0)
|
||||||
role_converted.append(str(role))
|
role_converted.append(str(role))
|
||||||
return role_converted
|
return role_converted
|
||||||
|
|
||||||
@ -220,6 +223,7 @@ def get_guild_channels(guild_id, force_everyone=False, forced_role=0):
|
|||||||
guild_owner = guild["owner_id"]
|
guild_owner = guild["owner_id"]
|
||||||
result_channels = []
|
result_channels = []
|
||||||
for channel in guild_channels:
|
for channel in guild_channels:
|
||||||
|
time.sleep(0)
|
||||||
if channel['type'] in ["text", "category"]:
|
if channel['type'] in ["text", "category"]:
|
||||||
result = get_channel_permission(channel, guild_id, guild_owner, guild_roles, member_roles, str(session.get("user_id")), force_everyone)
|
result = get_channel_permission(channel, guild_id, guild_owner, guild_roles, member_roles, str(session.get("user_id")), force_everyone)
|
||||||
bot_result = get_channel_permission(channel, guild_id, guild_owner, guild_roles, bot_member_roles, config["client-id"], False)
|
bot_result = get_channel_permission(channel, guild_id, guild_owner, guild_roles, bot_member_roles, config["client-id"], False)
|
||||||
@ -248,11 +252,13 @@ 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
|
||||||
@ -260,6 +266,7 @@ def get_channel_permission(channel, guild_id, guild_owner, guild_roles, member_r
|
|||||||
# User Guild Roles
|
# User Guild Roles
|
||||||
for m_role in member_roles:
|
for m_role in member_roles:
|
||||||
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
|
||||||
@ -277,6 +284,7 @@ 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"]
|
||||||
@ -285,6 +293,7 @@ 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
|
||||||
@ -315,13 +324,16 @@ def bot_can_create_webhooks(guild):
|
|||||||
guild_roles = guild["roles"]
|
guild_roles = guild["roles"]
|
||||||
# @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"]:
|
||||||
perm |= role["permissions"]
|
perm |= role["permissions"]
|
||||||
continue
|
continue
|
||||||
member_roles = get_member_roles(guild["id"], config["client-id"])
|
member_roles = get_member_roles(guild["id"], config["client-id"])
|
||||||
# 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:
|
||||||
perm |= g_role["permissions"]
|
perm |= g_role["permissions"]
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user