Webhook
Incoming webhook. Token is only present after create / `fromToken`; fetched webhooks use bot auth and cannot execute.
Extends Base
Constructor
(client: Client, data: APIWebhook & { token?: string | null })| Param | Type | Description |
|---|---|---|
| client | Client | |
| data | APIWebhook & { token?: string | null } |
Properties
: string | nullWebhook avatar hash (null = default).
: stringChannel this webhook posts to.
: Client (readonly)Parent client instance.
: string (readonly)Guild this webhook belongs to.
: string (readonly)Webhook snowflake ID.
: stringWebhook name.
: string | null (readonly)Present after create / `fromToken`; omitted when fetching by ID.
: User (readonly)The user that created this webhook.
Methods
(options?: { size?: number; extension?: string; }): string | null| Param | Type | Description |
|---|---|---|
| options? | { size?: number; extension?: string; } |
(): Promise<void>Delete this webhook (token auth when available, otherwise bot auth).
(messageId: string): Promise<void>Delete a message sent by this webhook. Requires token.
| Param | Type | Description |
|---|---|---|
| messageId | string |
(options: WebhookEditOptions): Promise<this>Edit name/avatar. With bot auth (no token), `channelId` may also be set.
| Param | Type | Description |
|---|---|---|
| options | WebhookEditOptions |
(messageId: string, options: WebhookMessageEditOptions): Promise<Message>Edit a message previously sent by this webhook. Requires token.
| Param | Type | Description |
|---|---|---|
| messageId | string | |
| options | WebhookMessageEditOptions |
Fetch a webhook by ID (bot auth; no token).
| Param | Type | Description |
|---|---|---|
| client | Client | |
| webhookId | string |
(messageId: string): Promise<Message>Fetch a message sent by this webhook. Requires token.
| Param | Type | Description |
|---|---|---|
| messageId | string |
(client: Client, webhookId: string, token: string, options?: { channelId?: string; guildId?: string; name?: string; }): WebhookBuild a webhook from a stored id + token (e.g. webhook URL).
| Param | Type | Description |
|---|---|---|
| client | Client | |
| webhookId | string | |
| token | string | |
| options? | { channelId?: string; guildId?: string; name?: string; } |
(messageId: string): string| Param | Type | Description |
|---|---|---|
| messageId | string |
(): string(options: string | WebhookSendOptions, wait: boolean): Promise<Message | undefined>Execute the webhook. Requires token.
| Param | Type | Description |
|---|---|---|
| options | string | WebhookSendOptions | |
| wait | boolean | When true, appends `?wait=true` and returns the created `Message`. |