/** @module Routes/Webhooks */ import type { CreateWebhookOptions, DeleteWebhookMessageOptions, EditWebhookMessageOptions, EditWebhookOptions, EditWebhookTokenOptions, ExecuteWebhookOptions, ExecuteWebhookWaitOptions } from "../types/webhooks"; import type { AnyTextChannelWithoutGroup } from "../types/channels"; import Webhook from "../structures/Webhook"; import Message from "../structures/Message"; import type RESTManager from "../rest/RESTManager"; import type { Uncached } from "../types/shared"; /** Various methods for interacting with webhooks. */ export default class Webhooks { #private; constructor(manager: RESTManager); /** * Creat a channel webhook. * @param channelID The ID of the channel to create the webhook in. * @param options The options to create the webhook with. */ create(channelID: string, options: CreateWebhookOptions): Promise; /** * Delete a webhook. * @param webhookID The ID of the webhook. * @param reason The reason for deleting the webhook. */ delete(webhookID: string, reason?: string): Promise; /** * Delete a webhook message. * @param webhookID The ID of the webhook. * @param token The token of the webhook. * @param messageID The ID of the message. * @param options The options for deleting the message. */ deleteMessage(webhookID: string, token: string, messageID: string, options?: DeleteWebhookMessageOptions): Promise; /** * Delete a webhook via its token. * @param webhookID The ID of the webhook. * @param token The token of the webhook. */ deleteToken(webhookID: string, token: string): Promise; /** * Edit a webhook. * @param webhookID The ID of the webhook. * @param options The options for editing the webhook. */ edit(webhookID: string, options: EditWebhookOptions): Promise; /** * Edit a webhook message. * @param webhookID The ID of the webhook. * @param token The token of the webhook. * @param messageID The ID of the message to edit. * @param options The options for editing the message. */ editMessage(webhookID: string, token: string, messageID: string, options: EditWebhookMessageOptions): Promise>; /** * Edit a webhook via its token. * @param webhookID The ID of the webhook. * @param options The options for editing the webhook. */ editToken(webhookID: string, token: string, options: EditWebhookTokenOptions): Promise; /** * Execute a webhook. * @param webhookID The ID of the webhook. * @param token The token of the webhook. * @param options The options for executing the webhook. */ execute(webhookID: string, token: string, options: ExecuteWebhookWaitOptions): Promise>; execute(webhookID: string, token: string, options: ExecuteWebhookOptions): Promise; /** * Execute a GitHub compatible webhook. * @param webhookID The ID of the webhook. * @param token The token of the webhook. * @param options The options to send. See GitHub's documentation for more information. */ executeGithub(webhookID: string, token: string, options: Record & { wait: false; }): Promise; executeGithub(webhookID: string, token: string, options: Record & { wait?: true; }): Promise>; /** * Execute a slack compatible webhook. * @param webhookID The ID of the webhook. * @param token The token of the webhook. * @param options The options to send. See [Slack's Documentation](https://api.slack.com/incoming-webhooks) for more information. */ executeSlack(webhookID: string, token: string, options: Record & { wait: false; }): Promise; executeSlack(webhookID: string, token: string, options: Record & { wait?: true; }): Promise>; /** * Get a webhook by ID (and optionally token). * @param webhookID The ID of the webhook. * @param token The token of the webhook. */ get(webhookID: string, token?: string): Promise; /** * Get the webhooks in the specified channel. * @param channelID The ID of the channel to get the webhooks of. */ getForChannel(channelID: string): Promise>; /** * Get the webhooks in the specified guild. * @param guildID The ID of the guild to get the webhooks of. */ getForGuild(guildID: string): Promise>; /** * Get a webhook message. * @param webhookID The ID of the webhook. * @param token The token of the webhook. * @param messageID The ID of the message. * @param threadID The ID of the thread the message is in. */ getMessage(webhookID: string, token: string, messageID: string, threadID?: string): Promise>; }