Skip to content

Webhook

Webhook ⇐ Base

Represents a webhook.

Kind: global class
Extends: Base

new Webhook([data], guildId, client)

Constructs a new instance of the Webhook class.

ParamTypeDescription
[data]ObjectThe data for the webhook.
guildIdstringThe ID of the guild the webhook belongs to.
clientClientThe client that instantiated this webhook.

webhook.fetch(token) ⇒ Promise.<Webhook>

Fetches a webhook using the provided token.

Kind: instance method of Webhook
Returns: Promise.<Webhook> - A promise that resolves to the fetched webhook.

ParamTypeDescription
tokenstringThe token used to authenticate the webhook.

webhook.edit(options) ⇒ Webhook

Edits the webhook with the specified options.

Kind: instance method of Webhook
Returns: Webhook - - The edited webhook.

ParamTypeDescription
optionsObjectThe options for editing the webhook.
[options.reason]stringThe reason for the edit.
[options.name]stringThe new name for the webhook.
[options.avatar]string | FileThe new avatar for the webhook.
[options.channel]string | ChannelThe new channel for the webhook.
[options.token]stringThe token of the webhook.

webhook.setName(name, reason) ⇒ Promise

Sets the name and reason for an object.

Kind: instance method of Webhook
Returns: Promise - - A promise that resolves when the name and reason are successfully set.

ParamTypeDescription
namestringThe new name to set.
reasonstringThe reason for setting the new name.

webhook.setAvatar(avatar, reason) ⇒ Promise

Sets the avatar for the user.

Kind: instance method of Webhook
Returns: Promise - - A promise that resolves when the avatar is successfully set.

ParamTypeDescription
avatarstringThe URL or file path of the new avatar image.
reasonstringThe reason for setting the new avatar.

webhook.setChannel(channel, reason) ⇒ Promise.<void>

Sets the channel for the current object and updates it with the given reason.

Kind: instance method of Webhook
Returns: Promise.<void> - - A promise that resolves when the channel is successfully set.

ParamTypeDescription
channelChannelThe channel to set.
reasonstringThe reason for setting the channel.

webhook.delete([options]) ⇒ Promise

Deletes the webhook.

Kind: instance method of Webhook
Returns: Promise - A promise that resolves to the deleted webhook.

ParamTypeDescription
[options]ObjectOptional parameters for the deletion.
[options.token]stringThe token associated with the webhook.
[options.reason]stringThe reason for the deletion.

webhook.defaultAvatarURL() ⇒ string

Returns the default URL for an avatar image.

Kind: instance method of Webhook
Returns: string - The URL of the default avatar image.

webhook.displayAvatarURL(options) ⇒ string

Returns the URL of the avatar for the user or webhook.

Kind: instance method of Webhook
Returns: string - The URL of the avatar.

ParamTypeDescription
optionsObjectThe options for generating the avatar URL.
[options.dynamic]booleanWhether to generate a dynamic avatar URL.
[options.size]numberThe size of the avatar in pixels.
[options.format]stringThe format of the avatar image.