dblruby 0.7.1 → 0.8.0

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dblruby/stats.rb +14 -7
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8423fa863f63199499f345ebbf9eee9d9b7ccaf8
4
- data.tar.gz: 8314b7fbe2a25e4873946e025e15306e34d3b3fc
3
+ metadata.gz: bb8d3b753f0486f2d09ced6e5d2432c9b32584f4
4
+ data.tar.gz: 6dc1ecdaa199560d8b73925655eadd21971464a5
5
5
  SHA512:
6
- metadata.gz: 2617282b532b411cf813a30686ce96df71449f09b37ecc1fd2bd6ca737d618c0bc01551ef0fcdd965133d2382dd61482c1b430a5ca3b19f4e99e9c145917e665
7
- data.tar.gz: ce7b7d12fc82d663c284e78dfd1cea18e3ac065999d3e416bb7df494b3eaa3251cb51fa77b02cf8631f17b75f1139d757240f0165905f0849a151301bcb2efba
6
+ metadata.gz: d1b02c1db54e67035b893409743f8019575aff2354d956c7ebf5346c128826ae0d74182ccd1ff007bb90b3a68708e83093eb1431a7a64349b49a292163416ca5
7
+ data.tar.gz: ea700ba043738911c3fd51a8718bec70420d3dbffe3dfeeaaf3c175d49070d311442332faac546fbf6f6b945e5b4d23558f0a2198b35f970f07b9ee841845a95
@@ -21,13 +21,20 @@ class DBLRuby::Stats
21
21
  alias servers servercount
22
22
 
23
23
  # Update the bot's server count.
24
- # @param id [Integer, String] Integer/String ID of bot server count.
24
+ # @param count [Integer, Array<Integer>] Integer/String of bot server count.
25
+ # @param shard_id [Integer] ID of the shard
26
+ # @param shard_count [Integer] amount of shards the bot has.
25
27
  # @raise [DBLRuby::Errors::InvalidAPIKey] if the DBL returns a 401 error.
26
- def updateservercount(count)
28
+ # @return The count of the servers.
29
+ def updateservercount(count, shard_id = nil, shard_count = nil)
27
30
  url = "https://discordbots.org/api/bots/#{@id}/stats"
28
- json = '{"server_count":' + count.to_s + '}'
29
- RestClient.post(url, json, :Authorization => @api, :'Content-Type' => :json)
30
- "Successfully set the server count to #{count}"
31
+ json = {
32
+ 'server_count': count,
33
+ 'shard_id': shard_id,
34
+ 'shard_count': shard_count
35
+ }
36
+ RestClient.post(url, json, Authorization: @api, 'Content-Type': :json)
37
+ count
31
38
  rescue RestClient::Unauthorized
32
39
  raise DBLRuby::Errors::InvalidAPIKey,
33
40
  'There was an error posting stats to the DBL. Is your API key ok?'
@@ -42,8 +49,8 @@ class DBLRuby::Stats
42
49
  def verifyvote(id)
43
50
  r = RestClient.get('https://discordbots.org/api/bots/check',
44
51
  params: { userId: id },
45
- :Authorization => @api,
46
- :'Content-Type' => :json)
52
+ Authorization: @api,
53
+ 'Content-Type': :json)
47
54
  o = JSON.parse(r)['voted'].to_i
48
55
  !o.zero?
49
56
  rescue RestClient::Unauthorized
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dblruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chewsterchew
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-18 00:00:00.000000000 Z
11
+ date: 2018-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client