mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(docs): some link tags didn't resolve correctly (#10269)
* fix(docs): some link tags didn't resolve in summaries * fix: add TextBasedChannels type
This commit is contained in:
@@ -30,7 +30,7 @@ export async function DocNode({ node, version }: { readonly node?: any; readonly
|
||||
rel="external noreferrer noopener"
|
||||
target="_blank"
|
||||
>
|
||||
{node.text}
|
||||
{`${node.text}${node.members}`}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { type ApiItem, ApiItemKind } from '../items/ApiItem.js';
|
||||
import { ApiItemContainerMixin } from '../mixins/ApiItemContainerMixin.js';
|
||||
import { ApiParameterListMixin } from '../mixins/ApiParameterListMixin.js';
|
||||
import type { ApiEntryPoint } from './ApiEntryPoint.js';
|
||||
import type { ApiMethod } from './ApiMethod.js';
|
||||
import type { ApiModel } from './ApiModel.js';
|
||||
import type { ApiPackage } from './ApiPackage.js';
|
||||
|
||||
@@ -119,6 +120,10 @@ export class ModelReferenceResolver {
|
||||
foundMembers.filter((member) => member.kind === ApiItemKind.Interface).length === foundMembers.length - 1
|
||||
) {
|
||||
currentItem = foundClass;
|
||||
} else if (
|
||||
foundMembers.every((member) => member.kind === ApiItemKind.Method && (member as ApiMethod).overloadIndex)
|
||||
) {
|
||||
currentItem = foundMembers.find((member) => (member as ApiMethod).overloadIndex === 1)!;
|
||||
} else {
|
||||
result.errorMessage = `The member reference ${JSON.stringify(identifier)} was ambiguous`;
|
||||
return result;
|
||||
|
||||
@@ -97,7 +97,7 @@ class GuildManager extends CachedManager {
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves a GuildResolvable to a Guild object.
|
||||
* Resolves a {@link GuildResolvable} to a {@link Guild} object.
|
||||
* @method resolve
|
||||
* @memberof GuildManager
|
||||
* @instance
|
||||
|
||||
@@ -17,7 +17,7 @@ class GuildTextThreadManager extends ThreadManager {
|
||||
|
||||
/**
|
||||
* Options for creating a thread. <warn>Only one of `startMessage` or `type` can be defined.</warn>
|
||||
* @typedef {StartThreadOptions} ThreadCreateOptions
|
||||
* @typedef {StartThreadOptions} GuildTextThreadCreateOptions
|
||||
* @property {MessageResolvable} [startMessage] The message to start a thread from.
|
||||
* <warn>If this is defined, then the `type` of thread gets inferred automatically and cannot be changed.</warn>
|
||||
* @property {ThreadChannelTypes} [type] The type of thread to create.
|
||||
@@ -30,7 +30,7 @@ class GuildTextThreadManager extends ThreadManager {
|
||||
|
||||
/**
|
||||
* Creates a new thread in the channel.
|
||||
* @param {ThreadCreateOptions} [options] Options to create a new thread
|
||||
* @param {GuildTextThreadCreateOptions} [options] Options to create a new thread
|
||||
* @returns {Promise<ThreadChannel>}
|
||||
* @example
|
||||
* // Create a new public thread
|
||||
|
||||
@@ -63,20 +63,6 @@ class ThreadManager extends CachedManager {
|
||||
* @returns {?Snowflake}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Options for creating a thread. <warn>Only one of `startMessage` or `type` can be defined.</warn>
|
||||
* @typedef {StartThreadOptions} ThreadCreateOptions
|
||||
* @property {MessageResolvable} [startMessage] The message to start a thread from. <warn>If this is defined then type
|
||||
* of thread gets automatically defined and cannot be changed. The provided `type` field will be ignored</warn>
|
||||
* @property {ChannelType.AnnouncementThread|ChannelType.PublicThread|ChannelType.PrivateThread} [type]
|
||||
* The type of thread to create.
|
||||
* Defaults to {@link ChannelType.PublicThread} if created in a {@link TextChannel}
|
||||
* <warn>When creating threads in a {@link NewsChannel} this is ignored and is always
|
||||
* {@link ChannelType.AnnouncementThread}</warn>
|
||||
* @property {boolean} [invitable] Whether non-moderators can add other non-moderators to the thread
|
||||
* <info>Can only be set when type will be {@link ChannelType.PrivateThread}</info>
|
||||
*/
|
||||
|
||||
/**
|
||||
* Options for fetching multiple threads.
|
||||
* @typedef {Object} FetchThreadsOptions
|
||||
|
||||
@@ -23,7 +23,7 @@ class ShardingManager extends EventEmitter {
|
||||
/**
|
||||
* The mode to spawn shards with for a {@link ShardingManager}. Can be either one of:
|
||||
* * 'process' to use child processes
|
||||
* * 'worker' to use [Worker threads](https://nodejs.org/api/worker_threads.html)
|
||||
* * 'worker' to use {@link Worker} threads
|
||||
* @typedef {string} ShardingManagerMode
|
||||
*/
|
||||
|
||||
|
||||
@@ -164,7 +164,7 @@ class Guild extends AnonymousGuild {
|
||||
|
||||
if ('large' in data) {
|
||||
/**
|
||||
* Whether the guild is "large" (has more than {@link WebsocketOptions large_threshold} members, 50 by default)
|
||||
* Whether the guild is "large" (has more than {@link WebSocketOptions large_threshold} members, 50 by default)
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.large = Boolean(data.large);
|
||||
@@ -291,7 +291,8 @@ class Guild extends AnonymousGuild {
|
||||
if ('max_presences' in data) {
|
||||
/**
|
||||
* The maximum amount of presences the guild can have (this is `null` for all but the largest of guilds)
|
||||
* <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info>
|
||||
* <info>You will need to fetch the guild using {@link BaseGuild#fetch} if you want to receive
|
||||
* this parameter</info>
|
||||
* @type {?number}
|
||||
*/
|
||||
this.maximumPresences = data.max_presences;
|
||||
@@ -322,7 +323,8 @@ class Guild extends AnonymousGuild {
|
||||
if ('approximate_member_count' in data) {
|
||||
/**
|
||||
* The approximate amount of members the guild has
|
||||
* <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info>
|
||||
* <info>You will need to fetch the guild using {@link BaseGuild#fetch} if you want to receive
|
||||
* this parameter</info>
|
||||
* @type {?number}
|
||||
*/
|
||||
this.approximateMemberCount = data.approximate_member_count;
|
||||
@@ -333,7 +335,8 @@ class Guild extends AnonymousGuild {
|
||||
if ('approximate_presence_count' in data) {
|
||||
/**
|
||||
* The approximate amount of presences the guild has
|
||||
* <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info>
|
||||
* <info>You will need to fetch the guild using {@link BaseGuild#fetch} if you want to receive
|
||||
* this parameter</info>
|
||||
* @type {?number}
|
||||
*/
|
||||
this.approximatePresenceCount = data.approximate_presence_count;
|
||||
|
||||
@@ -229,7 +229,7 @@ class GuildScheduledEvent extends Base {
|
||||
|
||||
/**
|
||||
* The time the guild scheduled event will start at
|
||||
* <info>This can be potentially `null` only when it's an {@link AuditLogEntryTarget}</info>
|
||||
* <info>This can be potentially `null` only when it's an {@link GuildAuditLogsEntry#target}</info>
|
||||
* @type {?Date}
|
||||
* @readonly
|
||||
*/
|
||||
|
||||
@@ -148,7 +148,7 @@ class PermissionOverwrites extends Base {
|
||||
*/
|
||||
|
||||
/**
|
||||
* Data that can be resolved into {@link RawOverwriteData}. This can be:
|
||||
* Data that can be resolved into {@link APIOverwrite}. This can be:
|
||||
* * PermissionOverwrites
|
||||
* * OverwriteData
|
||||
* @typedef {PermissionOverwrites|OverwriteData} OverwriteResolvable
|
||||
@@ -164,7 +164,7 @@ class PermissionOverwrites extends Base {
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves an overwrite into {@link RawOverwriteData}.
|
||||
* Resolves an overwrite into {@link APIOverwrite}.
|
||||
* @param {OverwriteResolvable} overwrite The overwrite-like data to resolve
|
||||
* @param {Guild} [guild] The guild to resolve from
|
||||
* @returns {RawOverwriteData}
|
||||
|
||||
@@ -81,7 +81,7 @@ class ReactionCollector extends Collector {
|
||||
this.on('collect', (reaction, user) => {
|
||||
/**
|
||||
* Emitted whenever a reaction is newly created on a message. Will emit only when a new reaction is
|
||||
* added to the message, as opposed to {@link Collector#collect} which will
|
||||
* added to the message, as opposed to {@link Collector#event:collect} which will
|
||||
* be emitted even when a reaction has already been added to the message.
|
||||
* @event ReactionCollector#create
|
||||
* @param {MessageReaction} reaction The reaction that was added
|
||||
|
||||
@@ -315,7 +315,7 @@ class ThreadChannel extends BaseChannel {
|
||||
* Fetches the message that started this thread, if any.
|
||||
* <info>The `Promise` will reject if the original message in a forum post is deleted
|
||||
* or when the original message in the parent channel is deleted.
|
||||
* If you just need the id of that message, use {@link ThreadChannel#id} instead.</info>
|
||||
* If you just need the id of that message, use {@link BaseChannel#id} instead.</info>
|
||||
* @param {BaseFetchOptions} [options] Additional options for this fetch
|
||||
* @returns {Promise<?Message<true>>}
|
||||
*/
|
||||
|
||||
@@ -160,6 +160,11 @@
|
||||
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIModalSubmission}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @external APIOverwrite
|
||||
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIOverwrite}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @external APIPartialEmoji
|
||||
* @see {@link https://discord-api-types.dev/api/discord-api-types-v10/interface/APIPartialEmoji}
|
||||
|
||||
@@ -95,15 +95,15 @@ exports.GuildTextBasedChannelTypes = [
|
||||
|
||||
/**
|
||||
* The channels that are text-based.
|
||||
* * DMChannel
|
||||
* * GuildTextBasedChannel
|
||||
* * {@link DMChannel}
|
||||
* * {@link GuildTextBasedChannel}
|
||||
* @typedef {DMChannel|GuildTextBasedChannel} TextBasedChannels
|
||||
*/
|
||||
|
||||
/**
|
||||
* Data that resolves to give a text-based channel. This can be:
|
||||
* * A text-based channel
|
||||
* * A snowflake
|
||||
* * A {@link TextBasedChannel}
|
||||
* * A {@link Snowflake}
|
||||
* @typedef {TextBasedChannels|Snowflake} TextBasedChannelsResolvable
|
||||
*/
|
||||
|
||||
|
||||
15
packages/discord.js/typings/index.d.ts
vendored
15
packages/discord.js/typings/index.d.ts
vendored
@@ -5160,6 +5160,13 @@ export interface WebhookCreateOptions extends ChannelWebhookCreateOptions {
|
||||
channel: TextChannel | NewsChannel | VoiceChannel | StageChannel | ForumChannel | MediaChannel | Snowflake;
|
||||
}
|
||||
|
||||
export interface GuildMembersChunk {
|
||||
index: number;
|
||||
count: number;
|
||||
notFound: readonly unknown[];
|
||||
nonce: string | undefined;
|
||||
}
|
||||
|
||||
export interface ClientEvents {
|
||||
applicationCommandPermissionsUpdate: [data: ApplicationCommandPermissionsUpdateData];
|
||||
autoModerationActionExecution: [autoModerationActionExecution: AutoModerationActionExecution];
|
||||
@@ -5197,11 +5204,7 @@ export interface ClientEvents {
|
||||
guildMemberAdd: [member: GuildMember];
|
||||
guildMemberAvailable: [member: GuildMember | PartialGuildMember];
|
||||
guildMemberRemove: [member: GuildMember | PartialGuildMember];
|
||||
guildMembersChunk: [
|
||||
members: ReadonlyCollection<Snowflake, GuildMember>,
|
||||
guild: Guild,
|
||||
data: { index: number; count: number; notFound: readonly unknown[]; nonce: string | undefined },
|
||||
];
|
||||
guildMembersChunk: [members: ReadonlyCollection<Snowflake, GuildMember>, guild: Guild, data: GuildMembersChunk];
|
||||
guildMemberUpdate: [oldMember: GuildMember | PartialGuildMember, newMember: GuildMember];
|
||||
guildUpdate: [oldGuild: Guild, newGuild: Guild];
|
||||
inviteCreate: [invite: Invite];
|
||||
@@ -6723,6 +6726,8 @@ export type TextBasedChannel = Exclude<
|
||||
PartialGroupDMChannel | ForumChannel | MediaChannel
|
||||
>;
|
||||
|
||||
export type TextBasedChannels = TextBasedChannel;
|
||||
|
||||
export type TextBasedChannelTypes = TextBasedChannel['type'];
|
||||
|
||||
export type GuildTextBasedChannelTypes = Exclude<TextBasedChannelTypes, ChannelType.DM>;
|
||||
|
||||
Reference in New Issue
Block a user