client.ping -> client.gateway.ping
This commit is contained in:
parent
b324263a7b
commit
ea221f8962
4 changed files with 7 additions and 10 deletions
|
@ -78,8 +78,6 @@ export class Client extends HarmonyEventEmitter<ClientEvents> {
|
|||
rest: RESTManager
|
||||
/** User which Client logs in to, undefined until logs in */
|
||||
user?: User
|
||||
/** WebSocket ping of Client */
|
||||
ping = 0
|
||||
/** Token of the Bot/User */
|
||||
token?: string
|
||||
/** Cache Adapter */
|
||||
|
|
|
@ -66,6 +66,7 @@ export class Gateway extends HarmonyEventEmitter<GatewayTypedEvents> {
|
|||
cache: GatewayCache
|
||||
private timedIdentify: number | null = null
|
||||
shards?: number[]
|
||||
ping: number = 0
|
||||
|
||||
constructor(client: Client, shards?: number[]) {
|
||||
super()
|
||||
|
@ -115,11 +116,9 @@ export class Gateway extends HarmonyEventEmitter<GatewayTypedEvents> {
|
|||
|
||||
case GatewayOpcodes.HEARTBEAT_ACK:
|
||||
this.heartbeatServerResponded = true
|
||||
this.client.ping = Date.now() - this.lastPingTimestamp
|
||||
this.emit('ping', this.client.ping)
|
||||
this.debug(
|
||||
`Received Heartbeat Ack. Ping Recognized: ${this.client.ping}ms`
|
||||
)
|
||||
this.ping = Date.now() - this.lastPingTimestamp
|
||||
this.emit('ping', this.ping)
|
||||
this.debug(`Received Heartbeat Ack. Ping Recognized: ${this.ping}ms`)
|
||||
break
|
||||
|
||||
case GatewayOpcodes.INVALID_SESSION:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue