@lilybird/transformers
Version:
Event transformers and more for lilybird
144 lines • 6.4 kB
TypeScript
import { GuildMember } from "./guild-member.js";
import { Message } from "./message.js";
import { User } from "./user.js";
import { ChannelType, VideoQualityMode } from "lilybird";
import type { Channel as LilyChannel, Message as LilyMessage, ForumLayoutType, SortOrderType, Client } from "lilybird";
export type PartialChannel<T extends Channel = Channel> = Partial<T> & {
[K in keyof Channel as Channel[K] extends (...args: Array<any>) => any ? K : never]: Channel[K];
};
export interface ResolvedChannel extends Channel {
permissions: string;
}
export declare function channelFactory(client: Client, channel: LilyChannel.Structure): Channel;
export declare function channelFactory(client: Client, channel: Partial<LilyChannel.Structure>): PartialChannel;
export declare function channelFactory(client: Client, channel: LilyChannel.Structure, resolved: true): ResolvedChannel;
export interface MessageSendOptions extends LilyMessage.CreateJSONParams {
tts?: boolean;
suppressEmbeds?: boolean;
suppressNotifications?: boolean;
}
export declare class Channel {
readonly id: string;
readonly type: ChannelType;
readonly lastPinTimestamp: string | null | undefined;
readonly flags: number;
readonly client: Client;
constructor(client: Client, channel: LilyChannel.Structure, resolved: boolean);
send(content: string, options?: MessageSendOptions): Promise<Message>;
send(options: MessageSendOptions): Promise<Message>;
isText(): this is GuildTextChannel;
isDM(): this is DMChannel;
isVoice(): this is GuildVoiceChannel;
isGroupDM(): this is GroupDMChannel;
isCategory(): this is GuildChannelCategory;
isAnnouncement(): this is GuildAnnouncementChannel;
isAnnouncementThread(): this is ThreadChannel;
isPublicThread(): this is ThreadChannel;
isPrivateThread(): this is ThreadChannel;
isStageVoice(): this is GuildChannel;
isDirectory(): this is GuildChannel;
isForum(): this is ThreadLikeChannel;
isMedia(): this is ThreadLikeChannel;
}
export declare class MentionChannel extends Channel {
readonly guildId: string;
readonly name: string;
constructor(client: Client, channel: LilyChannel.MentionStructure);
}
export declare class GuildChannel extends Channel {
readonly guildId: string;
readonly name: string;
readonly position: number;
readonly permissionOverwrites: Array<LilyChannel.OverwriteStructure>;
readonly nsfw: boolean;
readonly topic: string | null;
readonly lastMessageId: string | null;
readonly parentId: string | null;
readonly defaultAutoArchiveDuration: LilyChannel.AutoArchiveDuration;
constructor(client: Client, channel: LilyChannel.BaseGuildChannelStructure, resolved: boolean);
}
export declare class GuildTextChannel extends GuildChannel {
readonly rateLimitPerUser: number;
constructor(client: Client, channel: LilyChannel.GuildTextChannelStructure, resolved: boolean);
}
export declare class GuildAnnouncementChannel extends GuildChannel {
}
export declare class GuildVoiceChannel extends Channel {
readonly guildId: string;
readonly name: string;
readonly position: number;
readonly permissionOverwrites: Array<LilyChannel.OverwriteStructure>;
readonly lastMessageId: string | null;
readonly parentId: string | null;
readonly nsfw: boolean;
readonly rateLimitPerUser: number;
readonly rtcRegion: string | null;
readonly userLimit: number;
readonly bitrate: number;
readonly videoQualityMode: VideoQualityMode;
constructor(client: Client, channel: LilyChannel.GuildVoiceChannelStructure, resolved: boolean);
}
export declare class DMChannel extends Channel {
readonly lastMessageId: string | null;
readonly recipients: Array<User>;
constructor(client: Client, channel: LilyChannel.DMChannelStructure, resolved: boolean);
}
export declare class GroupDMChannel extends DMChannel {
readonly name: string;
readonly icon: string | null;
readonly ownerId: string;
readonly applicationId: string | undefined;
readonly managed: boolean | undefined;
constructor(client: Client, channel: LilyChannel.GroupDMChannelStructure, resolved: boolean);
isManaged(): this is GroupDMChannel & {
readonly applicationId: string;
readonly managed: true;
};
}
export declare class GuildChannelCategory extends Channel {
readonly permissionOverwrites: Array<LilyChannel.OverwriteStructure>;
readonly name: string;
readonly nsfw: boolean;
readonly position: number;
readonly guildId: string;
readonly rateLimitPerUser: number;
constructor(client: Client, channel: LilyChannel.CategoryStructure, resolved: boolean);
}
export interface ExtendedThreadChannel extends ThreadChannel {
readonly newlyCreated: boolean;
}
export declare class ThreadChannel extends Channel {
readonly guildId: string;
readonly parentId: string | null;
readonly ownerId: string;
readonly name: string;
readonly lastMessageId: string | null;
readonly messageCount: number;
readonly memberCount: number;
readonly threadMetadata: LilyChannel.ThreadMetadataStructure;
readonly totalMessageSent: number;
readonly member: ThreadMember | undefined;
readonly defaultThreadRateLimitPerUser: number;
constructor(client: Client, channel: LilyChannel.ThreadChannelStructure, resolved: boolean);
hasMember(): this is ThreadChannel & {
member: ThreadMember;
};
}
export declare class ThreadMember {
readonly id: string | undefined;
readonly userId: string | undefined;
readonly joinTimestamp: Date;
readonly flags: number;
readonly member: GuildMember | undefined;
constructor(client: Client, member: LilyChannel.ThreadMemberStructure);
}
export declare class ThreadLikeChannel extends Channel {
readonly availableTags: Array<LilyChannel.ForumTagStructure> | undefined;
readonly appliedTags: Array<string> | undefined;
readonly defaultThreadRateLimitPerUser: number | undefined;
readonly defaultSortOrder: SortOrderType | null | undefined;
readonly defaultForumLayout: ForumLayoutType | undefined;
readonly defaultReactionEmoji: LilyChannel.DefaultReactionStructure | null | undefined;
constructor(client: Client, channel: LilyChannel.ThreadLikeChannelStructure, resolved: boolean);
}
//# sourceMappingURL=channel.d.ts.map