UNPKG

dressed

Version:

A sleek, serverless-ready Discord bot framework.

74 lines (73 loc) 4.25 kB
import type { RESTGetAPIChannelWebhooksResult, RESTGetAPIGuildWebhooksResult, RESTGetAPIWebhookResult, RESTGetAPIWebhookWithTokenMessageQuery, RESTGetAPIWebhookWithTokenMessageResult, RESTGetAPIWebhookWithTokenResult, RESTPatchAPIWebhookJSONBody, RESTPatchAPIWebhookResult, RESTPatchAPIWebhookWithTokenJSONBody, RESTPatchAPIWebhookWithTokenMessageJSONBody, RESTPatchAPIWebhookWithTokenMessageQuery, RESTPatchAPIWebhookWithTokenMessageResult, RESTPatchAPIWebhookWithTokenResult, RESTPostAPIChannelWebhookJSONBody, RESTPostAPIChannelWebhookResult, RESTPostAPIWebhookWithTokenJSONBody, RESTPostAPIWebhookWithTokenQuery, RESTPostAPIWebhookWithTokenWaitResult, Snowflake } from "discord-api-types/v10"; import type { RawFile } from "../types/file.ts"; /** * Creates a new webhook. * @param channel The channel to create the webhooks on * @param data The data for the new webhook */ export declare function createWebhook(channel: Snowflake, data: RESTPostAPIChannelWebhookJSONBody): Promise<RESTPostAPIChannelWebhookResult>; /** * Returns a list of channel webhook objects. * @param channel The channel to get the webhooks from */ export declare function listChannelWebhooks(channel: Snowflake): Promise<RESTGetAPIChannelWebhooksResult>; /** * Returns a list of guild webhook objects. * @param guild The guild to get the webhooks from */ export declare function listGuildWebhooks(guild: Snowflake): Promise<RESTGetAPIGuildWebhooksResult>; /** * Returns the new webhook object for the given id. * @param webhook The webhook to get * @param token The webhook token */ export declare function getWebhook<T extends string | undefined = undefined>(webhook: Snowflake, token?: T): Promise<T extends string ? RESTGetAPIWebhookWithTokenResult : RESTGetAPIWebhookResult>; /** * Modify a webhook. * @param webhook The webhook to modify * @param data The new data for the webhook * @param token The webhook token */ export declare function modifyWebhook<T extends string | undefined = undefined>(webhook: Snowflake, data: T extends string ? RESTPatchAPIWebhookWithTokenJSONBody : RESTPatchAPIWebhookJSONBody, token?: T): Promise<T extends string ? RESTPatchAPIWebhookWithTokenResult : RESTPatchAPIWebhookResult>; /** * Delete a webhook permanently. * @param webhook The webhook to delete * @param token The webhook token */ export declare function deleteWebhook(webhook: Snowflake, token?: string): Promise<void>; /** * Execute a webhook. * @param webhook The webhook to use * @param token The webhook token * @param data The message data * @param options Optional parameters for the request */ export declare function executeWebhook<T extends RESTPostAPIWebhookWithTokenQuery>(webhook: Snowflake, token: string, data: string | (RESTPostAPIWebhookWithTokenJSONBody & { files?: RawFile[]; }), options?: T): Promise<T["wait"] extends true ? RESTPostAPIWebhookWithTokenWaitResult : void>; /** * Returns a previously-sent webhook message from the same token. * @param webhook The webhook to use * @param token The webhook token * @param message The message to get * @param options Optional parameters for the request */ export declare function getWebhookMessage(webhook: Snowflake, token: string, message: Snowflake, options?: RESTGetAPIWebhookWithTokenMessageQuery): Promise<RESTGetAPIWebhookWithTokenMessageResult>; /** * Edits a previously-sent webhook message from the same token. * @param webhook The webhook to use * @param token The webhook token * @param message The message to edit * @param data The new message data * @param options Optional parameters for the request */ export declare function editWebhookMessage(webhook: Snowflake, token: string, message: Snowflake, data: string | (RESTPatchAPIWebhookWithTokenMessageJSONBody & { files?: RawFile[]; }), options?: RESTPatchAPIWebhookWithTokenMessageQuery): Promise<RESTPatchAPIWebhookWithTokenMessageResult>; /** * Deletes a message that was created by the webhook. * @param webhook The webhook to use * @param token The webhook token * @param message The message to delete */ export declare function deleteWebhookMessage(webhook: Snowflake, token: string, message: Snowflake, options?: Pick<RESTPostAPIWebhookWithTokenQuery, "thread_id">): Promise<void>;