diff --git a/examples/basic.nim b/examples/basic.nim index 238a58a..21e2545 100644 --- a/examples/basic.nim +++ b/examples/basic.nim @@ -99,4 +99,4 @@ registerEventListener(EventType.evtMessageCreate, proc(bEvt: BaseEvent) = discard channel.sendMessage("", false, embed, @[file]) ) -waitFor bot.startConnection(2) \ No newline at end of file +waitFor bot.startConnection() \ No newline at end of file diff --git a/src/nimcord/client.nim b/src/nimcord/client.nim index d037e9c..6b9f812 100644 --- a/src/nimcord/client.nim +++ b/src/nimcord/client.nim @@ -41,12 +41,11 @@ proc handleHeartbeat(shard: Shard) {.async.} = await sleepAsync(shard.heartbeatInterval) proc getIdentifyPacket(shard: Shard): JsonNode = - return %* { + result = %* { "op": ord(DiscordOpCode.opIdentify), "d": { "token": shard.client.token, - "shard": [shard.id, shard.client.shardCount], - "properties": { + "properties": { "$os": system.hostOS, "$browser": "NimCord", "$device": "NimCord" @@ -54,6 +53,9 @@ proc getIdentifyPacket(shard: Shard): JsonNode = } } + if (shard.client.shardCount != -1): + result.add("shard", %*[shard.id, shard.client.shardCount]) + # For some reason this shows as an error in VSCode, but it compiles fine. #proc startConnection*(client: DiscordClient, shardCount: int = 1) {.async.}