@confis/discordapiwrapper
Version:
A fast and lightweight discord api wrapper.
67 lines (66 loc) • 3.03 kB
TypeScript
import { Client, ContentOptions, JSONCache, Message, WebhookContentOptions } from "../index";
/**
* The REST API client for interacting with Discord's API.
*/
export declare class Rest {
#private;
constructor(client: Client);
private processQueue;
private executeRequest;
private readonly axiosInstance;
/**
* Deletes a resource from the Discord API.
*
* @param route - The route to delete.
* @returns The deleted resource.
*/
delete<T>(route: string): Promise<T>;
/**
* Sends a POST request to the Discord API.
*
* @param route - The route to send the request to.
* @param data - The data to send with the request.
* @param formData - Whether the data is in FormData format.
* @returns The response data.
*/
post<T>(route: string, data: JSONCache | FormData, formData?: boolean): Promise<T>;
/**
* Sends a GET request to the Discord API.
*
* @param route - The route to send the request to.
* @returns The response data.
*/
get<T>(route: string): Promise<T>;
/**
* Sends a PATCH request to the Discord API.
*
* @param route - The route to send the request to.
* @param payload - The data to send with the request.
* @param formData - Whether the data is in FormData format.
* @returns The response data.
*/
patch<T>(route: string, payload: JSONCache | FormData, formData?: boolean): Promise<T>;
/**
* Sends a PUT request to the Discord API.
*
* @param route - The route to send the request to.
* @param payload - The data to send with the request.
* @param formData - Whether the data is in FormData format.
* @returns The response data.
*/
put<T>(route: string, payload: JSONCache | FormData, formData?: boolean): Promise<T>;
private contentToFilesEmbedsComponents;
private getAllowedMentions;
sendChannelMessage(content: string | ContentOptions, channelID: string): Promise<Message>;
sendReplyChannelMessage(content: string | ContentOptions, channelID: string, referenced_message_id: string, referenced_message_guildID: string): Promise<Message>;
respondToInteraction(type: number, content: string | ContentOptions, token: string, id: string): Promise<Message>;
deferInteraction(id: string, token: string, options?: {
ephemeral?: boolean;
}): Promise<void>;
editInteractionMessage(token: string, content: string | ContentOptions): Promise<Message>;
followUpInteraction(token: string, content: string | ContentOptions): Promise<Message>;
updateInteraction(token: string, id: string, content: string | ContentOptions): Promise<void>;
editMessage(messageID: string, channelID: string, content: string | ContentOptions): Promise<Message>;
sendWebhookMessage(content: string | WebhookContentOptions, webhookID: string, webhookToken: string): Promise<Message>;
updateStringSelectMenuEmbed(content: string | ContentOptions, token: string): Promise<Message>;
}