topgg 1.0.2 → 1.0.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 +4 -4
- data/lib/lib.rb +9 -10
- data/lib/topgg/botSearch.rb +2 -2
- data/pkg/topgg-1.0.2.gem +0 -0
- data/topgg.gemspec +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 31766351920f959f50e2aaa07350ac7c82d436c61e580b490d5db71d0ea8cbc5
|
|
4
|
+
data.tar.gz: 7ac395e026c798bf48016c9b49ef20606fb238d0165fe8d945d411d242184eab
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b5ce9dc541fb6edfeb6a90ca2e6b5fda537a469942a651074c03191b9e3743e5d4f95e1b57b71da2cc22c0c67db5b0c2ba68978e0e94c63bd83f1b85ffb6a4bc
|
|
7
|
+
data.tar.gz: 704b4fb2bfdb2f58eee599c6d54e18a298a57daa3771d4ed6060fdec566c9797c8e404f9854ca106073c3f0fa317c1201fd6d2350668d713dbb86639051d7c69
|
data/lib/lib.rb
CHANGED
|
@@ -24,20 +24,18 @@ class Topgg
|
|
|
24
24
|
# The method fetches bot statistics from top.gg
|
|
25
25
|
# @param id [String] The id of the bot you want to fetch statistics from.
|
|
26
26
|
# @return [Spreader::Bot] The Bot Object
|
|
27
|
-
def
|
|
27
|
+
def get_bot(id)
|
|
28
28
|
resp = @conn.get("bots/#{id}")
|
|
29
29
|
|
|
30
30
|
Spreader::Bot.new(JSON.parse(resp.body))
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
# The method searches bots from top.gg using a keyword query.
|
|
34
|
-
# @param
|
|
35
|
-
#
|
|
36
|
-
# @param offset [Integer] The Amount of bots to skip
|
|
37
|
-
# @param sort [Boolean] The fields to sort by.
|
|
34
|
+
# @param [Object] params The parameters that can be used to query a search
|
|
35
|
+
# To know what the parameters are check it out here
|
|
38
36
|
# @return [Spreader::BotSearch] The BotSearch Object
|
|
39
|
-
def
|
|
40
|
-
resp = @conn.get('bots',
|
|
37
|
+
def search_bot(params)
|
|
38
|
+
resp = @conn.get('bots', params)
|
|
41
39
|
Spreader::BotSearch.new(JSON.parse(resp.body))
|
|
42
40
|
end
|
|
43
41
|
|
|
@@ -53,7 +51,7 @@ class Topgg
|
|
|
53
51
|
# Get Bot statistics.
|
|
54
52
|
# @param id [String] Id of the bot you want to get statistics of
|
|
55
53
|
# @return [Spreader::Stats]
|
|
56
|
-
def
|
|
54
|
+
def get_stats(id)
|
|
57
55
|
resp = @conn.get("bots/#{id}/stats")
|
|
58
56
|
|
|
59
57
|
Spreader::Stats.new(JSON.parse(resp.body))
|
|
@@ -81,7 +79,7 @@ class Topgg
|
|
|
81
79
|
# @param server_count [Integer] The amount of servers the bot is in.
|
|
82
80
|
# @param shards [Integer] The amount of servers the bot is in per shard
|
|
83
81
|
# @param shard_count [Integer] The total number of shards.
|
|
84
|
-
def
|
|
82
|
+
def post_stats(server_count, shards: nil, shard_count: nil)
|
|
85
83
|
jsonPost = {
|
|
86
84
|
server_count: server_count,
|
|
87
85
|
shards: shards,
|
|
@@ -92,7 +90,7 @@ class Topgg
|
|
|
92
90
|
|
|
93
91
|
# Autopost stats on to the top.gg website
|
|
94
92
|
# @param client [Discordrb::Bot] instanceof discordrb client.
|
|
95
|
-
def
|
|
93
|
+
def auto_post_stats(client)
|
|
96
94
|
semaphore = Mutex.new
|
|
97
95
|
Thread.new do
|
|
98
96
|
semaphore.synchronize do
|
|
@@ -121,3 +119,4 @@ class Topgg
|
|
|
121
119
|
end
|
|
122
120
|
|
|
123
121
|
|
|
122
|
+
|
data/lib/topgg/botSearch.rb
CHANGED
|
@@ -14,7 +14,7 @@ module Spreader
|
|
|
14
14
|
# The Total number of results
|
|
15
15
|
# @return [Integer]
|
|
16
16
|
def total
|
|
17
|
-
@obj['total']
|
|
17
|
+
@obj['total'].to_i
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
# The first result
|
|
@@ -26,7 +26,7 @@ module Spreader
|
|
|
26
26
|
# The number of bots shown in the first page
|
|
27
27
|
# @return [Integer]
|
|
28
28
|
def count
|
|
29
|
-
@obj['count']
|
|
29
|
+
@obj['count'].to_i
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
# Iterates through the results
|
data/pkg/topgg-1.0.2.gem
ADDED
|
Binary file
|
data/topgg.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: topgg
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adonis Tremblay
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-07-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: This is a ruby library of the top.gg API.
|
|
14
14
|
email:
|
|
@@ -30,6 +30,7 @@ files:
|
|
|
30
30
|
- lib/topgg/user.rb
|
|
31
31
|
- lib/topgg/votes.rb
|
|
32
32
|
- pkg/topgg-1.0.1.gem
|
|
33
|
+
- pkg/topgg-1.0.2.gem
|
|
33
34
|
- topgg.gemspec
|
|
34
35
|
homepage: https://github.com/rhydderchc/topgg-ruby
|
|
35
36
|
licenses:
|