Sha256: cb49084559173421cd9301ea7503591cd6a9d154eeed0e6c45b4cf1ca6cd1d72

Contents?: true

Size: 598 Bytes

Versions: 1

Compression:

Stored size: 598 Bytes

Contents

module DiscordBot
  class Client
    # Channel module
    module Channels
      # Message module
      module CreateWebhook
        # Create webhook to channel
        def create_channel_webhook(channel_id:, name:)
          # define params for request
          body = { 'name' => name }.to_json
          headers = { 'Content-Type' => 'application/json', 'Authorization' => "Bot #{bot_token}", 'User-Agent' => user_agent }
          # make request
          self.class.post("/channels/#{channel_id}/webhooks", 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_webhook.rb