Only add shard in identify if shard count is more than 1
This commit is contained in:
parent
8a9436f831
commit
a061c825ef
|
@ -99,4 +99,4 @@ registerEventListener(EventType.evtMessageCreate, proc(bEvt: BaseEvent) =
|
||||||
discard channel.sendMessage("", false, embed, @[file])
|
discard channel.sendMessage("", false, embed, @[file])
|
||||||
)
|
)
|
||||||
|
|
||||||
waitFor bot.startConnection(2)
|
waitFor bot.startConnection()
|
|
@ -41,11 +41,10 @@ proc handleHeartbeat(shard: Shard) {.async.} =
|
||||||
await sleepAsync(shard.heartbeatInterval)
|
await sleepAsync(shard.heartbeatInterval)
|
||||||
|
|
||||||
proc getIdentifyPacket(shard: Shard): JsonNode =
|
proc getIdentifyPacket(shard: Shard): JsonNode =
|
||||||
return %* {
|
result = %* {
|
||||||
"op": ord(DiscordOpCode.opIdentify),
|
"op": ord(DiscordOpCode.opIdentify),
|
||||||
"d": {
|
"d": {
|
||||||
"token": shard.client.token,
|
"token": shard.client.token,
|
||||||
"shard": [shard.id, shard.client.shardCount],
|
|
||||||
"properties": {
|
"properties": {
|
||||||
"$os": system.hostOS,
|
"$os": system.hostOS,
|
||||||
"$browser": "NimCord",
|
"$browser": "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.
|
# For some reason this shows as an error in VSCode, but it compiles fine.
|
||||||
#proc startConnection*(client: DiscordClient, shardCount: int = 1) {.async.}
|
#proc startConnection*(client: DiscordClient, shardCount: int = 1) {.async.}
|
||||||
|
|
||||||
|
|
Reference in New Issue