Class

Webhook

Incoming webhook. Token is only present after create / fromToken; fetched webhooks use bot auth and cannot execute.

Extends Base

Constructor

new Webhook(client: Client, data: APIWebhook & { token?: string | null })
client
Client
data
APIWebhook & { token?: string | null }

Properties

NameTypeDescription
avatarstring | nullWebhook avatar hash (null = default).
channelIdstringChannel this webhook posts to.
clientread-onlyClientParent client instance.
createdAtread-onlyDateDate when this webhook was created, derived from its snowflake ID.
createdTimestampread-onlynumberUnix timestamp (ms) when this webhook was created, derived from its snowflake ID.
guildIdread-onlystringGuild this webhook belongs to.
idread-onlystringWebhook snowflake ID.
namestringWebhook name.
tokenread-onlystring | nullPresent after create / fromToken; omitted when fetching by ID.
userread-onlyUserThe user that created this webhook.

Methods

.avatarURL(options?)

options?: { size?: number; extension?: string; }string | null

webhook.avatarURL();

.delete()

Promise<void>

Delete this webhook (token auth when available, otherwise bot auth).

await webhook.delete();

.deleteMessage(messageId)

messageId: stringPromise<void>

Delete a message sent by this webhook. Requires token.

await webhook.deleteMessage(messageId);