discord_bot 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29a2e95ced84579ca1f268e2c44a9d6e92037de5f9506b1c0732da2517bce630
4
- data.tar.gz: fda641bd3d17d0ccff55ae85fa820755dfd06e4d6627a41d1d1435455dbaa4bc
3
+ metadata.gz: 22f07e1046ede942c51de185d2e3261c14311e55db9e92c8d9f2274637e1fcc8
4
+ data.tar.gz: f8caaf10b9769495fd72bc838f58593ab7cec3358b4add1cae663ffe9566c863
5
5
  SHA512:
6
- metadata.gz: 882b73b5df8bd175744a92f1b4eba83be1307156a1c68f844a79e2a025e2cefcd2723e973f0ff1273455737f3e8f3a8faccf24e98814e80cd89a3f7e71acbda5
7
- data.tar.gz: be6094f560695e59407837376858c6aca7c18da2e17aaea7ac33417fd27bbd16938edaf318b8913a9eb23795a091b0e3f5ed4d446a5d0518ae173cb16cc92b25
6
+ metadata.gz: a688afed480d794d81a00801ac45057ee67d355214cdda27c6e96a3439fe12d49cabeab6749c1fce91fb0b970448d7e88375a5e323e8c1716088a0b0fec8cf32
7
+ data.tar.gz: 918a900903b1e2c1a7c593078097dd65e103f871162dd4cdb8507a7af8274a23b1ebea5d584e577cdbc6aa2efff4dad4df42cf0e358909a16941cd9cd1d9190f
@@ -6,6 +6,9 @@ require_relative 'client/channels/create_message'
6
6
  require_relative 'client/channels/create_webhook'
7
7
  require_relative 'client/webhooks/execute'
8
8
  require_relative 'client/users/create_channel'
9
+ require_relative 'client/users/me'
10
+ require_relative 'client/gateway/get_gateway'
11
+ require_relative 'client/gateway/get_gateway_bot'
9
12
 
10
13
  module DiscordBot
11
14
  # Client library
@@ -18,8 +21,11 @@ module DiscordBot
18
21
  include DiscordBot::Client::Channels::CreateWebhook
19
22
  include DiscordBot::Client::Webhooks::Execute
20
23
  include DiscordBot::Client::Users::CreateChannel
24
+ include DiscordBot::Client::Users::Me
25
+ include DiscordBot::Client::Gateway::GetGateway
26
+ include DiscordBot::Client::Gateway::GetGatewayBot
21
27
 
22
- base_uri 'https://discordapp.com/api'
28
+ base_uri 'https://discordapp.com/api/v6'
23
29
  format :json
24
30
 
25
31
  attr_reader :bot_token, :user_agent
@@ -2,7 +2,7 @@ module DiscordBot
2
2
  class Client
3
3
  # Channel module
4
4
  module Channels
5
- # Message module
5
+ # Get channel module
6
6
  module Channel
7
7
  # Get channel
8
8
  def get_channel(channel_id:)
@@ -2,7 +2,7 @@ module DiscordBot
2
2
  class Client
3
3
  # Channel module
4
4
  module Channels
5
- # Message module
5
+ # CreateMessage module
6
6
  module CreateMessage
7
7
  # Create message to channel
8
8
  def create_channel_message(channel_id:, content:)
@@ -2,7 +2,7 @@ module DiscordBot
2
2
  class Client
3
3
  # Channel module
4
4
  module Channels
5
- # Message module
5
+ # CreateWebhook module
6
6
  module CreateWebhook
7
7
  # Create webhook to channel
8
8
  def create_channel_webhook(channel_id:, name:)
@@ -0,0 +1,17 @@
1
+ module DiscordBot
2
+ class Client
3
+ # Gateway module
4
+ module Gateway
5
+ # Gateway module
6
+ module GetGateway
7
+ # Get gateway
8
+ def get_gateway
9
+ # define params for request
10
+ headers = { 'Content-Type' => 'application/json', 'Authorization' => "Bot #{bot_token}", 'User-Agent' => user_agent }
11
+ # make request
12
+ self.class.get('/gateway', query: {}, headers: headers).parsed_response
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ module DiscordBot
2
+ class Client
3
+ # Gateway module
4
+ module Gateway
5
+ # Gateway module
6
+ module GetGatewayBot
7
+ # Get gateway bot
8
+ def get_gateway_bot
9
+ # define params for request
10
+ headers = { 'Content-Type' => 'application/json', 'Authorization' => "Bot #{bot_token}", 'User-Agent' => user_agent }
11
+ # make request
12
+ self.class.get('/gateway/bot', query: {}, headers: headers).parsed_response
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -2,7 +2,7 @@ module DiscordBot
2
2
  class Client
3
3
  # Guild module
4
4
  module Guilds
5
- # Members module
5
+ # Channels module
6
6
  module Channels
7
7
  # Get guild channels list
8
8
  def get_guild_channels(guild_id:)
@@ -1,8 +1,8 @@
1
1
  module DiscordBot
2
2
  class Client
3
- # Channel module
3
+ # Users module
4
4
  module Users
5
- # Message module
5
+ # Create channel module
6
6
  module CreateChannel
7
7
  # Create message to channel
8
8
  def create_user_channel(recipient_id:)
@@ -0,0 +1,17 @@
1
+ module DiscordBot
2
+ class Client
3
+ # Users module
4
+ module Users
5
+ # Get user info module
6
+ module Me
7
+ # Returns user
8
+ def me
9
+ # define params for request
10
+ headers = { 'Content-Type' => 'application/json', 'Authorization' => "Bot #{bot_token}", 'User-Agent' => user_agent }
11
+ # make request
12
+ self.class.get('/users/@me', query: {}, headers: headers).parsed_response
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module DiscordBot
2
- VERSION = '0.2.0'.freeze
2
+ VERSION = '0.2.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discord_bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Bogdanov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-05 00:00:00.000000000 Z
11
+ date: 2020-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -91,9 +91,12 @@ files:
91
91
  - lib/discord_bot/client/channels/channel.rb
92
92
  - lib/discord_bot/client/channels/create_message.rb
93
93
  - lib/discord_bot/client/channels/create_webhook.rb
94
+ - lib/discord_bot/client/gateway/get_gateway.rb
95
+ - lib/discord_bot/client/gateway/get_gateway_bot.rb
94
96
  - lib/discord_bot/client/guilds/channels.rb
95
97
  - lib/discord_bot/client/guilds/members.rb
96
98
  - lib/discord_bot/client/users/create_channel.rb
99
+ - lib/discord_bot/client/users/me.rb
97
100
  - lib/discord_bot/client/webhooks/execute.rb
98
101
  - lib/discord_bot/version.rb
99
102
  homepage: https://github.com/kortirso/discord_bot