refactor: resolve async promises, fixed typos, and used inline variable for return (#299)

* Added await in async function, fixed typos and used inline variable for return

* Added await in async function, fixed typos and used inline variable for return

* Revert "Added await in async function, fixed typos and used inline variable for return"

This reverts commit f31caf5d

* Added await in async function, fixed typos and used inline variable for return

* Fixes format

* Fixes format 2

* Fixes format 4475757

* Fixes format 878757854786312378657865785785785785

* Change return to await

* Fixing more issues

* Fixing even more issues

* Fixing even more issues +

* Fixes format
This commit is contained in:
TriForMine
2020-12-30 09:31:11 +01:00
committed by GitHub
parent 6d7aa35d9c
commit 484f86638f
29 changed files with 126 additions and 141 deletions
+6 -6
View File
@@ -1,5 +1,5 @@
import { controllers } from "../api/controllers/mod.ts";
import { Guild } from "../api/structures/structures.ts";
import { Guild } from "../api/structures/guild.ts";
import { eventHandlers, IdentifyPayload } from "../bot.ts";
import {
DiscordBotGatewayData,
@@ -38,9 +38,9 @@ export async function spawnShards(
data.shards > lastShardID ? data.shards : lastShardID,
];
// Start The shard
createShard(data, payload, false, shardID);
await createShard(data, payload, false, shardID);
// Spawn next shard
spawnShards(
await spawnShards(
data,
payload,
shardID + 1,
@@ -54,7 +54,7 @@ export async function spawnShards(
if (createNextShard) {
createNextShard = false;
// Start the next few shards based on max concurrency
spawnShards(
await spawnShards(
data,
payload,
shardID,
@@ -65,7 +65,7 @@ export async function spawnShards(
}
await delay(1000);
spawnShards(data, payload, shardID, lastShardID, skipChecks);
await spawnShards(data, payload, shardID, lastShardID, skipChecks);
}
export async function handleDiscordPayload(
@@ -77,7 +77,7 @@ export async function handleDiscordPayload(
switch (data.op) {
case GatewayOpcode.HeartbeatACK:
// Incase the user wants to listen to heartbeat responses
// In case the user wants to listen to heartbeat responses
return eventHandlers.heartbeat?.();
case GatewayOpcode.Dispatch:
if (!data.t) return;