WebhookClient
WebhookClient ⇐ Base
Section titled “WebhookClient ⇐ Base”Represents a webhook client that can interact with webhooks.
Kind: global class
Extends: Base
- WebhookClient ⇐
Base- new WebhookClient([data], client)
- .fetchWebhook() ⇒
Promise.<Webhook> - .send([options]) ⇒
Promise.<(Message|undefined)> - .delete(message, thread) ⇒
void - .edit(message, [options], [thread]) ⇒
void - .fetch(message, thread) ⇒
Promise.<(Message|undefined)>
new WebhookClient([data], client)
Section titled “new WebhookClient([data], client)”Constructs a new instance of the class.
| Param | Type | Description |
|---|---|---|
| [data] | Object | The data object containing the properties for the instance. |
| client | Client | The client object associated with the instance. |
webhookClient.fetchWebhook() ⇒ Promise.<Webhook>
Section titled “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)>
Section titled “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.
| Param | Type | Description |
|---|---|---|
| [options] | Object | The options for sending the message. |
| [options.wait] | number | The time to wait before sending the message. |
| [options.thread] | string | Object | The thread ID or thread object to send the message to. |
webhookClient.delete(message, thread) ⇒ void
Section titled “webhookClient.delete(message, thread) ⇒ void”Deletes a message from a thread.
Kind: instance method of WebhookClient
| Param | Type | Description |
|---|---|---|
| message | string | Message | The ID or the message object to delete. |
| thread | string | Thread | The ID or the thread object where the message is located. |
webhookClient.edit(message, [options], [thread]) ⇒ void
Section titled “webhookClient.edit(message, [options], [thread]) ⇒ void”Edits a message in a channel using the Discord API.
Kind: instance method of WebhookClient
Throws:
RangeErrorIf the channel is not cached.
| Param | Type | Description |
|---|---|---|
| message | string | Message | The ID or the message object to edit. |
| [options] | Object | The options for editing the message. |
| [thread] | string | ThreadChannel | The ID or the thread channel object where the message is located. |
webhookClient.fetch(message, thread) ⇒ Promise.<(Message|undefined)>
Section titled “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.
| Param | Type | Description |
|---|---|---|
| message | string | Message | The ID or the message object to fetch. |
| thread | string | ThreadChannel | The ID or the thread object to fetch the message from. |