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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e545e0e38f675b05b374e68e43bed9c5cb794ae4acce2a05eb50830ded1c16ee
4
- data.tar.gz: a7ccac599af92f1320f561326f8a7e025c91393e496e8baca014afeb5043d3a8
3
+ metadata.gz: a92e3f9bf4157fec1930cdafec45c21f0f59a5dfab718f96d4f65faea24f082b
4
+ data.tar.gz: 620704fcb30b1c8ef6d7572a0e41592aacef2db0c91278259a1667a239cb5e40
5
5
  SHA512:
6
- metadata.gz: eef4eadf13de5db7a8dbd4dca2bbf59e4f44956de4175d1cf308df4b009b3b0bdced88ca295bacb18562161c4b2bbcb0567a3462afb3990599cad7762b3fe5fa
7
- data.tar.gz: f10eef693e3e690a6003a46e802f22d7435eedceaa6b31821b68055cf342be975b74170f6eb1a9afa4df5c61e4947934ebef175bce0bd4632ffab79b83fa14be
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
- def initialize(token)
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
- args = {
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
- args[:payload] = payload if payload
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
- def initialize(*tokens)
11
- @bots = tokens.map(&Bot.method(:new))
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DSU3
4
- VERSION = '0.5.1'
4
+ VERSION = '0.6.0'
5
5
  end
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.5.1
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-18 00:00:00.000000000 Z
11
+ date: 2022-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client