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 +4 -4
- data/README.md +8 -0
- data/bin/dsu3 +8 -0
- data/lib/dsu3/api/channel.rb +1 -1
- data/lib/dsu3/api.rb +10 -11
- data/lib/dsu3/{core.rb → net.rb} +1 -2
- data/lib/dsu3/version.rb +1 -1
- data/lib/dsu3.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b88a7d6933638d26698a37973d16bf72916bbf720997b6b7c02bc1a7b3c06bac
|
4
|
+
data.tar.gz: 2ce56289607005aa9bec7ff8f1de789c04d1d85d79696f959ad6adad7bb6cee6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
data/lib/dsu3/api/channel.rb
CHANGED
@@ -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
|
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]
|
20
|
+
# @param [String] route Discord API route
|
21
21
|
# @param [Hash] headers Additional request headers
|
22
22
|
# @param [String] payload
|
23
|
-
|
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,
|
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
|
-
|
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
|
data/lib/dsu3/{core.rb → net.rb}
RENAMED
@@ -4,9 +4,8 @@ require 'dsu3/api'
|
|
4
4
|
|
5
5
|
module DSU3
|
6
6
|
# Class used to manage multiple bots
|
7
|
-
class
|
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
data/lib/dsu3.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.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-
|
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/
|
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
|