Module: Discordrb::API::Webhook
- Defined in:
- lib/discordrb/api/webhook.rb
Overview
API calls for Webhook object
Class Method Summary collapse
-
.delete_webhook(token, webhook_id, reason = nil) ⇒ Object
Deletes a webhook https://discord.com/developers/docs/resources/webhook#delete-webhook.
-
.token_delete_webhook(webhook_token, webhook_id, reason = nil) ⇒ Object
Deletes a webhook via webhook token https://discord.com/developers/docs/resources/webhook#delete-webhook-with-token.
-
.token_update_webhook(webhook_token, webhook_id, data, reason = nil) ⇒ Object
Update a webhook via webhook token https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token.
-
.token_webhook(webhook_token, webhook_id) ⇒ Object
Get a webhook via webhook token https://discord.com/developers/docs/resources/webhook#get-webhook-with-token.
-
.update_webhook(token, webhook_id, data, reason = nil) ⇒ Object
Update a webhook https://discord.com/developers/docs/resources/webhook#modify-webhook.
- .webhook(token, webhook_id) ⇒ Object
Class Method Details
.delete_webhook(token, webhook_id, reason = nil) ⇒ Object
Deletes a webhook https://discord.com/developers/docs/resources/webhook#delete-webhook
61 62 63 64 65 66 67 68 69 70 |
# 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) ⇒ Object
Deletes a webhook via webhook token https://discord.com/developers/docs/resources/webhook#delete-webhook-with-token
74 75 76 77 78 79 80 81 82 |
# 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) ⇒ Object
Update a webhook via webhook token https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token
47 48 49 50 51 52 53 54 55 56 57 |
# 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) ⇒ Object
Get a webhook via webhook token https://discord.com/developers/docs/resources/webhook#get-webhook-with-token
21 22 23 24 25 26 27 28 |
# 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) ⇒ Object
Update a webhook https://discord.com/developers/docs/resources/webhook#modify-webhook
32 33 34 35 36 37 38 39 40 41 42 43 |
# 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 |