Skip to content

WebhookClient

WebhookClient ⇐ Base

Represents a webhook client that can interact with webhooks.

Kind: global class
Extends: Base

new WebhookClient([data], client)

Constructs a new instance of the class.

ParamTypeDescription
[data]ObjectThe data object containing the properties for the instance.
clientClientThe client object associated with the instance.

webhookClient.fetchWebhook() ⇒ Promise.<Webhook>

Fetches a webhook from the server.

Kind: instance method of WebhookClient
Returns: Promise.<Webhook> - A promise that resolves to a Webhook object.

webhookClient.send([options]) ⇒ Promise.<(Message|undefined)>

Sends a message using a webhook.

Kind: instance method of WebhookClient
Returns: Promise.<(Message|undefined)> - - A promise that resolves to the sent message, or undefined if the message failed to send.

ParamTypeDescription
[options]ObjectThe options for sending the message.
[options.wait]numberThe time to wait before sending the message.
[options.thread]string | ObjectThe thread ID or thread object to send the message to.

webhookClient.delete(message, thread) ⇒ void

Deletes a message from a thread.

Kind: instance method of WebhookClient

ParamTypeDescription
messagestring | MessageThe ID or the message object to delete.
threadstring | ThreadThe ID or the thread object where the message is located.

webhookClient.edit(message, [options], [thread]) ⇒ void

Edits a message in a channel using the Discord API.

Kind: instance method of WebhookClient
Throws:

  • RangeError If the channel is not cached.
ParamTypeDescription
messagestring | MessageThe ID or the message object to edit.
[options]ObjectThe options for editing the message.
[thread]string | ThreadChannelThe ID or the thread channel object where the message is located.

webhookClient.fetch(message, thread) ⇒ Promise.<(Message|undefined)>

Fetches a webhook message from the specified thread.

Kind: instance method of WebhookClient
Returns: Promise.<(Message|undefined)> - - A promise that resolves to the fetched message, or undefined if the channel is not found.

ParamTypeDescription
messagestring | MessageThe ID or the message object to fetch.
threadstring | ThreadChannelThe ID or the thread object to fetch the message from.