module DiscordBot::Client::Webhooks::Execute

Execute module

Public Instance Methods

execute_webhook(webhook_id:, webhook_token:, content:) click to toggle source

Create webhook to channel

# File lib/discord_bot/client/webhooks/execute.rb, line 8
def execute_webhook(webhook_id:, webhook_token:, 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("/webhooks/#{webhook_id}/#{webhook_token}", body: body, headers: headers).parsed_response
end