dsu3 1.1.0 → 1.1.1

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: 3836a58d3aac7cf05d21fddc541bff2daed7ae535c9afbf57aedccaaa452a11a
4
- data.tar.gz: 5dec7ec5f4704f993efeccda45900e6824da03bf5c9c9715203d446cb0231a67
3
+ metadata.gz: 926cbe8acc038109fc2b0cda6f10af35f204f2c78e91fe6a31c87d9bd1ea81c3
4
+ data.tar.gz: a4e823799e5a47bcf068650364dd29d94154708c7db601275eb0f768bbb81e16
5
5
  SHA512:
6
- metadata.gz: 803eafe94df41b818bb6d90bb068b6f27bc7f0a7c718c854069070c7e381fe62e5f85598cc43ed594bbe63284e6542cf3bbe70cb865daea6a80cd293607b6493
7
- data.tar.gz: 8872033f7b17ffd4498f4bb35003543f8c8f0f29a11cc480924e92141b0eb577c2a730a49fd31173c56c496e03f14fe213f167613420c17ab7a3355adccd8b1e
6
+ metadata.gz: 6eda735ef22ec9762a781d228fcc217f6dade60fbbdc2d65ba0c4efbfe2ceb6fc969698ff3f0311ac035fdf1b952e2e90560f0547e2f79ad07d6f3227836c4c9
7
+ data.tar.gz: a712aa467a11baeebd5549e88905d570d5e6df41446ef500e6e97785f026ec22b2d7a29ef2bc1f307ec9b20e7a21d14b8ebd89929045bf01b0d2ca2104e67a58
@@ -23,4 +23,4 @@ module DSU3
23
23
  end
24
24
  end
25
25
  end
26
- end
26
+ end
data/lib/dsu3/api/user.rb CHANGED
@@ -16,4 +16,4 @@ module DSU3
16
16
  end
17
17
  end
18
18
  end
19
- end
19
+ end
data/lib/dsu3/api.rb CHANGED
@@ -15,8 +15,6 @@ module DSU3
15
15
  module API
16
16
  API_BASE = 'https://discord.com/api/v9/'
17
17
 
18
- @ratelimits = []
19
-
20
18
  module_function
21
19
 
22
20
  # Makes an API request without any error handling
@@ -40,16 +38,14 @@ module DSU3
40
38
  # @param (see #raw_request)
41
39
  # @return (see #raw_request)
42
40
  def request(...)
41
+ raw_request(...)
42
+ rescue RestClient::ExceptionWithResponse => e
43
43
  begin
44
- raw_request(...)
45
- rescue RestClient::ExceptionWithResponse => e
46
- begin
47
- data = JSON.parse(e.response.body)
48
- raise DSU3::RateLimitError('ratelimit exceeded', data['retry_after']) if e.is_a?(RestClient::TooManyRequests)
49
- raise DSU3::CodeError.new("#{data['code']}: #{data['message']}")
50
- rescue JSON::ParserError
51
- raise e
52
- end
44
+ data = JSON.parse(e.response.body)
45
+ raise DSU3::RateLimitError('ratelimit exceeded', data['retry_after']) if e.is_a?(RestClient::TooManyRequests)
46
+ raise DSU3::CodeError, "#{data['code']}: #{data['message']}"
47
+ rescue JSON::ParserError
48
+ raise e
53
49
  end
54
50
  end
55
51
  end
@@ -27,7 +27,7 @@ module DSU3
27
27
  # Returns Message instance
28
28
  # @param [String, Integer] message Message ID
29
29
  def message(message_id)
30
- DSU3::Message.new(@tokens, @id, message_id)
30
+ DSU3::Message.new(self, message_id)
31
31
  end
32
32
  end
33
33
  end
@@ -8,4 +8,4 @@ module DSU3
8
8
  @net.request(cooldown: 0.5) { DSU3::API::Guild.verify(_1, @id) }
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -8,4 +8,4 @@ module DSU3
8
8
  @net.request(cooldown: 0.5) { DSU3::API::Invites.join(token, @id) }
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -17,4 +17,4 @@ module DSU3
17
17
  @net.request { DSU3::API::Message.react(_1, @channel_id, @id, emoji) }
18
18
  end
19
19
  end
20
- end
20
+ end
data/lib/dsu3/data.rb CHANGED
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'dsu3/api'
2
4
  require 'dsu3/dobject'
3
5
  require 'dsu3/data/channel'
4
6
  require 'dsu3/data/guild'
5
7
  require 'dsu3/data/invite'
6
- require 'dsu3/data/message'
8
+ require 'dsu3/data/message'
data/lib/dsu3/dobject.rb CHANGED
@@ -12,4 +12,4 @@ module DSU3
12
12
  @id = id
13
13
  end
14
14
  end
15
- end
15
+ end
data/lib/dsu3/errors.rb CHANGED
@@ -11,4 +11,4 @@ module DSU3
11
11
  end
12
12
 
13
13
  CodeError = Class.new(StandardError)
14
- end
14
+ end
data/lib/dsu3/net.rb CHANGED
@@ -18,7 +18,7 @@ module DSU3
18
18
  # An auxiliary method that can be used to make an Discord API call from multiple tokens with ratelimit and thread support
19
19
  # @param [Hash] opts Options
20
20
  def request(opts = {})
21
- opts = {cooldown: 0, loop: false}.merge(opts)
21
+ opts = { cooldown: 0, loop: false }.merge(opts)
22
22
 
23
23
  @tokens.each do |token|
24
24
  Thread.new do
@@ -35,7 +35,7 @@ module DSU3
35
35
  end
36
36
 
37
37
  # I'm too lazy to try to document it
38
- %w{channel guild invite}.each do |s|
38
+ %w[channel guild invite].each do |s|
39
39
  define_method s do |id|
40
40
  DSU3.const_get(s.capitalize).new(self, id)
41
41
  end
data/lib/dsu3/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DSU3
4
- VERSION = '1.1.0'
4
+ VERSION = '1.1.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dsu3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artur Sheremetjev IV