Sha256: 8a1db2332a25a69b826ed338face54c83a91b0c66a481aac7c6cf5db4f0afdf5

Contents?: true

Size: 604 Bytes

Versions: 1

Compression:

Stored size: 604 Bytes

Contents

module DiscordBot
  class Client
    # Channel module
    module Channels
      # CreateWebhook 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.1 lib/discord_bot/client/channels/create_webhook.rb