.avatarURL(options?)
options?: { size?: number; extension?: string; } → string | null
webhook.avatarURL();Class
Incoming webhook. Token is only present after create / fromToken; fetched webhooks use bot auth and cannot execute.
Extends Base
new Webhook(client: Client, data: APIWebhook & { token?: string | null })ClientAPIWebhook & { token?: string | null }| Name | Type | Description |
|---|---|---|
| avatar | string | null | Webhook avatar hash (null = default). |
| channelId | string | Channel this webhook posts to. |
| clientread-only | Client | Parent client instance. |
| createdAtread-only | Date | Date when this webhook was created, derived from its snowflake ID. |
| createdTimestampread-only | number | Unix timestamp (ms) when this webhook was created, derived from its snowflake ID. |
| guildIdread-only | string | Guild this webhook belongs to. |
| idread-only | string | Webhook snowflake ID. |
| name | string | Webhook name. |
| tokenread-only | string | null | Present after create / fromToken; omitted when fetching by ID. |
| userread-only | User | The user that created this webhook. |
options?: { size?: number; extension?: string; } → string | null
webhook.avatarURL();→ Promise<void>
Delete this webhook (token auth when available, otherwise bot auth).
await webhook.delete();messageId: string → Promise<void>
Delete a message sent by this webhook. Requires token.
await webhook.deleteMessage(messageId);options: WebhookEditOptions → Promise<this>
Edit name/avatar. With bot auth (no token), channelId may also be set.
await webhook.edit(options);messageId: string, options: WebhookMessageEditOptions → Promise<Message>
Edit a message previously sent by this webhook. Requires token.
await webhook.editMessage(messageId, options);client: Client, webhookId: string → Promise<Webhook>
Fetch a webhook by ID (bot auth; no token).
await Webhook.fetch(client, webhookId);messageId: string → Promise<Message>
Fetch a message sent by this webhook. Requires token.
await webhook.fetchMessage(messageId);client: Client, webhookId: string, token: string, options?: { channelId?: string; guildId?: string; name?: string; } → Webhook
Build a webhook from a stored id + token (e.g. webhook URL).
Webhook.fromToken(client, webhookId, token);options: string | WebhookSendOptions, wait: boolean → Promise<Message | undefined>
Execute the webhook. Requires token.
string | WebhookSendOptionsbooleanWhen true, appends ?wait=true and returns the created Message.await webhook.send(options, wait);