Module: DiscordBot::Client::Users::CreateChannel

Included in:
DiscordBot::Client
Defined in:
lib/discord_bot/client/users/create_channel.rb

Overview

Create channel module

Instance Method Summary collapse

Instance Method Details

#create_user_channel(recipient_id:) ⇒ Object

Create message to channel



8
9
10
11
12
13
14
# File 'lib/discord_bot/client/users/create_channel.rb', line 8

def create_user_channel(recipient_id:)
  # define params for request
  body = { 'recipient_id' => recipient_id }.to_json
  headers = { 'Content-Type' => 'application/json', 'Authorization' => "Bot #{bot_token}", 'User-Agent' => user_agent }
  # make request
  self.class.post('/users/@me/channels', body: body, headers: headers).parsed_response
end