seyfert
Version:
The most advanced framework for discord bots
83 lines (82 loc) • 4.4 kB
TypeScript
import { type WebhookMessageStructure, type WebhookStructure } from '../../client/transformers';
import { type MessageWebhookMethodEditParams, type MessageWebhookMethodWriteParams } from '../../structures';
import type { RESTPatchAPIWebhookJSONBody, RESTPatchAPIWebhookWithTokenJSONBody, RESTPostAPIChannelWebhookJSONBody, RESTPostAPIWebhookWithTokenQuery } from '../../types';
import type { MakeRequired, OmitInsert } from '../types/util';
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<undefined>;
/**
* 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(payload: WebhookShorterMessageDeleteParams): Promise<undefined>;
/**
* 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(payload: WebhookShorterMessageFetchParams): Promise<WebhookMessageStructure>;
listFromGuild(guildId: string): Promise<WebhookStructure[]>;
listFromChannel(channelId: string): Promise<WebhookStructure[]>;
}
export type WebhookShorterOptionalParams = Partial<{
token: string;
reason: string;
}>;
export interface WebhookShorterMessageParameters {
webhookId: string;
token: string;
messageId?: string;
reason?: string;
}
export type WebhookShorterMessageParams<Query extends keyof RESTPostAPIWebhookWithTokenQuery = never, R extends keyof WebhookShorterMessageParameters = never> = OmitInsert<WebhookShorterMessageParameters, R, MakeRequired<WebhookShorterMessageParameters, R> & (Query extends never ? {} : {
query?: Pick<RESTPostAPIWebhookWithTokenQuery, Query>;
})>;
export type WebhookShorterMessageDeleteParams = WebhookShorterMessageParams<'thread_id', 'messageId'>;
export type WebhookShorterMessageFetchParams = Omit<WebhookShorterMessageParams<'thread_id', 'messageId'>, 'reason'>;