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])
|
||||
)
|
||||
|
||||
waitFor bot.startConnection(2)
|
||||
waitFor bot.startConnection()
|
|
@ -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.}
|
||||
|
||||
|
|
Reference in New Issue