module DiscordBot::Client::Channels::CreateMessage

CreateMessage module

Public Instance Methods

create_channel_message(channel_id:, content:) click to toggle source

Create message to channel

# File lib/discord_bot/client/channels/create_message.rb, line 8
def create_channel_message(channel_id:, content:)
  # define params for request
  body = { 'content' => content }.to_json
  headers = { 'Content-Type' => 'application/json', 'Authorization' => "Bot #{bot_token}", 'User-Agent' => user_agent }
  # make request
  self.class.post("/channels/#{channel_id}/messages", body: body, headers: headers).parsed_response
end