mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-25 06:27:03 +01:00
Time sleep 0?
This commit is contained in:
parent
ca09254ada
commit
e9e2471e41
@ -28,6 +28,7 @@ class Gateway(Namespace):
|
||||
channels = get_guild_channels(guild_id, forced_role=forced_role)
|
||||
join_room("GUILD_"+guild_id)
|
||||
for chan in channels:
|
||||
time.sleep(0)
|
||||
if chan["read"]:
|
||||
join_room("CHANNEL_"+chan["channel"]["id"])
|
||||
if session.get("unauthenticated", True) and guild_id in session.get("user_keys", {}):
|
||||
@ -68,6 +69,7 @@ class Gateway(Namespace):
|
||||
else:
|
||||
name = name + username + "#" + str(session["discriminator"])
|
||||
for webhook in guild_webhooks:
|
||||
time.sleep(0)
|
||||
if webhook["name"] == name:
|
||||
discord_api.delete_webhook(webhook["id"], webhook["token"])
|
||||
self.teardown_db_session()
|
||||
@ -135,19 +137,23 @@ class Gateway(Namespace):
|
||||
guild_roles = redisqueue.get_guild(guild_id)["roles"]
|
||||
guildroles_filtered = {}
|
||||
for role in guild_roles:
|
||||
time.sleep(0)
|
||||
guildroles_filtered[role["id"]] = role
|
||||
member_roleids = member["roles"]
|
||||
member_roles = []
|
||||
for roleid in member_roleids:
|
||||
time.sleep(0)
|
||||
role = guildroles_filtered.get(str(roleid))
|
||||
if not role:
|
||||
continue
|
||||
member_roles.append(role)
|
||||
member_roles = sorted(member_roles, key=lambda k: k['position'])
|
||||
for role in member_roles:
|
||||
time.sleep(0)
|
||||
if role["color"] != 0:
|
||||
color = '{0:02x}'.format(role["color"])
|
||||
while len(color) < 6:
|
||||
time.sleep(0)
|
||||
color = "0" + color
|
||||
return color
|
||||
|
||||
|
@ -53,6 +53,7 @@ class DiscordREST:
|
||||
data = json.dumps(data)
|
||||
|
||||
for tries in range(5):
|
||||
time.sleep(0)
|
||||
curepoch = time.time()
|
||||
if self._get_bucket("global_limited") == "True":
|
||||
time.sleep(int(float(self._get_bucket("global_limit_expire"))) - curepoch)
|
||||
|
@ -16,6 +16,7 @@ class RedisQueue:
|
||||
}
|
||||
loop_count = 0
|
||||
while (not data and data != "") and loop_count < 50:
|
||||
time.sleep(0)
|
||||
if loop_count % 25 == 0:
|
||||
redis_store.publish("discord-api-req", json.dumps(payload))
|
||||
time.sleep(0.1)
|
||||
@ -46,6 +47,7 @@ class RedisQueue:
|
||||
snowflakes = []
|
||||
guild_members = {}
|
||||
for x in q:
|
||||
time.sleep(0)
|
||||
if x["id"] in snowflakes or int(x["id"]) <= int(after_snowflake):
|
||||
continue
|
||||
snowflakes.append(x["id"])
|
||||
@ -74,6 +76,7 @@ class RedisQueue:
|
||||
message["author"]["discriminator"] = member["discriminator"]
|
||||
message["author"]["username"] = member["username"]
|
||||
for mention in message["mentions"]:
|
||||
time.sleep(0)
|
||||
if mention["id"] not in guild_members:
|
||||
author = self.get_guild_member(guild_id, mention["id"])
|
||||
guild_members[mention["id"]] = author
|
||||
@ -106,6 +109,7 @@ class RedisQueue:
|
||||
member_ids = self.get(key, "list_guild_members", {"guild_id": guild_id}, data_type="set")
|
||||
members = []
|
||||
for member_id in member_ids:
|
||||
time.sleep(0)
|
||||
usr_id = member_id["user_id"]
|
||||
member = self.get_guild_member(guild_id, usr_id)
|
||||
if member:
|
||||
|
Loading…
Reference in New Issue
Block a user