yor.ts / Exports / WebhookClient

Class: WebhookClient<T>

Type parameters

NameType
Textends string | { id: string ; token: string }

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new WebhookClient<T>(options): WebhookClient<T>

Creates a new WebhookClient instance.

Type parameters

NameType
Textends string | { id: string ; token: string }

Parameters

NameTypeDescription
optionsTThe options for the WebhookClient.

Returns

WebhookClient<T>

Defined in

src/structures/WebhookClient.ts:29

Properties

API

Private API: WebhooksAPI

Defined in

src/structures/WebhookClient.ts:22


id

Readonly id: string

Defined in

src/structures/WebhookClient.ts:19


token

Readonly token: string

Defined in

src/structures/WebhookClient.ts:20

Methods

delete

delete(reason): Promise<void>

Deletes the resource with the given reason.

Parameters

NameTypeDescription
reasonstringThe reason for deleting the resource.

Returns

Promise<void>

A promise that resolves with the result of the deletion operation.

Defined in

src/structures/WebhookClient.ts:71


deleteMessage

deleteMessage(messageId, options?): Promise<void>

Deletes a webhook message.

Parameters

NameTypeDescription
messageIdstringThe ID of the message to delete.
options?ObjectThe query parameters to send with the request.
options.thread_idstring-

Returns

Promise<void>

A promise that resolves once the message is deleted.

Defined in

src/structures/WebhookClient.ts:115


edit

edit(data): Promise<APIWebhook>

Edits the webhook with the provided data.

Parameters

NameTypeDescription
dataRESTPatchAPIWebhookJSONBody & { reason: string }The data to edit the webhook with, including the reason.

Returns

Promise<APIWebhook>

A promise that resolves to the edited webhook.

Defined in

src/structures/WebhookClient.ts:58


editMessage

editMessage(messageId, data): Promise<APIMessage>

Edits a previously sent webhook message.

Parameters

NameTypeDescription
messageIdstringThe ID of the message to edit.
dataRESTPostAPIWebhookWithTokenJSONBody & RESTPostAPIWebhookWithTokenQuery & { files?: RawFile[] }The new data for the message.

Returns

Promise<APIMessage>

A promise that resolves to the edited message.

Defined in

src/structures/WebhookClient.ts:98


fetchMessage

fetchMessage(messageId, query?): Promise<APIMessage>

Fetches a message that was created by the webhook.

Parameters

NameTypeDescription
messageIdstringThe ID of the message to fetch.
query?RESTGetAPIWebhookWithTokenMessageQueryThe query parameters to send with the request.

Returns

Promise<APIMessage>

A promise that resolves to the fetched message.

Defined in

src/structures/WebhookClient.ts:129


send

send(data): Promise<APIMessage>

Sends the provided data using the API’s execute method.

Parameters

NameTypeDescription
dataRESTPostAPIWebhookWithTokenJSONBody & RESTPostAPIWebhookWithTokenQuery & { files?: RawFile[] ; wait: true }The data to be sent.

Returns

Promise<APIMessage>

A promise that resolves to the result of the execute method.

Defined in

src/structures/WebhookClient.ts:81