pushing fixes

This commit is contained in:
Skillz
2020-05-10 17:43:53 -04:00
parent d0ee4edd76
commit 92442bdbfd
2 changed files with 5 additions and 4 deletions
+1
View File
@@ -18,6 +18,7 @@ export const createShard = async (
JSON.stringify({ op: GatewayOpcode.Identify, d: identifyPayload }),
);
for await (const message of shardSocket) {
console.log("inside socket", message);
if (typeof message === "string") {
handleDiscordPayload(JSON.parse(message), shardSocket, resumeInterval);
} else if (isWebSocketCloseEvent(message)) {
+4 -4
View File
@@ -62,10 +62,9 @@ let sessionID = "";
let shardCounter = 0;
function createShardWorker() {
const shard = new Worker(
"https://raw.githubusercontent.com/Skillz4Killz/Discordeno/master/module/shard.ts",
{ type: "module", deno: true },
);
const path = new URL("./shard.ts", import.meta.url).toString();
console.log("path", path);
const shard = new Worker(path, { type: "module", deno: true });
shard.onmessage = (message) => {
if (message.data.type === "REQUEST_CLIENT_OPTIONS") {
identifyPayload.shard = [shardCounter++, botGatewayData.shards];
@@ -92,6 +91,7 @@ export function handleDiscordPayload(
socket: WebSocket,
resumeInterval: number,
) {
console.log("inside handle discord payloa", data);
// Update the sequence number if it is present
if (data.s) updatePreviousSequenceNumber(data.s);
eventHandlers.raw?.(data);