feat: Guild Forum channel
https://github.com/discordjs/discord.js/pull/8651
This commit is contained in:
165
typings/index.d.ts
vendored
165
typings/index.d.ts
vendored
@@ -53,6 +53,7 @@ import {
|
||||
RESTPostAPIApplicationCommandsJSONBody,
|
||||
Snowflake,
|
||||
LocalizationMap,
|
||||
SortOrderType,
|
||||
} from 'discord-api-types/v9';
|
||||
import { ChildProcess } from 'node:child_process';
|
||||
import { EventEmitter } from 'node:events';
|
||||
@@ -674,7 +675,7 @@ export class BaseGuildTextChannel extends TextBasedChannelMixin(GuildChannel) {
|
||||
public defaultAutoArchiveDuration?: ThreadAutoArchiveDuration;
|
||||
public rateLimitPerUser: number | null;
|
||||
public nsfw: boolean;
|
||||
public threads: ThreadManager<AllowedThreadTypeForTextChannel | AllowedThreadTypeForNewsChannel>;
|
||||
public threads: GuildTextThreadManager<AllowedThreadTypeForTextChannel | AllowedThreadTypeForNewsChannel>;
|
||||
public topic: string | null;
|
||||
public createInvite(options?: CreateInviteOptions): Promise<Invite>;
|
||||
public fetchInvites(cache?: boolean): Promise<Collection<string, Invite>>;
|
||||
@@ -757,7 +758,7 @@ export type MappedChannelCategoryTypes = EnumValueMapped<
|
||||
GUILD_TEXT: TextChannel;
|
||||
GUILD_STORE: StoreChannel;
|
||||
GUILD_STAGE_VOICE: StageChannel;
|
||||
GUILD_FORUM: undefined;
|
||||
GUILD_FORUM: ForumChannel;
|
||||
}
|
||||
>;
|
||||
|
||||
@@ -801,6 +802,7 @@ export abstract class Channel extends Base {
|
||||
public id: Snowflake;
|
||||
public readonly partial: false;
|
||||
public type: keyof typeof ChannelTypes;
|
||||
public flags: Readonly<ChannelFlags> | null;
|
||||
public delete(): Promise<this>;
|
||||
public fetch(force?: boolean): Promise<this>;
|
||||
public isText(): this is TextBasedChannel;
|
||||
@@ -1193,6 +1195,7 @@ export class DMChannel extends TextBasedChannelMixin(Channel, [
|
||||
private constructor(client: Client, data?: RawDMChannelData);
|
||||
public recipient: User;
|
||||
public type: 'DM';
|
||||
public flags: Readonly<ChannelFlags>;
|
||||
public fetch(force?: boolean): Promise<this>;
|
||||
public readonly voiceAdapterCreator: InternalDiscordGatewayAdapterCreator;
|
||||
public call(options?: object): Promise<VoiceConnection>;
|
||||
@@ -1272,7 +1275,7 @@ export class Guild extends AnonymousGuild {
|
||||
public vanityURLUses: number | null;
|
||||
public readonly voiceAdapterCreator: InternalDiscordGatewayAdapterCreator;
|
||||
public readonly voiceStates: VoiceStateManager;
|
||||
public readonly widgetChannel: TextChannel | null;
|
||||
public readonly widgetChannel: TextChannel | NewsChannel | VoiceBasedChannel | ForumChannel | null;
|
||||
public widgetChannelId: Snowflake | null;
|
||||
public widgetEnabled: boolean | null;
|
||||
public readonly maximumBitrate: number;
|
||||
@@ -1416,6 +1419,7 @@ export abstract class GuildChannel extends Channel {
|
||||
public readonly position: number;
|
||||
public rawPosition: number;
|
||||
public type: Exclude<keyof typeof ChannelTypes, 'DM' | 'GROUP_DM' | 'UNKNOWN'>;
|
||||
public flags: Readonly<ChannelFlags>;
|
||||
public readonly viewable: boolean;
|
||||
public clone(options?: GuildChannelCloneOptions): Promise<this>;
|
||||
public delete(reason?: string): Promise<this>;
|
||||
@@ -1900,6 +1904,7 @@ export class Message<Cached extends boolean = boolean> extends Base {
|
||||
public webhookId: Snowflake | null;
|
||||
public flags: Readonly<MessageFlags>;
|
||||
public reference: MessageReference | null;
|
||||
public position: number | null;
|
||||
public awaitMessageComponent<T extends MessageComponentTypeResolvable = 'ACTION_ROW'>(
|
||||
options?: AwaitMessageCollectorOptionsParams<T, Cached>,
|
||||
): Promise<MappedInteractionTypes<Cached>[T]>;
|
||||
@@ -2334,7 +2339,7 @@ export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extend
|
||||
}
|
||||
|
||||
export class NewsChannel extends BaseGuildTextChannel {
|
||||
public threads: ThreadManager<AllowedThreadTypeForNewsChannel>;
|
||||
public threads: GuildTextThreadManager<AllowedThreadTypeForNewsChannel>;
|
||||
public type: 'GUILD_NEWS';
|
||||
public addFollower(channel: TextChannelResolvable, reason?: string): Promise<NewsChannel>;
|
||||
}
|
||||
@@ -2362,6 +2367,7 @@ export class PartialGroupDMChannel extends TextBasedChannelMixin(Channel, [
|
||||
public lastPinTimestamp: number | null;
|
||||
public owner: User | null;
|
||||
public ownerId: Snowflake | null;
|
||||
public flags: null;
|
||||
public iconURL(options?: StaticImageURLOptions): string | null;
|
||||
public addMember(user: User): Promise<PartialGroupDMChannel>;
|
||||
public removeMember(user: User): Promise<PartialGroupDMChannel>;
|
||||
@@ -2661,7 +2667,9 @@ export class StageChannel extends BaseGuildVoiceChannel {
|
||||
public setTopic(topic: string): Promise<StageChannel>;
|
||||
}
|
||||
|
||||
export class DirectoryChannel extends Channel {}
|
||||
export class DirectoryChannel extends Channel {
|
||||
public flags: Readonly<ChannelFlags>;
|
||||
}
|
||||
|
||||
export class StageInstance extends Base {
|
||||
private constructor(client: Client, data: RawStageInstanceData, channel: StageChannel);
|
||||
@@ -2835,7 +2843,7 @@ export class TeamMember extends Base {
|
||||
|
||||
export class TextChannel extends BaseGuildTextChannel {
|
||||
public rateLimitPerUser: number;
|
||||
public threads: ThreadManager<AllowedThreadTypeForTextChannel>;
|
||||
public threads: GuildTextThreadManager<AllowedThreadTypeForTextChannel>;
|
||||
public type: 'GUILD_TEXT';
|
||||
}
|
||||
|
||||
@@ -2886,10 +2894,13 @@ export class ThreadChannel extends TextBasedChannelMixin(Channel, ['fetchWebhook
|
||||
public members: ThreadMemberManager;
|
||||
public name: string;
|
||||
public ownerId: Snowflake | null;
|
||||
public readonly parent: TextChannel | NewsChannel | null;
|
||||
public readonly parent: TextChannel | NewsChannel | ForumChannel | null;
|
||||
public parentId: Snowflake | null;
|
||||
public rateLimitPerUser: number | null;
|
||||
public type: ThreadChannelTypes;
|
||||
public flags: Readonly<ChannelFlags>;
|
||||
public appliedTags: Snowflake[];
|
||||
public totalMessageSent: number | null;
|
||||
public readonly unarchivable: boolean;
|
||||
public isPrivate(): this is this & {
|
||||
readonly createdTimestamp: number;
|
||||
@@ -2915,6 +2926,7 @@ export class ThreadChannel extends TextBasedChannelMixin(Channel, ['fetchWebhook
|
||||
public setInvitable(invitable?: boolean, reason?: string): Promise<ThreadChannel>;
|
||||
public setLocked(locked?: boolean, reason?: string): Promise<ThreadChannel>;
|
||||
public setName(name: string, reason?: string): Promise<ThreadChannel>;
|
||||
public setAppliedTags(appliedTags: Snowflake[], reason?: string): Promise<ThreadChannel>;
|
||||
}
|
||||
|
||||
export class ThreadMember extends Base {
|
||||
@@ -3296,7 +3308,7 @@ export class WelcomeChannel extends Base {
|
||||
public channelId: Snowflake;
|
||||
public guild: Guild | InviteGuild;
|
||||
public description: string;
|
||||
public readonly channel: TextChannel | NewsChannel | StoreChannel | null;
|
||||
public readonly channel: TextChannel | NewsChannel | StoreChannel | ForumChannel | null;
|
||||
public readonly emoji: GuildEmoji | Emoji;
|
||||
}
|
||||
|
||||
@@ -3979,10 +3991,9 @@ export class StageInstanceManager extends CachedManager<Snowflake, StageInstance
|
||||
public delete(channel: StageChannelResolvable): Promise<void>;
|
||||
}
|
||||
|
||||
export class ThreadManager<AllowedThreadType> extends CachedManager<Snowflake, ThreadChannel, ThreadChannelResolvable> {
|
||||
private constructor(channel: TextChannel | NewsChannel, iterable?: Iterable<RawThreadChannelData>);
|
||||
export class ThreadManager extends CachedManager<Snowflake, ThreadChannel, ThreadChannelResolvable> {
|
||||
protected constructor(channel: TextChannel | NewsChannel, iterable?: Iterable<RawThreadChannelData>);
|
||||
public channel: TextChannel | NewsChannel;
|
||||
public create(options: ThreadCreateOptions<AllowedThreadType>): Promise<ThreadChannel>;
|
||||
public fetch(options: ThreadChannelResolvable, cacheOptions?: BaseFetchOptions): Promise<ThreadChannel | null>;
|
||||
public fetch(options?: FetchThreadsOptions, cacheOptions?: { cache?: boolean }): Promise<FetchedThreads>;
|
||||
public fetchArchived(options?: FetchArchivedThreadOptions, cache?: boolean): Promise<FetchedThreads>;
|
||||
@@ -4413,7 +4424,7 @@ export interface ClientEvents extends BaseClientEvents {
|
||||
userUpdate: [oldUser: User | PartialUser, newUser: User];
|
||||
userSettingsUpdate: [setting: RawUserSettingsData];
|
||||
voiceStateUpdate: [oldState: VoiceState, newState: VoiceState];
|
||||
webhookUpdate: [channel: TextChannel | NewsChannel | VoiceChannel];
|
||||
webhookUpdate: [channel: TextChannel | NewsChannel | VoiceChannel | ForumChannel];
|
||||
/** @deprecated Use interactionCreate instead */
|
||||
interaction: [interaction: Interaction];
|
||||
interactionCreate: [interaction: Interaction | { nonce: Snowflake; id: Snowflake }];
|
||||
@@ -4969,6 +4980,10 @@ export interface CategoryCreateChannelOptions {
|
||||
rateLimitPerUser?: number;
|
||||
position?: number;
|
||||
rtcRegion?: string;
|
||||
videoQualityMode?: VideoQualityMode;
|
||||
availableTags?: GuildForumTagData[];
|
||||
defaultReactionEmoji?: DefaultReactionEmoji;
|
||||
defaultSortOrder?: SortOrderType;
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
@@ -4993,6 +5008,11 @@ export interface ChannelData {
|
||||
defaultAutoArchiveDuration?: ThreadAutoArchiveDuration | 'MAX';
|
||||
rtcRegion?: string | null;
|
||||
videoQualityMode?: VideoQualityMode | null;
|
||||
availableTags?: GuildForumTagData[];
|
||||
defaultReactionEmoji?: DefaultReactionEmoji;
|
||||
defaultThreadRateLimitPerUser?: number;
|
||||
defaultSortOrder?: SortOrderType | null;
|
||||
flags?: ChannelFlagsResolvable;
|
||||
}
|
||||
|
||||
export interface ChannelLogsQueryOptions {
|
||||
@@ -6015,11 +6035,32 @@ export type MessageComponentTypeResolvable = MessageComponentType | MessageCompo
|
||||
export interface MessageEditOptions {
|
||||
attachments?: MessageAttachment[];
|
||||
content?: string | null;
|
||||
embeds?: (MessageEmbed | MessageEmbedOptions | APIEmbed)[] | null;
|
||||
files?: (FileOptions | BufferResolvable | Stream | MessageAttachment)[];
|
||||
flags?: BitFieldResolvable<MessageFlagsString, number>;
|
||||
allowedMentions?: MessageMentionOptions;
|
||||
components?: (MessageActionRow | (Required<BaseMessageComponentOptions> & MessageActionRowOptions))[];
|
||||
id?: Snowflake | number;
|
||||
parentId?: Snowflake | number;
|
||||
type?: ExcludeEnum<
|
||||
typeof ChannelTypes,
|
||||
| 'DM'
|
||||
| 'GROUP_DM'
|
||||
| 'GUILD_NEWS'
|
||||
| 'GUILD_STORE'
|
||||
| 'UNKNOWN'
|
||||
| 'GUILD_NEWS_THREAD'
|
||||
| 'GUILD_PUBLIC_THREAD'
|
||||
| 'GUILD_PRIVATE_THREAD'
|
||||
| 'GUILD_STAGE_VOICE'
|
||||
>;
|
||||
name: string;
|
||||
topic?: string;
|
||||
nsfw?: boolean;
|
||||
bitrate?: number;
|
||||
userLimit?: number;
|
||||
rtcRegion?: string | null;
|
||||
videoQualityMode?: VideoQualityMode;
|
||||
permissionOverwrites?: PartialOverwriteData[];
|
||||
rateLimitPerUser?: number;
|
||||
availableTags?: GuildForumTagData[];
|
||||
defaultReactionEmoji?: DefaultReactionEmoji;
|
||||
defaultThreadRateLimitPerUser?: number;
|
||||
}
|
||||
|
||||
export interface MessageEmbedAuthor {
|
||||
@@ -6572,9 +6613,10 @@ export type AnyChannel =
|
||||
| StoreChannel
|
||||
| TextChannel
|
||||
| ThreadChannel
|
||||
| VoiceChannel;
|
||||
| VoiceChannel
|
||||
| ForumChannel;
|
||||
|
||||
export type TextBasedChannel = Extract<AnyChannel, { messages: MessageManager }>;
|
||||
export type TextBasedChannel = Exclude<Extract<AnyChannel, { messages: MessageManager }>, ForumChannel>;
|
||||
|
||||
export type TextBasedChannelTypes = TextBasedChannel['type'];
|
||||
|
||||
@@ -6603,7 +6645,7 @@ export type GuildBasedChannel = Extract<AnyChannel, { guild: Guild }>;
|
||||
|
||||
export type NonThreadGuildBasedChannel = Exclude<GuildBasedChannel, ThreadChannel>;
|
||||
|
||||
export type GuildTextBasedChannel = Extract<GuildBasedChannel, TextBasedChannel>;
|
||||
export type GuildTextBasedChannel = Exclude<Extract<GuildBasedChannel, TextBasedChannel>, ForumChannel>;
|
||||
|
||||
export type TextChannelResolvable = Snowflake | TextChannel;
|
||||
|
||||
@@ -6615,7 +6657,7 @@ export type ThreadChannelResolvable = ThreadChannel | Snowflake;
|
||||
|
||||
export type ThreadChannelTypes = 'GUILD_NEWS_THREAD' | 'GUILD_PUBLIC_THREAD' | 'GUILD_PRIVATE_THREAD';
|
||||
|
||||
export interface ThreadCreateOptions<AllowedThreadType> extends StartThreadOptions {
|
||||
export interface GuildTextThreadCreateOptions<AllowedThreadType> extends StartThreadOptions {
|
||||
startMessage?: MessageResolvable;
|
||||
type?: AllowedThreadType;
|
||||
invitable?: AllowedThreadType extends 'GUILD_PRIVATE_THREAD' | 12 ? boolean : never;
|
||||
@@ -6629,6 +6671,7 @@ export interface ThreadEditData {
|
||||
rateLimitPerUser?: number;
|
||||
locked?: boolean;
|
||||
invitable?: boolean;
|
||||
threadName?: string;
|
||||
}
|
||||
|
||||
export type ThreadMemberFlagsString = '';
|
||||
@@ -6737,7 +6780,7 @@ export interface WidgetChannel {
|
||||
|
||||
export interface WelcomeChannelData {
|
||||
description: string;
|
||||
channel: TextChannel | NewsChannel | StoreChannel | Snowflake;
|
||||
channel: TextChannel | NewsChannel | StoreChannel | ForumChannel | Snowflake;
|
||||
emoji?: EmojiIdentifierResolvable;
|
||||
}
|
||||
|
||||
@@ -6840,4 +6883,82 @@ export type InternalDiscordGatewayAdapterCreator = (
|
||||
methods: InternalDiscordGatewayAdapterLibraryMethods,
|
||||
) => InternalDiscordGatewayAdapterImplementerMethods;
|
||||
|
||||
// GuildForum
|
||||
export type ChannelFlagsString =
|
||||
| 'PINNED'
|
||||
| 'REQUIRE_TAG';
|
||||
export class ChannelFlags extends BitField<ChannelFlagsString> {
|
||||
public static FLAGS: Record<ChannelFlagsString, number>;
|
||||
public static resolve(bit?: BitFieldResolvable<ChannelFlagsString, number>): number;
|
||||
}
|
||||
|
||||
export interface GuildForumTagEmoji {
|
||||
id: Snowflake | null;
|
||||
name: string | null;
|
||||
}
|
||||
|
||||
export interface GuildForumTag {
|
||||
id: Snowflake;
|
||||
name: string;
|
||||
moderated: boolean;
|
||||
emoji: GuildForumTagEmoji | null;
|
||||
}
|
||||
|
||||
export type GuildForumTagData = Partial<GuildForumTag> & { name: string };
|
||||
|
||||
export interface DefaultReactionEmoji {
|
||||
id: Snowflake | null;
|
||||
name: string | null;
|
||||
}
|
||||
|
||||
export class ForumChannel extends TextBasedChannelMixin(GuildChannel, [
|
||||
'send',
|
||||
'lastMessage',
|
||||
'lastPinAt',
|
||||
'bulkDelete',
|
||||
'sendTyping',
|
||||
'createMessageCollector',
|
||||
'awaitMessages',
|
||||
'createMessageComponentCollector',
|
||||
'awaitMessageComponent',
|
||||
]) {
|
||||
public type: 'GUILD_FORUM';
|
||||
public threads: GuildForumThreadManager;
|
||||
public availableTags: GuildForumTag[];
|
||||
public defaultReactionEmoji: DefaultReactionEmoji | null;
|
||||
public defaultThreadRateLimitPerUser: number | null;
|
||||
public rateLimitPerUser: number | null;
|
||||
public defaultAutoArchiveDuration: ThreadAutoArchiveDuration | null;
|
||||
public nsfw: boolean;
|
||||
public topic: string | null;
|
||||
public setAvailableTags(tags: GuildForumTagData[], reason?: string): Promise<this>;
|
||||
public setDefaultReactionEmoji(emojiId: DefaultReactionEmoji | null, reason?: string): Promise<this>;
|
||||
public setDefaultThreadRateLimitPerUser(rateLimit: number, reason?: string): Promise<this>;
|
||||
public createInvite(options?: CreateInviteOptions): Promise<Invite>;
|
||||
public fetchInvites(cache?: boolean): Promise<Collection<string, Invite>>;
|
||||
public setDefaultAutoArchiveDuration(
|
||||
defaultAutoArchiveDuration: ThreadAutoArchiveDuration,
|
||||
reason?: string,
|
||||
): Promise<this>;
|
||||
public setTopic(topic: string | null, reason?: string): Promise<this>;
|
||||
public setDefaultSortOrder(defaultSortOrder: SortOrderType | null, reason?: string): Promise<this>;
|
||||
}
|
||||
|
||||
export class GuildTextThreadManager<AllowedThreadType> extends ThreadManager {
|
||||
public create(options: GuildTextThreadCreateOptions<AllowedThreadType>): Promise<ThreadChannel>;
|
||||
}
|
||||
|
||||
export class GuildForumThreadManager extends ThreadManager {
|
||||
public create(options: GuildForumThreadCreateOptions): Promise<ThreadChannel>;
|
||||
}
|
||||
|
||||
export type GuildForumThreadMessageCreateOptions = MessageOptions & Pick<MessageOptions, 'flags' | 'stickers'>;
|
||||
|
||||
export type ChannelFlagsResolvable = BitFieldResolvable<ChannelFlagsString, number>;
|
||||
|
||||
export interface GuildForumThreadCreateOptions extends StartThreadOptions {
|
||||
message: GuildForumThreadMessageCreateOptions | MessagePayload;
|
||||
appliedTags?: Snowflake[];
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
Reference in New Issue
Block a user