UNPKG

seyfert

Version:

The most advanced framework for discord bots

119 lines (118 loc) 5.63 kB
import { type MessageStructure, type ThreadChannelStructure } from '../../client/transformers'; import { type AllChannels, type GuildMember, type GuildRole } from '../../structures'; import { PermissionsBitField } from '../../structures/extra/Permissions'; import type { APIChannel, RESTGetAPIChannelMessagesQuery, RESTGetAPIChannelPinsQuery, RESTPatchAPIChannelJSONBody, RESTPutAPIChannelPermissionJSONBody } from '../../types'; import type { OmitInsert, PermissionStrings } from '../types/util'; import type { ThreadCreateBodyRequest } from '../types/write'; import { BaseShorter } from './base'; export declare class ChannelShorter extends BaseShorter { /** * Fetches a channel by its ID. * @param id The ID of the channel to fetch. * @param force Whether to force fetching the channel from the API even if it exists in the cache. * @returns A Promise that resolves to the fetched channel. */ fetch(id: string, force?: boolean): Promise<AllChannels>; raw(id: string, force?: boolean): Promise<APIChannel>; /** * Deletes a channel by its ID. * @param id The ID of the channel to delete. * @param optional Optional parameters for the deletion. * @returns A Promise that resolves to the deleted channel. */ delete(id: string, optional?: ChannelShorterOptionalParams): Promise<AllChannels>; /** * Edits a channel by its ID. * @param id The ID of the channel to edit. * @param body The updated channel data. * @param optional Optional parameters for the editing. * @returns A Promise that resolves to the edited channel. */ edit(id: string, body: RESTPatchAPIChannelJSONBody, optional?: ChannelShorterOptionalParams): Promise<AllChannels>; /** * Edits or creates a permission overwrite for a channel. * @param channelId The ID of the channel. * @param overwriteId The ID of the role or member overwrite. * @param body The overwrite payload. * @param optional Optional parameters including guild id and reason. */ editOverwrite(channelId: string, overwriteId: string, raw: ChannelShorterOverwriteBody, optional?: ChannelShorterOptionalParams): Promise<void>; /** * Deletes a permission overwrite from a channel. * @param channelId The ID of the channel. * @param overwriteId The ID of the role or member overwrite. * @param optional Optional parameters including guild id and reason. */ deleteOverwrite(channelId: string, overwriteId: string, optional?: ChannelShorterOptionalParams): Promise<void>; /** * Sends a typing indicator to the channel. * @param id The ID of the channel. * @returns A Promise that resolves when the typing indicator is successfully sent. */ typing(id: string): Promise<void>; pins(channelId: string, query?: RESTGetAPIChannelPinsQuery): Promise<{ hasMore: boolean; items: { pinnedAt: string; message: MessageStructure; }[]; }>; /** * Pins a message in the channel. * @param messageId The ID of the message to pin. * @param channelId The ID of the channel. * @param reason The reason for pinning the message. * @returns A Promise that resolves when the message is successfully pinned. */ setPin(messageId: string, channelId: string, reason?: string): Promise<undefined>; /** * Unpins a message in the channel. * @param messageId The ID of the message to unpin. * @param channelId The ID of the channel. * @param reason The reason for unpinning the message. * @returns A Promise that resolves when the message is successfully unpinned. */ deletePin(messageId: string, channelId: string, reason?: string): Promise<undefined>; /** * Creates a new thread in the channel (only guild based channels). * @param channelId The ID of the parent channel. * @param reason The reason for unpinning the message. * @returns A promise that resolves when the thread is succesfully created. */ thread(channelId: string, body: ThreadCreateBodyRequest, reason?: string): Promise<ThreadChannelStructure>; memberPermissions(channelId: string, member: GuildMember, checkAdmin?: boolean): Promise<PermissionsBitField>; overwritesFor(channelId: string, member: GuildMember): Promise<{ everyone: { type: import("../../types").OverwriteType; id: string; deny: PermissionsBitField; allow: PermissionsBitField; guildId: string; } | undefined; roles: { type: import("../../types").OverwriteType; id: string; deny: PermissionsBitField; allow: PermissionsBitField; guildId: string; }[]; member: { type: import("../../types").OverwriteType; id: string; deny: PermissionsBitField; allow: PermissionsBitField; guildId: string; } | undefined; }>; rolePermissions(channelId: string, role: GuildRole, checkAdmin?: boolean): Promise<PermissionsBitField>; fetchMessages(channelId: string, query?: RESTGetAPIChannelMessagesQuery): Promise<MessageStructure[]>; setVoiceStatus(channelId: string, status?: string | null): Promise<undefined>; } export type ChannelShorterOptionalParams = Partial<{ guildId: (string & {}) | '@me'; reason: string; }>; export type ChannelShorterOverwriteBody = OmitInsert<RESTPutAPIChannelPermissionJSONBody, 'allow' | 'deny', { allow?: PermissionStrings; deny?: PermissionStrings; }>;