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.
- checksums.yaml +4 -4
- data/lib/dblruby/stats.rb +14 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb8d3b753f0486f2d09ced6e5d2432c9b32584f4
|
4
|
+
data.tar.gz: 6dc1ecdaa199560d8b73925655eadd21971464a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1b02c1db54e67035b893409743f8019575aff2354d956c7ebf5346c128826ae0d74182ccd1ff007bb90b3a68708e83093eb1431a7a64349b49a292163416ca5
|
7
|
+
data.tar.gz: ea700ba043738911c3fd51a8718bec70420d3dbffe3dfeeaaf3c175d49070d311442332faac546fbf6f6b945e5b4d23558f0a2198b35f970f07b9ee841845a95
|
data/lib/dblruby/stats.rb
CHANGED
@@ -21,13 +21,20 @@ class DBLRuby::Stats
|
|
21
21
|
alias servers servercount
|
22
22
|
|
23
23
|
# Update the bot's server count.
|
24
|
-
# @param
|
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
|
-
|
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 =
|
29
|
-
|
30
|
-
|
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
|
-
:
|
46
|
-
|
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.
|
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-
|
11
|
+
date: 2018-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|