dsu3 0.5.1 → 0.6.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/dsu3/bot.rb +10 -9
- data/lib/dsu3/core.rb +4 -2
- data/lib/dsu3/props.rb +0 -1
- data/lib/dsu3/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a92e3f9bf4157fec1930cdafec45c21f0f59a5dfab718f96d4f65faea24f082b
|
4
|
+
data.tar.gz: 620704fcb30b1c8ef6d7572a0e41592aacef2db0c91278259a1667a239cb5e40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99219d879efce343e1b550d7b50c23b886b506ee5c9e74229602fb347bca870a0c015fc5da8a0e5f9e747a22ff26fc4e96b098ecd9a3139d6e7253eed0df10d0
|
7
|
+
data.tar.gz: 91af4ac8bf517185a8efefa5ed4dccc945a6a5275959b0870b4584446623a634c6bf04e0cb1ab575ff0d23c104efebbf6754d00d5e9ca77bca314dc4a6cb3e84
|
data/lib/dsu3/bot.rb
CHANGED
@@ -10,8 +10,11 @@ module DSU3
|
|
10
10
|
API_BASE = 'https://discord.com/api/v9'
|
11
11
|
|
12
12
|
# @param [String] token Discord account token
|
13
|
-
|
13
|
+
# @param [Array] proxies List of proxy servers
|
14
|
+
# If the list of proxy servers is empty, the proxy will not be used
|
15
|
+
def initialize(token, proxies = [])
|
14
16
|
@headers = Props::HEADERS.merge(authorization: token)
|
17
|
+
@proxies = proxies
|
15
18
|
end
|
16
19
|
|
17
20
|
# Makes an API request without any error handling
|
@@ -20,15 +23,13 @@ module DSU3
|
|
20
23
|
# @param [Hash] headers Additional request headers
|
21
24
|
# @param [String] payload
|
22
25
|
def raw_request(method, endpoint, headers = {}, payload = nil)
|
23
|
-
|
26
|
+
RestClient::Request.execute(
|
24
27
|
method: method,
|
25
28
|
url: URI.join(API_BASE, endpoint).to_s,
|
26
|
-
headers: @headers.merge(headers)
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
RestClient::Request.execute(args)
|
29
|
+
headers: @headers.merge(headers),
|
30
|
+
payload: payload,
|
31
|
+
proxy: @proxies.sample
|
32
|
+
)
|
32
33
|
end
|
33
34
|
|
34
35
|
# Makes an API request, includes simple error handling
|
@@ -57,7 +58,7 @@ module DSU3
|
|
57
58
|
|
58
59
|
# Sends a message to a specific channel
|
59
60
|
# @param [String, Integer] channel Channel ID
|
60
|
-
# @param [String] message
|
61
|
+
# @param [String] message Message ID
|
61
62
|
def send_message(channel, message)
|
62
63
|
request(
|
63
64
|
:post, "channels/#{channel}/messages",
|
data/lib/dsu3/core.rb
CHANGED
@@ -7,8 +7,10 @@ module DSU3
|
|
7
7
|
# Class used to manage multiple bots
|
8
8
|
class Core
|
9
9
|
# @param [Array] tokens List of bot tokens
|
10
|
-
|
11
|
-
|
10
|
+
# @param [Array] proxies List of proxy servers
|
11
|
+
# If the list of proxy servers is empty, the proxy will not be used
|
12
|
+
def initialize(*tokens, proxies = [])
|
13
|
+
@bots = tokens.map { |token| Bot.new(token, proxies) }
|
12
14
|
end
|
13
15
|
|
14
16
|
# (see Bot#type)
|
data/lib/dsu3/props.rb
CHANGED
@@ -6,7 +6,6 @@ require 'base64'
|
|
6
6
|
|
7
7
|
module DSU3
|
8
8
|
# The fundamental class in this vast system, on which all the other parts of the structure depend
|
9
|
-
# pretty bad code in this module rests by the way
|
10
9
|
module Props
|
11
10
|
# user-agent header
|
12
11
|
USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0'
|
data/lib/dsu3/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dsu3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Artur Sheremetjev IV
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|