Webhook
Create Webhook
PostAPIChannelWebhook
Creates a new webhook and returns a webhook object on success.
import { createWebhook } from "dressed";
await createWebhook(channelId, data);Requires the MANAGE_WEBHOOKS permission.
List Channel Webhooks
GetAPIChannelWebhooks
Returns a list of channel webhook objects.
import { listChannelWebhooks } from "dressed";
const channelWebhooks = await listChannelWebhooks(channelId);Requires the MANAGE_WEBHOOKS permission.
List Guild Webhooks
GetAPIGuildWebhooks
Returns a list of guild webhook objects.
import { listGuildWebhooks } from "dressed";
const guildWebhooks = await listGuildWebhooks(guildId);Requires the MANAGE_WEBHOOKS permission.
Get Webhook
GetAPIWebhook
Returns the new webhook object for the given id.
import { getWebhook } from "dressed";
const webhook = await getWebhook(webhookId, webhookToken?);This request requires the MANAGE_WEBHOOKS permission unless the application making the request owns the webhook. (see: webhook.application_id)
Modify Webhook
PatchAPIWebhook
Modify a webhook.
import { modifyWebhook } from "dressed";
await modifyWebhook(webhookId, data, webhookToken?);Requires the MANAGE_WEBHOOKS permission.
Delete Webhook
DeleteAPIWebhook
Delete a webhook permanently.
import { deleteWebhook } from "dressed";
await deleteWebhook(webhookId, webhookToken?);Requires the MANAGE_WEBHOOKS permission.
Execute Webhook
PostAPIWebhookWithToken
Execute a webhook.
import { executeWebhook } from "dressed";
await executeWebhook(webhookId, webhookToken, data, params?);- If the webhook channel is a forum or media channel, you must provide either
thread_idin the query string params, orthread_namein the JSON/form params. Ifthread_idis provided, the message will send in that thread. Ifthread_nameis provided, a thread with that name will be created in the channel. - For the webhook embed objects, you can set every field except
type(it will berichregardless of if you try to set it),provider,video, and anyheight,width, orproxy_urlvalues for images.
Get Webhook Message
GetAPIWebhookWithTokenMessage
Returns a previously-sent webhook message from the same token.
import { getWebhookMessage } from "dressed";
const webhookMessage = await getWebhookMessage(webhookId, webhookToken, messageId, params?);Edit Webhook Message
PatchAPIWebhookWithTokenMessage
Edits a previously-sent webhook message from the same token.
import { editWebhookMessage } from "dressed";
await editWebhookMessage(webhookId, webhookToken, messageId, data, params?);Starting with API v10, the attachments array must contain all attachments that should be present after edit, including retained and new attachments provided in the request body.
Delete Webhook Message
DeleteAPIWebhookWithTokenMessage
Deletes a message that was created by the webhook.
import { deleteWebhookMessage } from "dressed";
await deleteWebhookMessage(webhookId, webhookToken, messageId, params?);