mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 17:43:30 +01:00
fix(core): fix inconsistencies on core (#9680)
* fix(core): fix inconsistencies on `core` * fix: add `createForumPost` back * fix: create -> createWebhook
This commit is contained in:
@@ -10,8 +10,6 @@ import {
|
||||
type RESTPatchAPIWebhookResult,
|
||||
type RESTPatchAPIWebhookWithTokenMessageJSONBody,
|
||||
type RESTPatchAPIWebhookWithTokenMessageResult,
|
||||
type RESTPostAPIChannelWebhookJSONBody,
|
||||
type RESTPostAPIChannelWebhookResult,
|
||||
type RESTPostAPIWebhookWithTokenGitHubQuery,
|
||||
type RESTPostAPIWebhookWithTokenJSONBody,
|
||||
type RESTPostAPIWebhookWithTokenQuery,
|
||||
@@ -30,32 +28,12 @@ export class WebhooksAPI {
|
||||
* @see {@link https://discord.com/developers/docs/resources/webhook#get-webhook-with-token}
|
||||
* @param id - The id of the webhook
|
||||
* @param token - The token of the webhook
|
||||
* @param options - The options to use when fetching the webhook
|
||||
* @param options - The options for fetching the webhook
|
||||
*/
|
||||
public async get(id: Snowflake, token?: string, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
return this.rest.get(Routes.webhook(id, token), { signal }) as Promise<RESTGetAPIWebhookResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new webhook
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/webhook#create-webhook}
|
||||
* @param channelId - The id of the channel to create the webhook in
|
||||
* @param body - The data to use when creating the webhook
|
||||
* @param options - The options to use when creating the webhook
|
||||
*/
|
||||
public async create(
|
||||
channelId: Snowflake,
|
||||
body: RESTPostAPIChannelWebhookJSONBody,
|
||||
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {},
|
||||
) {
|
||||
return this.rest.post(Routes.channelWebhooks(channelId), {
|
||||
reason,
|
||||
body,
|
||||
signal,
|
||||
}) as Promise<RESTPostAPIChannelWebhookResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Edits a webhook
|
||||
*
|
||||
@@ -63,7 +41,7 @@ export class WebhooksAPI {
|
||||
* @see {@link https://discord.com/developers/docs/resources/webhook#modify-webhook-with-token}
|
||||
* @param id - The id of the webhook to edit
|
||||
* @param body - The new webhook data
|
||||
* @param options - The options to use when editing the webhook
|
||||
* @param options - The options for editing the webhook
|
||||
*/
|
||||
public async edit(
|
||||
id: Snowflake,
|
||||
@@ -83,7 +61,7 @@ export class WebhooksAPI {
|
||||
* @see {@link https://discord.com/developers/docs/resources/webhook#delete-webhook}
|
||||
* @see {@link https://discord.com/developers/docs/resources/webhook#delete-webhook-with-token}
|
||||
* @param id - The id of the webhook to delete
|
||||
* @param options - The options to use when deleting the webhook
|
||||
* @param options - The options for deleting the webhook
|
||||
*/
|
||||
public async delete(
|
||||
id: Snowflake,
|
||||
@@ -98,8 +76,8 @@ export class WebhooksAPI {
|
||||
* @see {@link https://discord.com/developers/docs/resources/webhook#execute-webhook}
|
||||
* @param id - The id of the webhook
|
||||
* @param token - The token of the webhook
|
||||
* @param body - The data to use when executing the webhook
|
||||
* @param options - The options to use when executing the webhook
|
||||
* @param body - The data for executing the webhook
|
||||
* @param options - The options for executing the webhook
|
||||
*/
|
||||
public async execute(
|
||||
id: Snowflake,
|
||||
@@ -114,8 +92,8 @@ export class WebhooksAPI {
|
||||
* @see {@link https://discord.com/developers/docs/resources/webhook#execute-webhook}
|
||||
* @param id - The id of the webhook
|
||||
* @param token - The token of the webhook
|
||||
* @param body - The data to use when executing the webhook
|
||||
* @param options - The options to use when executing the webhook
|
||||
* @param body - The data for executing the webhook
|
||||
* @param options - The options for executing the webhook
|
||||
*/
|
||||
public async execute(
|
||||
id: Snowflake,
|
||||
@@ -130,8 +108,8 @@ export class WebhooksAPI {
|
||||
* @see {@link https://discord.com/developers/docs/resources/webhook#execute-webhook}
|
||||
* @param id - The id of the webhook
|
||||
* @param token - The token of the webhook
|
||||
* @param body - The data to use when executing the webhook
|
||||
* @param options - The options to use when executing the webhook
|
||||
* @param body - The data for executing the webhook
|
||||
* @param options - The options for executing the webhook
|
||||
*/
|
||||
public async execute(
|
||||
id: Snowflake,
|
||||
@@ -160,9 +138,9 @@ export class WebhooksAPI {
|
||||
* @see {@link https://discord.com/developers/docs/resources/webhook#execute-slackcompatible-webhook}
|
||||
* @param id - The id of the webhook
|
||||
* @param token - The token of the webhook
|
||||
* @param body - The data to use when executing the webhook
|
||||
* @param query - The query options to use when executing the webhook
|
||||
* @param options - The options to use when executing the webhook
|
||||
* @param body - The data for executing the webhook
|
||||
* @param query - The query options for executing the webhook
|
||||
* @param options - The options for executing the webhook
|
||||
*/
|
||||
public async executeSlack(
|
||||
id: Snowflake,
|
||||
@@ -185,9 +163,9 @@ export class WebhooksAPI {
|
||||
* @see {@link https://discord.com/developers/docs/resources/webhook#execute-githubcompatible-webhook}
|
||||
* @param id - The id of the webhook
|
||||
* @param token - The token of the webhook
|
||||
* @param body - The data to use when executing the webhook
|
||||
* @param query - The options to use when executing the webhook
|
||||
* @param options - The options to use when executing the webhook
|
||||
* @param body - The data for executing the webhook
|
||||
* @param query - The options for executing the webhook
|
||||
* @param options - The options for executing the webhook
|
||||
*/
|
||||
public async executeGitHub(
|
||||
id: Snowflake,
|
||||
@@ -211,8 +189,8 @@ export class WebhooksAPI {
|
||||
* @param id - The id of the webhook
|
||||
* @param token - The token of the webhook
|
||||
* @param messageId - The id of the message to fetch
|
||||
* @param query - The query options to use when fetching the message
|
||||
* @param options - The options to use when fetching the message
|
||||
* @param query - The query options for fetching the message
|
||||
* @param options - The options for fetching the message
|
||||
*/
|
||||
public async getMessage(
|
||||
id: Snowflake,
|
||||
@@ -235,8 +213,8 @@ export class WebhooksAPI {
|
||||
* @param id - The id of the webhook
|
||||
* @param token - The token of the webhook
|
||||
* @param messageId - The id of the message to edit
|
||||
* @param body - The data to use when editing the message
|
||||
* @param options - The options to use when editing the message
|
||||
* @param body - The data for editing the message
|
||||
* @param options - The options for editing the message
|
||||
*/
|
||||
public async editMessage(
|
||||
id: Snowflake,
|
||||
@@ -265,8 +243,8 @@ export class WebhooksAPI {
|
||||
* @param id - The id of the webhook
|
||||
* @param token - The token of the webhook
|
||||
* @param messageId - The id of the message to delete
|
||||
* @param query - The options to use when deleting the message
|
||||
* @param options - The options to use when deleting the message
|
||||
* @param query - The options for deleting the message
|
||||
* @param options - The options for deleting the message
|
||||
*/
|
||||
public async deleteMessage(
|
||||
id: Snowflake,
|
||||
|
||||
Reference in New Issue
Block a user