UNPKG

seyfert

Version:

The most advanced framework for discord bots

71 lines (70 loc) 3.64 kB
import { type WebhookMessageStructure, type WebhookStructure } from '../../client/transformers'; import { type MessageWebhookMethodEditParams, type MessageWebhookMethodWriteParams } from '../../structures'; import type { RESTPatchAPIWebhookJSONBody, RESTPatchAPIWebhookWithTokenJSONBody, RESTPostAPIChannelWebhookJSONBody } from '../../types'; import { BaseShorter } from './base'; export declare class WebhookShorter extends BaseShorter { create(channelId: string, body: RESTPostAPIChannelWebhookJSONBody): Promise<WebhookStructure>; /** * Deletes a webhook. * @param webhookId The ID of the webhook. * @param options The optional parameters including token and reason. * @returns A Promise that resolves when the webhook is deleted. */ delete(webhookId: string, options: WebhookShorterOptionalParams): Promise<never>; /** * Edits a webhook. * @param webhookId The ID of the webhook. * @param body The data to update the webhook with. * @param options The optional parameters including token and reason. * @returns A Promise that resolves when the webhook is edited. */ edit(webhookId: string, body: RESTPatchAPIWebhookWithTokenJSONBody | RESTPatchAPIWebhookJSONBody, options: WebhookShorterOptionalParams): Promise<WebhookStructure>; /** * Fetches a webhook. * @param webhookId The ID of the webhook. * @param token The token of the webhook (optional). * @returns A Promise that resolves to the fetched webhook. */ fetch(webhookId: string, token?: string): Promise<WebhookStructure>; /** * Writes a message using the webhook. * @param webhookId The ID of the webhook. * @param token The token of the webhook. * @param data The data for writing the message. * @returns A Promise that resolves to the written message. */ writeMessage(webhookId: string, token: string, { body: data, ...payload }: MessageWebhookMethodWriteParams): Promise<WebhookMessageStructure | null>; /** * Edits a message sent by the webhook. * @param webhookId The ID of the webhook. * @param token The token of the webhook. * @param messageId The ID of the message to edit. * @param data The data for editing the message. * @returns A Promise that resolves to the edited message. */ editMessage(webhookId: string, token: string, { messageId, body: data, ...json }: MessageWebhookMethodEditParams): Promise<WebhookMessageStructure>; /** * Deletes a message sent by the webhook. * @param webhookId The ID of the webhook. * @param token The token of the webhook. * @param messageId The ID of the message to delete. * @param reason The reason for deleting the message. * @returns A Promise that resolves when the message is deleted. */ deleteMessage(webhookId: string, token: string, messageId: string, reason?: string): Promise<never>; /** * Fetches a message sent by the webhook. * @param webhookId The ID of the webhook. * @param token The token of the webhook. * @param messageId The ID of the message to fetch. * @param threadId The ID of the thread the message belongs to. * @returns A Promise that resolves to the fetched message */ fetchMessage(webhookId: string, token: string, messageId: string, threadId?: string): Promise<WebhookMessageStructure>; listFromGuild(guildId: string): Promise<WebhookStructure[]>; listFromChannel(channelId: string): Promise<WebhookStructure[]>; } export type WebhookShorterOptionalParams = Partial<{ token: string; reason: string; }>;