Webhook
Webhook ⇐ Base
Represents a webhook.
Kind: global class
Extends: Base
- Webhook ⇐
Base
- new Webhook([data], guildId, client)
- .fetch(token) ⇒
Promise.<Webhook>
- .edit(options) ⇒
Webhook
- .setName(name, reason) ⇒
Promise
- .setAvatar(avatar, reason) ⇒
Promise
- .setChannel(channel, reason) ⇒
Promise.<void>
- .delete([options]) ⇒
Promise
- .defaultAvatarURL() ⇒
string
- .displayAvatarURL(options) ⇒
string
new Webhook([data], guildId, client)
Constructs a new instance of the Webhook class.
Param | Type | Description |
---|---|---|
[data] | Object | The data for the webhook. |
guildId | string | The ID of the guild the webhook belongs to. |
client | Client | The 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.
Param | Type | Description |
---|---|---|
token | string | The 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.
Param | Type | Description |
---|---|---|
options | Object | The options for editing the webhook. |
[options.reason] | string | The reason for the edit. |
[options.name] | string | The new name for the webhook. |
[options.avatar] | string | File | The new avatar for the webhook. |
[options.channel] | string | Channel | The new channel for the webhook. |
[options.token] | string | The 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.
Param | Type | Description |
---|---|---|
name | string | The new name to set. |
reason | string | The 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.
Param | Type | Description |
---|---|---|
avatar | string | The URL or file path of the new avatar image. |
reason | string | The 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.
Param | Type | Description |
---|---|---|
channel | Channel | The channel to set. |
reason | string | The 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.
Param | Type | Description |
---|---|---|
[options] | Object | Optional parameters for the deletion. |
[options.token] | string | The token associated with the webhook. |
[options.reason] | string | The 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.
Param | Type | Description |
---|---|---|
options | Object | The options for generating the avatar URL. |
[options.dynamic] | boolean | Whether to generate a dynamic avatar URL. |
[options.size] | number | The size of the avatar in pixels. |
[options.format] | string | The format of the avatar image. |