onyxcord 3.2.2 → 3.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37831cee5e469b515d61360bfe1f6ad947c02a94adc801d4fef29118118b66f4
4
- data.tar.gz: 52f92ddc708cb3d8237a637191357ddf6a29a9743f5f28faf84eb092aa0616ed
3
+ metadata.gz: 23d795e8a2baf1f58d15267e7b1b32814719aec6d8922397821fb9399798028b
4
+ data.tar.gz: 1a10c95ab6f32f4d61899d2c0563bcbcb3ad4acd790051edaa18ed68a827d02c
5
5
  SHA512:
6
- metadata.gz: 6b16e3f8ec311f6aab31d4fc650b34c7386da6b19604d61f0d852861f9a8092881ac007a9321ee596090b433edcb08e80888cfa046cfa3406ece9136d8752f0e
7
- data.tar.gz: 3535bf3a10491e262f920db6f71f8d2a7678ce5cdd3c57e60f954fe790d63bb38e65854e31b8fac98880acb27bb9b126d96f27d4e653131b05ed2233a69155af
6
+ metadata.gz: 26109c5e32a6349fdc4ff92950b8d4010b1e8e6347338e96fd4c45ca22f35df7367177bbaa1fef6d35b6d3ca4fc066f17e5ca8909d8ec360f23690d34fd96388
7
+ data.tar.gz: 7b97e9f9e33a938332d49139270f5e1d8fc21a27627544c81053ab5cc5b2c408249ea5c97d62ee5216ce65e79a02c8a1abe1d84f5f002dd8bb16714b93e9f7e3
@@ -45,6 +45,10 @@ module OnyxCord
45
45
  @gateway.open?
46
46
  end
47
47
 
48
+ def latency
49
+ @gateway.latency
50
+ end
51
+
48
52
  # Sets debug mode. If debug mode is on, many things will be outputted to STDOUT.
49
53
  def debug=(new_debug)
50
54
  LOGGER.debug = new_debug
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OnyxCord
4
- VERSION = '3.2.2'
4
+ VERSION = '3.2.3'
5
5
  end
@@ -17,7 +17,7 @@ module OnyxCord
17
17
  FATAL_CLOSE_CODES = [4003, 4004, 4011, 4014].freeze
18
18
 
19
19
  attr_accessor :check_heartbeat_acks
20
- attr_reader :intents
20
+ attr_reader :intents, :latency
21
21
 
22
22
  def initialize(bot, token, shard_key = nil, compress_mode = :stream, intents = ALL_INTENTS)
23
23
  @token = token
@@ -108,6 +108,7 @@ module OnyxCord
108
108
  end
109
109
 
110
110
  def send_heartbeat(sequence)
111
+ @last_heartbeat_sent_at = Process.clock_gettime(Process::CLOCK_MONOTONIC)
111
112
  send_packet(Internal::Gateway::Opcodes::HEARTBEAT, sequence)
112
113
  end
113
114
 
@@ -402,6 +403,7 @@ module OnyxCord
402
403
  LOGGER.debug("Heartbeat ACK: #{packet.inspect}")
403
404
  return unless @check_heartbeat_acks
404
405
 
406
+ @latency = Process.clock_gettime(Process::CLOCK_MONOTONIC) - @last_heartbeat_sent_at if @last_heartbeat_sent_at
405
407
  @last_heartbeat_acked = true
406
408
  @missed_heartbeat_acks = 0
407
409
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onyxcord
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.2
4
+ version: 3.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gustavo Silva