dsu3 0.7.0 → 0.8.2

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: 00c308cdbface19a2f537b9221ff0bfa847d3ffeff2bb9632a7411ea73308eac
4
- data.tar.gz: 307ff5780d040f5a3d465d3c4eba4f013f8d26fa5bcdc2e59c1a82ff2324f857
3
+ metadata.gz: b88a7d6933638d26698a37973d16bf72916bbf720997b6b7c02bc1a7b3c06bac
4
+ data.tar.gz: 2ce56289607005aa9bec7ff8f1de789c04d1d85d79696f959ad6adad7bb6cee6
5
5
  SHA512:
6
- metadata.gz: a35f9b161e9b36f252b8e600c8bd58da2a2c8aa069a5ed3beb91acb045262da5b42c63cf47bf602f1a3a8f47587a7fc2b06dc8c7174c40e543979350cb4cd0ae
7
- data.tar.gz: 1a2e1a6b948e8bd22902726cc05088ded20351311e08099efe3bb0d57c4484f3b766a8b68f4af5557a937ef2042261e2bc66c6e0bddcdf708a6812f06a97a016
6
+ metadata.gz: 262ad2cf3570362858cc7af875372cded40430516136074b57ec04043303cc1a3d8236ca334dbb9067f4c90a9f7a52ffcf29620c1b606a3e073d01db4a715cb5
7
+ data.tar.gz: 3f7b61ad802971c06b92e33f3eee39b3d89f3571e88076263a749f2290ab6ebf67e455c7d93853387b1c5cfc2a0d60ec2476c740ef91a237abd208a636d9a7f9
data/README.md CHANGED
@@ -5,3 +5,11 @@ dsu3 is a simple library for working with discord selfbots
5
5
  ```sh
6
6
  sudo gem install dsu3
7
7
  ```
8
+
9
+ # usage
10
+ execute
11
+ ```sh
12
+ dsu3 path/to/token/file
13
+ ```
14
+ to run irb with dsu3 already required and a net instance already initialised
15
+ more info is available here www.rubydoc.info/gems/dsu3
data/bin/dsu3 ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'dsu3'
4
+
5
+ @net = DSU3::Net.new(*File.readlines(ARGV.shift))
6
+
7
+ require 'irb'
8
+ IRB.start
@@ -18,7 +18,7 @@ module DSU3
18
18
  # Sends a message to a specific channel
19
19
  # @param [String] token Discord account token
20
20
  # @param [String, Integer] channel Channel ID
21
- # @param [String, Integer] message Message ID
21
+ # @param [String, Integer] message Message contents
22
22
  def send(token, channel, message)
23
23
  DSU3::API.request(
24
24
  token, :post, "channels/#{channel}/messages",
data/lib/dsu3/api.rb CHANGED
@@ -17,13 +17,14 @@ module DSU3
17
17
  # Makes an API request without any error handling
18
18
  # @param [String] token Discord account token
19
19
  # @param [Symbol, String] method
20
- # @param [String] endpoint Discord API endpoint
20
+ # @param [String] route Discord API route
21
21
  # @param [Hash] headers Additional request headers
22
22
  # @param [String] payload
23
- def raw_request(token, method, endpoint, headers = {}, payload = nil)
23
+ # @return [RestClient::Response] Response object
24
+ def raw_request(token, method, route, headers = {}, payload = nil)
24
25
  RestClient::Request.execute(
25
26
  method: method,
26
- url: URI.join(API_BASE, endpoint).to_s,
27
+ url: URI.join(API_BASE, route).to_s,
27
28
  headers: headers.merge(DSU3::Props::HEADERS, { authorization: token }),
28
29
  payload: payload,
29
30
  proxy: DSU3.proxies.sample
@@ -32,20 +33,18 @@ module DSU3
32
33
 
33
34
  # Makes an API request, includes simple error handling
34
35
  # @param (see #raw_request)
36
+ # @return (see #raw_request)
35
37
  def request(...)
36
38
  raw_request(...)
37
39
  rescue RestClient::ExceptionWithResponse => e
38
- data = JSON.parse(e.response)
39
-
40
40
  if e.is_a?(RestClient::TooManyRequests)
41
- retry_after = data['retry_after'] / 1000.0
42
-
43
- LOGGER.warn("rate limit exceeded, waiting #{retry_after} seconds")
44
- sleep(retry_after)
45
- retry
46
- else
41
+ LOGGER.warn('ratelimit exceeded')
42
+ elsif e.response.headers[:content_type] == 'application/json'
47
43
  LOGGER.error("#{data['code']}: #{data['message']}")
44
+ else
45
+ LOGGER.error(e.message)
48
46
  end
47
+ e.response
49
48
  end
50
49
 
51
50
  # Joins guild
@@ -4,9 +4,8 @@ require 'dsu3/api'
4
4
 
5
5
  module DSU3
6
6
  # Class used to manage multiple bots
7
- class Core
7
+ class Net
8
8
  # @param [Array] tokens List of bot tokens
9
- # If the list of proxy servers is empty, the proxy will not be used
10
9
  def initialize(*tokens)
11
10
  @tokens = tokens
12
11
  end
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.7.0'
4
+ VERSION = '0.8.2'
5
5
  end
data/lib/dsu3.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  require 'logger'
4
4
 
5
5
  require 'dsu3/version'
6
- require 'dsu3/core'
6
+ require 'dsu3/net'
7
7
 
8
8
  # Main DSU3 namespace
9
9
  module DSU3
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.7.0
4
+ version: 0.8.2
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-08-08 00:00:00.000000000 Z
11
+ date: 2022-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -26,16 +26,18 @@ dependencies:
26
26
  version: '2.0'
27
27
  description:
28
28
  email:
29
- executables: []
29
+ executables:
30
+ - dsu3
30
31
  extensions: []
31
32
  extra_rdoc_files:
32
33
  - README.md
33
34
  files:
34
35
  - README.md
36
+ - bin/dsu3
35
37
  - lib/dsu3.rb
36
38
  - lib/dsu3/api.rb
37
39
  - lib/dsu3/api/channel.rb
38
- - lib/dsu3/core.rb
40
+ - lib/dsu3/net.rb
39
41
  - lib/dsu3/props.rb
40
42
  - lib/dsu3/version.rb
41
43
  homepage: https://rubygems.org/gems/dsu3