UNPKG

@confis/discordapiwrapper

Version:

A fast and lightweight discord api wrapper.

71 lines (70 loc) 2.09 kB
import { ChannelTypes, OverwriteObjectTypes, Client, BaseData, ContentOptions, Guild, APIWebhookObject } from "../index"; import { Message } from "./Message"; import { Base } from "../internal/Base"; /** Channel object */ export declare class Channel extends Base { #private; readonly id: string; readonly type: ChannelTypes; position?: number; name?: string; permissions?: { id: string; type: OverwriteObjectTypes; allow: string; deny: string; }[]; topic?: string | null; parent?: string | null; constructor(data: BaseData, client: Client); /** * Get the guild of this channel * @returns A guild object */ get guild(): Guild | undefined; /** * Send a typing indicator to the channel */ sendTyping(): Promise<void>; /** * Send a message to the channel * @param content The content of the message * @returns A message object */ send(content: string | ContentOptions): Promise<Message>; /** * Get all webhooks in the channel * @returns An array of webhook objects */ getWebhooks(): Promise<APIWebhookObject[]>; /** * Get a message from the channel by its ID. * * @param id ID of the message to get. * @returns A message object. */ getMessage(id: string): Promise<Message>; /** * Fetches messages from the channel * * @param limit - The number of messages to fetch (minimum: 1, default: 50, max: 100) * @returns A Promise that resolves to an array of Message objects * @throws {AssertionError} If limit is greater than 100 or less than 1 * * @example * ```typescript * // Get the last 50 messages * const messages = await channel.getMessages(); * * // Get the last 10 messages * const messages = await channel.getMessages(10); * ``` */ getMessages(limit?: number): Promise<Message[]>; /** * Update the channel * * @param data The new data of the channel */ _patch(data: Channel): void; }