Sha256: 69cfd8ca9a7669d1f458bc1d4eb83e25f1208d317748126de35bde0e3cf544a2

Contents?: true

Size: 607 Bytes

Versions: 1

Compression:

Stored size: 607 Bytes

Contents

module DiscordBot
  class Client
    # Channel module
    module Channels
      # Message module
      module CreateMessage
        # Create message to channel
        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
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
discord_bot-0.2.0 lib/discord_bot/client/channels/create_message.rb