module Discordrb::API::Webhook

API calls for Webhook object

Public Instance Methods

delete_webhook(token, webhook_id, reason = nil) click to toggle source

Deletes a webhook discordapp.com/developers/docs/resources/webhook#delete-webhook

# File lib/discordrb/api/webhook.rb, line 61
def delete_webhook(token, webhook_id, reason = nil)
  Discordrb::API.request(
    :webhooks_wid,
    webhook_id,
    :delete,
    "#{Discordrb::API.api_base}/webhooks/#{webhook_id}",
    Authorization: token,
    'X-Audit-Log-Reason': reason
  )
end
token_delete_webhook(webhook_token, webhook_id, reason = nil) click to toggle source

Deletes a webhook via webhook token discordapp.com/developers/docs/resources/webhook#delete-webhook-with-token

# File lib/discordrb/api/webhook.rb, line 74
def token_delete_webhook(webhook_token, webhook_id, reason = nil)
  Discordrb::API.request(
    :webhooks_wid,
    webhook_id,
    :delete,
    "#{Discordrb::API.api_base}/webhooks/#{webhook_id}/#{webhook_token}",
    'X-Audit-Log-Reason': reason
  )
end
token_update_webhook(webhook_token, webhook_id, data, reason = nil) click to toggle source

Update a webhook via webhook token discordapp.com/developers/docs/resources/webhook#modify-webhook-with-token

# File lib/discordrb/api/webhook.rb, line 47
def token_update_webhook(webhook_token, webhook_id, data, reason = nil)
  Discordrb::API.request(
    :webhooks_wid,
    webhook_id,
    :patch,
    "#{Discordrb::API.api_base}/webhooks/#{webhook_id}/#{webhook_token}",
    data.to_json,
    content_type: :json,
    'X-Audit-Log-Reason': reason
  )
end
token_webhook(webhook_token, webhook_id) click to toggle source

Get a webhook via webhook token discordapp.com/developers/docs/resources/webhook#get-webhook-with-token

# File lib/discordrb/api/webhook.rb, line 21
def token_webhook(webhook_token, webhook_id)
  Discordrb::API.request(
    :webhooks_wid,
    nil,
    :get,
    "#{Discordrb::API.api_base}/webhooks/#{webhook_id}/#{webhook_token}"
  )
end
update_webhook(token, webhook_id, data, reason = nil) click to toggle source

Update a webhook discordapp.com/developers/docs/resources/webhook#modify-webhook

# File lib/discordrb/api/webhook.rb, line 32
def update_webhook(token, webhook_id, data, reason = nil)
  Discordrb::API.request(
    :webhooks_wid,
    webhook_id,
    :patch,
    "#{Discordrb::API.api_base}/webhooks/#{webhook_id}",
    data.to_json,
    Authorization: token,
    content_type: :json,
    'X-Audit-Log-Reason': reason
  )
end
webhook(token, webhook_id) click to toggle source

Get a webhook discordapp.com/developers/docs/resources/webhook#get-webhook

# File lib/discordrb/api/webhook.rb, line 9
def webhook(token, webhook_id)
  Discordrb::API.request(
    :webhooks_wid,
    nil,
    :get,
    "#{Discordrb::API.api_base}/webhooks/#{webhook_id}",
    Authorization: token
  )
end