module DiscordBot::Client::Channels::CreateWebhook

CreateWebhook module

Public Instance Methods

create_channel_webhook(channel_id:, name:) click to toggle source

Create webhook to channel

# File lib/discord_bot/client/channels/create_webhook.rb, line 8
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