dsu3 0.8.3 → 0.9.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: 436b6a875e8e3780bdcf84904378b75ec9e294f7de1acb1975dbf6e52461b46c
4
- data.tar.gz: 73ad93f5b871e90d9766a50219b1d107920987548c25a43b7e3624f13f5f51a7
3
+ metadata.gz: cbf00362beaf86aea7d0481df9e0be5511287fddb583a4e768f5b08bf171a7a4
4
+ data.tar.gz: ef35c40a9b3f948b318bc7746f41163ac9b372e4c8d177cc7de3af3cf9fd965f
5
5
  SHA512:
6
- metadata.gz: 4855468d31c0eda96977ece189d65aeba170ca459dc2f17dcd02a09752c394184e26f5cd6364402abd9941f50c16976f4812177acbcae561c6391d7941773ff7
7
- data.tar.gz: 3e3f208f7cfca6f3a218e8fa354d556e8b7071f7fb35eb2dc78d1bd84a43e71e3e22571d9652f6d5c40e5d4eaca73ce8161eda36efeb860927399b1d925787e5
6
+ metadata.gz: 8dc1cf7a06a3fd22c3165633007161303415b9dc18ce54c9f59664b087130745cedab7ae31fb3f3bd0ca25012c6381bde45903f32410fbf13eac9b7e92a0f195
7
+ data.tar.gz: 15030d9af29247295cdd221cdb0044b6dd06f67fa740d0ad86d9d717f7380a2c16d0094f688e389ad4ce5bae2bc99bf13f093789a4fb96f10aec4d12b2a3f9e2
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DSU3
4
+ module API
5
+ # Guilds resource
6
+ module Guild
7
+ module_function
8
+
9
+ # Verifies the server member
10
+ # @param [String] token Discord account token
11
+ # @param [String, Integer] guild Guild ID
12
+ # @param [String] invite Invite code
13
+ def verify(token, guild, invite)
14
+ DSU3::API.request(
15
+ token, :get,
16
+ "guilds/#{guild}/member-verification",
17
+ { params: { with_guild: false, invite_code: invite } }
18
+ )
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DSU3
4
+ module API
5
+ # Invites resource
6
+ module Invite
7
+ module_function
8
+
9
+ # Joins guild
10
+ # @param [String] token Discord account token
11
+ # @param [String] invite Invite code
12
+ def join(token, invite)
13
+ DSU3::API.request(
14
+ token, :post, "invites/#{invite}",
15
+ { x_context_properties: 'eyJsb2NhdGlvbiI6Ik1hcmtkb3duIExpbmsifQ==' },
16
+ '{}'
17
+ )
18
+ end
19
+ end
20
+ end
21
+ end
data/lib/dsu3/api.rb CHANGED
@@ -6,6 +6,8 @@ require 'uri'
6
6
 
7
7
  require 'dsu3/props'
8
8
  require 'dsu3/api/channel'
9
+ require 'dsu3/api/guild'
10
+ require 'dsu3/api/invite'
9
11
 
10
12
  module DSU3
11
13
  # Namespace for all methods representing Discord API endpoints
@@ -46,16 +48,5 @@ module DSU3
46
48
  end
47
49
  e.response
48
50
  end
49
-
50
- # Joins guild
51
- # @param [String] token Discord account token
52
- # @param [String] invite Invite code
53
- def join(token, invite)
54
- request(
55
- token, :post, "invites/#{invite}",
56
- { x_context_properties: 'eyJsb2NhdGlvbiI6Ik1hcmtkb3duIExpbmsifQ==' },
57
- '{}'
58
- )
59
- end
60
51
  end
61
52
  end
data/lib/dsu3/net.rb CHANGED
@@ -32,10 +32,10 @@ module DSU3
32
32
  end
33
33
  end
34
34
 
35
- # (see DSU3::API#join)
35
+ # (see DSU3::API::Invite#join)
36
36
  def join(invite)
37
37
  @tokens.each do |token|
38
- DSU3::API.join(token, invite)
38
+ DSU3::API::Invites.join(token, invite)
39
39
  sleep(0.5)
40
40
  end
41
41
  end
@@ -44,5 +44,13 @@ module DSU3
44
44
  def react(channel, message, emoji)
45
45
  @tokens.each { |token| DSU3::API::Channel.react(token, channel, message, emoji) }
46
46
  end
47
+
48
+ # (see DSU3::API::Guild#verify)
49
+ def verify(guild, invite)
50
+ @tokens.each do |token|
51
+ DSU3::API::Guild.verify(token, guild, invite)
52
+ sleep(0.5)
53
+ end
54
+ end
47
55
  end
48
56
  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.8.3'
4
+ VERSION = '0.9.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dsu3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artur Sheremetjev IV
@@ -37,6 +37,8 @@ files:
37
37
  - lib/dsu3.rb
38
38
  - lib/dsu3/api.rb
39
39
  - lib/dsu3/api/channel.rb
40
+ - lib/dsu3/api/guild.rb
41
+ - lib/dsu3/api/invite.rb
40
42
  - lib/dsu3/net.rb
41
43
  - lib/dsu3/props.rb
42
44
  - lib/dsu3/version.rb