fix(bot): wait for identify limit on identify instead of shard connect

This commit is contained in:
spiral 2022-12-21 05:47:13 +00:00
parent d04f3cf1ad
commit 6277d72c9c
No known key found for this signature in database
GPG Key ID: 244A11E4B0BCF40E

View File

@ -132,8 +132,6 @@ public class Shard
{ {
while (true) while (true)
{ {
await _ratelimiter.Identify(_info.ShardId);
_logger.Information("Shard {ShardId}: Connecting to WebSocket", _info.ShardId); _logger.Information("Shard {ShardId}: Connecting to WebSocket", _info.ShardId);
try try
{ {
@ -152,7 +150,10 @@ public class Shard
=> _conn.Disconnect(closeStatus, null); => _conn.Disconnect(closeStatus, null);
private async Task SendIdentify() private async Task SendIdentify()
=> await _conn.Send(new GatewayPacket {
await _ratelimiter.Identify(_info.ShardId);
await _conn.Send(new GatewayPacket
{ {
Opcode = GatewayOpcode.Identify, Opcode = GatewayOpcode.Identify,
Payload = new GatewayIdentify Payload = new GatewayIdentify
@ -171,6 +172,7 @@ public class Shard
Presence = _presence, Presence = _presence,
} }
}); });
}
private async Task SendResume((string SessionId, int? LastSeq) arg) private async Task SendResume((string SessionId, int? LastSeq) arg)
=> await _conn.Send(new GatewayPacket => await _conn.Send(new GatewayPacket