WebhooksAPI
declare class WebhooksAPI
declare class WebhooksAPI
No summary provided.
constructor(rest)
Constructs a new instance of the
WebhooksAPI
className | Type | Optional | Description |
---|---|---|---|
rest | REST | No | None |
create(channelId, data, reason?)
:
Promise<never>
Creates a new webhook
Name | Type | Optional | Description |
---|---|---|---|
channelId | Snowflake | No | The id of the channel to create the webhook in |
data | RESTPostAPIChannelWebhookJSONBody | No | The data to use when creating the webhook |
reason | string | Yes | The reason for creating the webhook |
delete(id, { token, reason }?)
:
Promise<void>
Deletes a webhook
Name | Type | Optional | Description |
---|---|---|---|
id | Snowflake | No | The id of the webhook to delete |
{ token, reason } | { reason?: string; token?: string; } | Yes | None |
deleteMessage(id, token, messageId, options?)
:
Promise<void>
Deletes an associated message from a webhook
Name | Type | Optional | Description |
---|---|---|---|
id | Snowflake | No | The id of the webhook |
token | string | No | The token of the webhook |
messageId | Snowflake | No | The id of the message to delete |
options | { thread_id?: string; } | Yes | The options to use when deleting the message |
edit(id, webhook, { token, reason }?)
:
Promise<discord_api_types_v10.APIWebhook>
Edits a webhook
Name | Type | Optional | Description |
---|---|---|---|
id | Snowflake | No | The id of the webhook to edit |
webhook | RESTPatchAPIWebhookJSONBody | No | The new webhook data |
{ token, reason } | { reason?: string; token?: string; } | Yes | None |
editMessage(id, token, messageId, { thread_id, ...body })
:
Promise<discord_api_types_v10.APIMessage>
Edits an associated message from a webhook
Name | Type | Optional | Description |
---|---|---|---|
id | Snowflake | No | The id of the webhook |
token | string | No | The token of the webhook |
messageId | Snowflake | No | The id of the message to edit |
{ thread_id, ...body } | RESTPatchAPIWebhookWithTokenMessageJSONBody & { thread_id?: string; } | No | None |
execute(id, token, data)
:
Promise<RESTPostAPIWebhookWithTokenWaitResult>
Executes a webhook and returns the created message
Name | Type | Optional | Description |
---|---|---|---|
id | Snowflake | No | The id of the webhook |
token | string | No | The token of the webhook |
data | RESTPostAPIWebhookWithTokenJSONBody & RESTPostAPIWebhookWithTokenQuery & { files?: RawFile[]; wait: true; } | No | The data to use when executing the webhook |
execute(id, token, data)
:
Promise<void>
Executes a webhook and returns the created message
Name | Type | Optional | Description |
---|---|---|---|
id | Snowflake | No | The id of the webhook |
token | string | No | The token of the webhook |
data | RESTPostAPIWebhookWithTokenJSONBody & RESTPostAPIWebhookWithTokenQuery & { files?: RawFile[]; wait: true; } | No | The data to use when executing the webhook |
executeGitHub(id, token, body, options?)
:
Promise<void>
Executes a github webhook
Name | Type | Optional | Description |
---|---|---|---|
id | Snowflake | No | The id of the webhook |
token | string | No | The token of the webhook |
body | unknown | No | None |
options | RESTPostAPIWebhookWithTokenGitHubQuery | Yes | The options to use when executing the webhook |
executeSlack(id, token, body, options?)
:
Promise<void>
Executes a slack webhook
Name | Type | Optional | Description |
---|---|---|---|
id | Snowflake | No | The id of the webhook |
token | string | No | The token of the webhook |
body | unknown | No | None |
options | RESTPostAPIWebhookWithTokenSlackQuery | Yes | The options to use when executing the webhook |
get(id, token?)
:
Promise<discord_api_types_v10.APIWebhook>
Fetches a webhook
Name | Type | Optional | Description |
---|---|---|---|
id | Snowflake | No | The id of the webhook |
token | string | Yes | The token of the webhook |
getMessage(id, token, messageId, options?)
:
Promise<discord_api_types_v10.APIMessage>
Fetches an associated message from a webhook
Name | Type | Optional | Description |
---|---|---|---|
id | Snowflake | No | The id of the webhook |
token | string | No | The token of the webhook |
messageId | Snowflake | No | The id of the message to fetch |
options | { thread_id?: string; } | Yes | The options to use when fetching the message |