Yor.ts | classes/WebhookClient
yor.ts / Exports / WebhookClient
Class: WebhookClient<T>
Type parameters
Name | Type |
---|---|
T | extends 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
Name | Type |
---|---|
T | extends string | { id : string ; token : string } |
Parameters
Name | Type | Description |
---|---|---|
options | T | The options for the WebhookClient. |
Returns
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
Name | Type | Description |
---|---|---|
reason | string | The 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
Name | Type | Description |
---|---|---|
messageId | string | The ID of the message to delete. |
options? | Object | The query parameters to send with the request. |
options.thread_id | string | - |
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
Name | Type | Description |
---|---|---|
data | RESTPatchAPIWebhookJSONBody & { 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
Name | Type | Description |
---|---|---|
messageId | string | The ID of the message to edit. |
data | RESTPostAPIWebhookWithTokenJSONBody & 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
Name | Type | Description |
---|---|---|
messageId | string | The ID of the message to fetch. |
query? | RESTGetAPIWebhookWithTokenMessageQuery | The 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
Name | Type | Description |
---|---|---|
data | RESTPostAPIWebhookWithTokenJSONBody & 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
Was this page helpful?