mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 08:03:30 +01:00
docs: export all visible symbols (#10760)
* docs: export all visible symbols * fix: discord.js except raw * refactor: remove raw data types * docs: add back discord.js tsdoc file * refactor: remove underscores * fix: merge * docs(RPCRedis): make `promises` as internal --------- Co-authored-by: Qjuh <76154676+Qjuh@users.noreply.github.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -63,6 +63,9 @@ export class RPCRedisBroker<TEvents extends Record<string, any[]>, TResponses ex
|
||||
*/
|
||||
protected override readonly options: Required<RPCRedisBrokerOptions>;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
protected readonly promises = new Map<string, InternalPromise>();
|
||||
|
||||
public constructor(redisClient: Redis, options: RPCRedisBrokerOptions) {
|
||||
|
||||
@@ -86,7 +86,7 @@ export * from './messages/MessageReference.js';
|
||||
export * from './util/componentUtil.js';
|
||||
export * from './util/normalizeArray.js';
|
||||
export * from './util/resolveBuilder.js';
|
||||
export * from './util/validation.js';
|
||||
export { disableValidators, enableValidators, isValidationEnabled } from './util/validation.js';
|
||||
|
||||
export * from './Assertions.js';
|
||||
|
||||
|
||||
@@ -1106,12 +1106,6 @@ export class Collection<Key, Value> extends Map<Key, Value> {
|
||||
declare public static readonly [Symbol.species]: typeof Collection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type Keep<Value> = { keep: false } | { keep: true; value: Value };
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type Comparator<Key, Value> = (firstValue: Value, secondValue: Value, firstKey: Key, secondKey: Key) => number;
|
||||
|
||||
1
packages/discord.js/.gitignore
vendored
1
packages/discord.js/.gitignore
vendored
@@ -28,4 +28,3 @@ docs/**/*
|
||||
|
||||
# Generated files
|
||||
typings/index.d.mts
|
||||
typings/rawDataTypes.d.mts
|
||||
|
||||
@@ -1,38 +1,6 @@
|
||||
import { readFile, writeFile } from 'node:fs/promises';
|
||||
import { cp } from 'node:fs/promises';
|
||||
|
||||
const rawTypesDTS = new URL('../typings/rawDataTypes.d.ts', import.meta.url);
|
||||
const rawIndexDTS = new URL('../typings/index.d.ts', import.meta.url);
|
||||
|
||||
const rawTypesMDTS = new URL('../typings/rawDataTypes.d.mts', import.meta.url);
|
||||
const rawIndexMTS = new URL('../typings/index.d.mts', import.meta.url);
|
||||
|
||||
const [rawTypesString, rawIndexString] = await Promise.all([
|
||||
readFile(rawTypesDTS, 'utf8'),
|
||||
readFile(rawIndexDTS, 'utf8'),
|
||||
]);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {string} source
|
||||
* @param {[from: string, to: string][]} imports
|
||||
*/
|
||||
function updateImports(source, imports) {
|
||||
return imports.reduce((code, [from, to]) => {
|
||||
return code.replaceAll(from, to);
|
||||
}, source);
|
||||
}
|
||||
|
||||
/** @type {[string, string][]} */
|
||||
const rawTypesImports = [
|
||||
['./index.js', './index.mjs'], //
|
||||
];
|
||||
|
||||
/** @type {[string, string][]} */
|
||||
const rawIndexImports = [
|
||||
['./rawDataTypes.js', './rawDataTypes.mjs'], //
|
||||
];
|
||||
|
||||
const rawTypesMDTSString = updateImports(rawTypesString, rawTypesImports);
|
||||
const rawIndexMTSString = updateImports(rawIndexString, rawIndexImports);
|
||||
|
||||
await Promise.all([writeFile(rawTypesMDTS, rawTypesMDTSString), writeFile(rawIndexMTS, rawIndexMTSString)]);
|
||||
await cp(rawIndexDTS, rawIndexMTS);
|
||||
|
||||
@@ -45,7 +45,17 @@ exports.ThreadMemberFlagsBitField = require('./util/ThreadMemberFlagsBitField.js
|
||||
exports.UserFlagsBitField = require('./util/UserFlagsBitField.js').UserFlagsBitField;
|
||||
|
||||
__exportStar(require('./util/DataResolver.js'), exports);
|
||||
__exportStar(require('./util/Util.js'), exports);
|
||||
|
||||
exports.cleanCodeBlockContent = require('./util/Util.js').cleanCodeBlockContent;
|
||||
exports.cleanContent = require('./util/Util.js').cleanContent;
|
||||
exports.discordSort = require('./util/Util.js').discordSort;
|
||||
exports.fetchRecommendedShardCount = require('./util/Util.js').fetchRecommendedShardCount;
|
||||
exports.flatten = require('./util/Util.js').flatten;
|
||||
exports.parseEmoji = require('./util/Util.js').parseEmoji;
|
||||
exports.parseWebhookURL = require('./util/Util.js').parseWebhookURL;
|
||||
exports.resolveColor = require('./util/Util.js').resolveColor;
|
||||
exports.resolveSKUId = require('./util/Util.js').resolveSKUId;
|
||||
exports.verifyString = require('./util/Util.js').verifyString;
|
||||
|
||||
exports.version = require('../package.json').version;
|
||||
|
||||
|
||||
@@ -521,25 +521,28 @@ function resolveSKUId(resolvable) {
|
||||
return null;
|
||||
}
|
||||
|
||||
exports.flatten = flatten;
|
||||
// Public
|
||||
exports.cleanCodeBlockContent = cleanCodeBlockContent;
|
||||
exports.cleanContent = cleanContent;
|
||||
exports.discordSort = discordSort;
|
||||
exports.fetchRecommendedShardCount = fetchRecommendedShardCount;
|
||||
exports.flatten = flatten;
|
||||
exports.parseEmoji = parseEmoji;
|
||||
exports.parseWebhookURL = parseWebhookURL;
|
||||
exports.resolveColor = resolveColor;
|
||||
exports.resolveSKUId = resolveSKUId;
|
||||
exports.verifyString = verifyString;
|
||||
|
||||
// Private
|
||||
exports.resolvePartialEmoji = resolvePartialEmoji;
|
||||
exports.resolveGuildEmoji = resolveGuildEmoji;
|
||||
exports.makeError = makeError;
|
||||
exports.makePlainError = makePlainError;
|
||||
exports.getSortableGroupTypes = getSortableGroupTypes;
|
||||
exports.moveElementInArray = moveElementInArray;
|
||||
exports.verifyString = verifyString;
|
||||
exports.resolveColor = resolveColor;
|
||||
exports.discordSort = discordSort;
|
||||
exports.setPosition = setPosition;
|
||||
exports.basename = basename;
|
||||
exports.cleanContent = cleanContent;
|
||||
exports.cleanCodeBlockContent = cleanCodeBlockContent;
|
||||
exports.parseWebhookURL = parseWebhookURL;
|
||||
exports.transformResolved = transformResolved;
|
||||
exports.resolveSKUId = resolveSKUId;
|
||||
|
||||
// Fixes Circular
|
||||
const { Attachment } = require('../structures/Attachment.js');
|
||||
|
||||
13
packages/discord.js/tsdoc.json
Normal file
13
packages/discord.js/tsdoc.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
||||
"extends": ["@discordjs/api-extractor/extends/tsdoc-base.json"],
|
||||
"tagDefinitions": [
|
||||
{
|
||||
"tagName": "@unstable",
|
||||
"syntaxKind": "modifier"
|
||||
}
|
||||
],
|
||||
"supportForTags": {
|
||||
"@unstable": true
|
||||
}
|
||||
}
|
||||
605
packages/discord.js/typings/index.d.ts
vendored
605
packages/discord.js/typings/index.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,234 +1,231 @@
|
||||
import type { ChildProcess } from 'node:child_process';
|
||||
import type { Worker } from 'node:worker_threads';
|
||||
import type { ChatInputCommandBuilder, ContextMenuCommandBuilder } from '@discordjs/builders';
|
||||
import { ReadonlyCollection } from '@discordjs/collection';
|
||||
import {
|
||||
APIButtonComponent,
|
||||
APIButtonComponentWithCustomId,
|
||||
APIEmbed,
|
||||
APIInteractionDataResolvedChannel,
|
||||
APIInteractionDataResolvedGuildMember,
|
||||
APIInteractionGuildMember,
|
||||
APIMessage,
|
||||
APIPartialChannel,
|
||||
APIPartialGuild,
|
||||
APIInteractionDataResolvedGuildMember,
|
||||
APIInteractionDataResolvedChannel,
|
||||
APIRole,
|
||||
APIButtonComponent,
|
||||
APISelectMenuComponent,
|
||||
APIStringSelectComponent,
|
||||
APITextInputComponent,
|
||||
ApplicationCommandOptionType,
|
||||
ComponentType,
|
||||
ApplicationCommandPermissionType,
|
||||
ChannelType,
|
||||
InteractionType,
|
||||
GatewayIntentBits,
|
||||
Locale,
|
||||
PermissionFlagsBits,
|
||||
ApplicationCommandType,
|
||||
AuditLogEvent,
|
||||
ButtonStyle,
|
||||
TextInputStyle,
|
||||
APIEmbed,
|
||||
ApplicationCommandType,
|
||||
APIMessage,
|
||||
APIStringSelectComponent,
|
||||
WebhookType,
|
||||
ChannelType,
|
||||
ComponentType,
|
||||
GatewayIntentBits,
|
||||
GuildScheduledEventRecurrenceRuleFrequency,
|
||||
GuildScheduledEventRecurrenceRuleMonth,
|
||||
GuildScheduledEventRecurrenceRuleWeekday,
|
||||
APIButtonComponentWithCustomId,
|
||||
InteractionType,
|
||||
Locale,
|
||||
MessageFlags,
|
||||
APITextInputComponent,
|
||||
PermissionFlagsBits,
|
||||
TextInputStyle,
|
||||
ThreadChannelType,
|
||||
WebhookType,
|
||||
} from 'discord-api-types/v10';
|
||||
import type { ChildProcess } from 'node:child_process';
|
||||
import type { Worker } from 'node:worker_threads';
|
||||
import { expectAssignable, expectNotAssignable, expectNotType, expectType } from 'tsd';
|
||||
import {
|
||||
ActionRow,
|
||||
ActionRowBuilder,
|
||||
ActionRowComponent,
|
||||
ActionRowData,
|
||||
AnnouncementChannel,
|
||||
AnyThreadChannel,
|
||||
ApplicationCommand,
|
||||
ApplicationCommandChannelOption,
|
||||
ApplicationCommandChannelOptionData,
|
||||
ApplicationCommandChoicesData,
|
||||
ApplicationCommandChoicesOption,
|
||||
ApplicationCommandData,
|
||||
ApplicationCommandManager,
|
||||
ApplicationCommandOptionData,
|
||||
ApplicationCommandPermissionsManager,
|
||||
ApplicationCommandResolvable,
|
||||
ApplicationCommandSubCommand,
|
||||
ApplicationCommandSubCommandData,
|
||||
ApplicationCommandSubGroup,
|
||||
ApplicationCommandSubGroupData,
|
||||
CommandInteraction,
|
||||
ButtonInteraction,
|
||||
CacheType,
|
||||
CategoryChannel,
|
||||
Client,
|
||||
ClientApplication,
|
||||
ClientUser,
|
||||
Collection,
|
||||
ChatInputCommandInteraction,
|
||||
CommandInteractionOption,
|
||||
CommandInteractionOptionResolver,
|
||||
CommandOptionNonChoiceResolvableType,
|
||||
ContextMenuCommandInteraction,
|
||||
DMChannel,
|
||||
Guild,
|
||||
GuildApplicationCommandManager,
|
||||
GuildChannelManager,
|
||||
GuildEmoji,
|
||||
GuildEmojiManager,
|
||||
GuildMember,
|
||||
GuildResolvable,
|
||||
IntentsBitField,
|
||||
Interaction,
|
||||
InteractionCollector,
|
||||
Message,
|
||||
AttachmentBuilder,
|
||||
MessageCollector,
|
||||
MessageComponentInteraction,
|
||||
MessageReaction,
|
||||
ModalBuilder,
|
||||
AnnouncementChannel,
|
||||
Options,
|
||||
PartialTextBasedChannelFields,
|
||||
PartialUser,
|
||||
PermissionsBitField,
|
||||
ReactionCollector,
|
||||
Role,
|
||||
RoleManager,
|
||||
Serialized,
|
||||
ShardClientUtil,
|
||||
ShardingManager,
|
||||
Snowflake,
|
||||
StageChannel,
|
||||
TextBasedChannelFields,
|
||||
type TextBasedChannel,
|
||||
type TextBasedChannelTypes,
|
||||
type VoiceBasedChannel,
|
||||
type GuildBasedChannel,
|
||||
type NonThreadGuildBasedChannel,
|
||||
type GuildTextBasedChannel,
|
||||
TextChannel,
|
||||
ThreadChannel,
|
||||
ThreadMember,
|
||||
Typing,
|
||||
User,
|
||||
VoiceChannel,
|
||||
Shard,
|
||||
Collector,
|
||||
GuildAuditLogsEntry,
|
||||
GuildAuditLogs,
|
||||
type AuditLogChange,
|
||||
StageInstance,
|
||||
ActionRowBuilder,
|
||||
ButtonComponent,
|
||||
StringSelectMenuComponent,
|
||||
RepliableInteraction,
|
||||
ThreadChannelType,
|
||||
Events,
|
||||
Status,
|
||||
CategoryChannelChildManager,
|
||||
ActionRowData,
|
||||
MessageActionRowComponentData,
|
||||
PartialThreadMember,
|
||||
ThreadMemberFlagsBitField,
|
||||
ButtonBuilder,
|
||||
EmbedBuilder,
|
||||
MessageActionRowComponent,
|
||||
StringSelectMenuBuilder,
|
||||
TextInputBuilder,
|
||||
TextInputComponent,
|
||||
Embed,
|
||||
GuildBanManager,
|
||||
GuildBan,
|
||||
MessageManager,
|
||||
ChannelMention,
|
||||
UserMention,
|
||||
PartialGroupDMChannel,
|
||||
ApplicationEmoji,
|
||||
ApplicationEmojiManager,
|
||||
Attachment,
|
||||
MessageContextMenuCommandInteraction,
|
||||
UserContextMenuCommandInteraction,
|
||||
AnyThreadChannel,
|
||||
ThreadMemberManager,
|
||||
CollectedMessageInteraction,
|
||||
ShardEvents,
|
||||
Webhook,
|
||||
WebhookClient,
|
||||
InteractionWebhook,
|
||||
ActionRowComponent,
|
||||
ActionRow,
|
||||
GuildAuditLogsActionType,
|
||||
GuildAuditLogsTargetType,
|
||||
ModalSubmitInteraction,
|
||||
ForumChannel,
|
||||
ChannelFlagsBitField,
|
||||
GuildForumThreadManager,
|
||||
GuildTextThreadManager,
|
||||
SelectMenuInteraction,
|
||||
StringSelectMenuInteraction,
|
||||
UserSelectMenuInteraction,
|
||||
RoleSelectMenuInteraction,
|
||||
ChannelSelectMenuInteraction,
|
||||
MentionableSelectMenuInteraction,
|
||||
MessageMentions,
|
||||
AttachmentBuilder,
|
||||
AutoModerationActionExecution,
|
||||
AutoModerationRule,
|
||||
AutoModerationRuleManager,
|
||||
PrivateThreadChannel,
|
||||
PublicThreadChannel,
|
||||
GuildMemberManager,
|
||||
GuildMemberFlagsBitField,
|
||||
ThreadManager,
|
||||
Awaitable,
|
||||
ButtonBuilder,
|
||||
ButtonComponent,
|
||||
ButtonComponentData,
|
||||
ButtonInteraction,
|
||||
CacheType,
|
||||
CategoryChannel,
|
||||
CategoryChannelChildManager,
|
||||
Channel,
|
||||
ChannelFlagsBitField,
|
||||
ChannelMention,
|
||||
ChannelSelectMenuBuilder,
|
||||
ChannelSelectMenuComponent,
|
||||
ChannelSelectMenuInteraction,
|
||||
ChatInputApplicationCommandData,
|
||||
ChatInputCommandInteraction,
|
||||
Client,
|
||||
ClientApplication,
|
||||
ClientUser,
|
||||
CollectedMessageInteraction,
|
||||
Collection,
|
||||
Collector,
|
||||
CommandInteraction,
|
||||
CommandInteractionOption,
|
||||
CommandInteractionOptionResolver,
|
||||
CommandOptionNonChoiceResolvableType,
|
||||
ContainerComponentData,
|
||||
ContextMenuCommandInteraction,
|
||||
createComponentBuilder,
|
||||
DirectoryChannel,
|
||||
DMChannel,
|
||||
DMMessageManager,
|
||||
Embed,
|
||||
EmbedBuilder,
|
||||
Emoji,
|
||||
Entitlement,
|
||||
Events,
|
||||
FetchedThreads,
|
||||
FetchedThreadsMore,
|
||||
DMMessageManager,
|
||||
FileComponentData,
|
||||
ForumChannel,
|
||||
Guild,
|
||||
GuildApplicationCommandManager,
|
||||
GuildAuditLogs,
|
||||
GuildAuditLogsActionType,
|
||||
GuildAuditLogsEntry,
|
||||
GuildAuditLogsTargetType,
|
||||
GuildBan,
|
||||
GuildBanManager,
|
||||
GuildChannelManager,
|
||||
GuildEmoji,
|
||||
GuildEmojiManager,
|
||||
GuildForumThreadManager,
|
||||
GuildMember,
|
||||
GuildMemberFlagsBitField,
|
||||
GuildMemberManager,
|
||||
GuildMessageManager,
|
||||
ApplicationCommandChannelOptionData,
|
||||
ApplicationCommandChannelOption,
|
||||
ApplicationCommandChoicesOption,
|
||||
ApplicationCommandChoicesData,
|
||||
ApplicationCommandSubGroup,
|
||||
ApplicationCommandSubCommand,
|
||||
ChatInputApplicationCommandData,
|
||||
ApplicationCommandPermissionsManager,
|
||||
GuildOnboarding,
|
||||
StringSelectMenuComponentData,
|
||||
ButtonComponentData,
|
||||
GuildResolvable,
|
||||
GuildScheduledEventManager,
|
||||
GuildScheduledEventRecurrenceRuleOptions,
|
||||
GuildTextThreadManager,
|
||||
IntentsBitField,
|
||||
Interaction,
|
||||
InteractionCallbackResponse,
|
||||
InteractionCollector,
|
||||
InteractionWebhook,
|
||||
MediaChannel,
|
||||
MediaGalleryComponentData,
|
||||
MediaGalleryItemData,
|
||||
MentionableSelectMenuBuilder,
|
||||
MentionableSelectMenuComponent,
|
||||
MentionableSelectMenuInteraction,
|
||||
Message,
|
||||
MessageActionRowComponent,
|
||||
MessageActionRowComponentData,
|
||||
MessageCollector,
|
||||
MessageComponentInteraction,
|
||||
MessageContextMenuCommandInteraction,
|
||||
MessageManager,
|
||||
MessageMentions,
|
||||
MessageReaction,
|
||||
ModalBuilder,
|
||||
ModalSubmitInteraction,
|
||||
Options,
|
||||
PartialDMChannel,
|
||||
PartialGroupDMChannel,
|
||||
PartialGuildMember,
|
||||
PartialMessage,
|
||||
PartialMessageReaction,
|
||||
resolvePartialEmoji,
|
||||
PartialEmojiOnlyId,
|
||||
Emoji,
|
||||
PartialEmoji,
|
||||
Awaitable,
|
||||
Channel,
|
||||
DirectoryChannel,
|
||||
Entitlement,
|
||||
SKU,
|
||||
UserSelectMenuBuilder,
|
||||
RoleSelectMenuBuilder,
|
||||
ChannelSelectMenuBuilder,
|
||||
MentionableSelectMenuBuilder,
|
||||
UserSelectMenuComponent,
|
||||
RoleSelectMenuComponent,
|
||||
ChannelSelectMenuComponent,
|
||||
MentionableSelectMenuComponent,
|
||||
Poll,
|
||||
ApplicationEmoji,
|
||||
ApplicationEmojiManager,
|
||||
StickerPack,
|
||||
GuildScheduledEventManager,
|
||||
SendableChannels,
|
||||
PollData,
|
||||
InteractionCallbackResponse,
|
||||
PrimaryEntryPointCommandInteraction,
|
||||
GuildScheduledEventRecurrenceRuleOptions,
|
||||
ThreadOnlyChannel,
|
||||
PartialPoll,
|
||||
PartialPollAnswer,
|
||||
PartialTextBasedChannelFields,
|
||||
PartialThreadMember,
|
||||
PartialUser,
|
||||
PermissionsBitField,
|
||||
Poll,
|
||||
PollAnswer,
|
||||
PollAnswerVoterManager,
|
||||
PollData,
|
||||
PrimaryButtonBuilder,
|
||||
PrimaryEntryPointCommandInteraction,
|
||||
PrivateThreadChannel,
|
||||
PublicThreadChannel,
|
||||
ReactionCollector,
|
||||
RepliableInteraction,
|
||||
resolveColor,
|
||||
createComponentBuilder,
|
||||
Role,
|
||||
RoleManager,
|
||||
RoleSelectMenuBuilder,
|
||||
RoleSelectMenuComponent,
|
||||
RoleSelectMenuInteraction,
|
||||
SectionComponentData,
|
||||
TextDisplayComponentData,
|
||||
ThumbnailComponentData,
|
||||
UnfurledMediaItemData,
|
||||
MediaGalleryComponentData,
|
||||
MediaGalleryItemData,
|
||||
SelectMenuInteraction,
|
||||
SendableChannels,
|
||||
SeparatorComponentData,
|
||||
FileComponentData,
|
||||
ContainerComponentData,
|
||||
Serialized,
|
||||
Shard,
|
||||
ShardClientUtil,
|
||||
ShardEvents,
|
||||
ShardingManager,
|
||||
SKU,
|
||||
Snowflake,
|
||||
StageChannel,
|
||||
StageInstance,
|
||||
Status,
|
||||
StickerPack,
|
||||
StringSelectMenuBuilder,
|
||||
StringSelectMenuComponent,
|
||||
StringSelectMenuComponentData,
|
||||
StringSelectMenuInteraction,
|
||||
TextBasedChannelFields,
|
||||
TextChannel,
|
||||
TextDisplayComponentData,
|
||||
TextInputBuilder,
|
||||
TextInputComponent,
|
||||
ThreadChannel,
|
||||
ThreadManager,
|
||||
ThreadMember,
|
||||
ThreadMemberFlagsBitField,
|
||||
ThreadMemberManager,
|
||||
ThreadOnlyChannel,
|
||||
ThumbnailComponentData,
|
||||
Typing,
|
||||
UnfurledMediaItemData,
|
||||
User,
|
||||
UserContextMenuCommandInteraction,
|
||||
UserMention,
|
||||
UserSelectMenuBuilder,
|
||||
UserSelectMenuComponent,
|
||||
UserSelectMenuInteraction,
|
||||
VoiceChannel,
|
||||
Webhook,
|
||||
WebhookClient,
|
||||
type AuditLogChange,
|
||||
type GuildBasedChannel,
|
||||
type GuildTextBasedChannel,
|
||||
type NonThreadGuildBasedChannel,
|
||||
type TextBasedChannel,
|
||||
type TextBasedChannelTypes,
|
||||
type VoiceBasedChannel,
|
||||
} from './index.js';
|
||||
import { expectAssignable, expectNotAssignable, expectNotType, expectType } from 'tsd';
|
||||
import type { ContextMenuCommandBuilder, ChatInputCommandBuilder } from '@discordjs/builders';
|
||||
import { ReadonlyCollection } from '@discordjs/collection';
|
||||
|
||||
// Test type transformation:
|
||||
declare const serialize: <Value>(value: Value) => Serialized<Value>;
|
||||
@@ -2756,12 +2753,6 @@ expectType<null>(partialUser.username);
|
||||
expectType<null>(partialUser.tag);
|
||||
expectType<null>(partialUser.discriminator);
|
||||
|
||||
declare const emoji: Emoji;
|
||||
{
|
||||
expectType<PartialEmojiOnlyId>(resolvePartialEmoji('12345678901234567'));
|
||||
expectType<PartialEmoji | null>(resolvePartialEmoji(emoji));
|
||||
}
|
||||
|
||||
declare const application: ClientApplication;
|
||||
declare const entitlement: Entitlement;
|
||||
declare const sku: SKU;
|
||||
|
||||
208
packages/discord.js/typings/rawDataTypes.d.ts
vendored
208
packages/discord.js/typings/rawDataTypes.d.ts
vendored
@@ -1,208 +0,0 @@
|
||||
// These are aggregate types that are used in the typings file but do not exist as actual exported values.
|
||||
// To prevent them from showing up in an editor, they are imported from here instead of exporting them there directly.
|
||||
|
||||
import {
|
||||
APIApplication,
|
||||
APIApplicationCommand,
|
||||
APIApplicationCommandInteraction,
|
||||
APIAttachment,
|
||||
APIAuditLog,
|
||||
APIAuditLogEntry,
|
||||
APIBan,
|
||||
APIChannel,
|
||||
APIEmoji,
|
||||
APIExtendedInvite,
|
||||
APIGuild,
|
||||
APIGuildIntegration,
|
||||
APIGuildIntegrationApplication,
|
||||
APIGuildMember,
|
||||
APIGuildPreview,
|
||||
APIGuildWelcomeScreen,
|
||||
APIGuildWelcomeScreenChannel,
|
||||
APIGuildWidget,
|
||||
APIGuildWidgetMember,
|
||||
APIInteractionDataResolvedChannel,
|
||||
APIInteractionDataResolvedGuildMember,
|
||||
APIInteractionGuildMember,
|
||||
APIInvite,
|
||||
APIMessage,
|
||||
APIMessageButtonInteractionData,
|
||||
APIMessageComponentInteraction,
|
||||
APIMessageSelectMenuInteractionData,
|
||||
APIOverwrite,
|
||||
APIPartialChannel,
|
||||
APIPartialEmoji,
|
||||
APIPartialGuild,
|
||||
APIReaction,
|
||||
APIRole,
|
||||
APIStageInstance,
|
||||
APISticker,
|
||||
APIStickerItem,
|
||||
APIStickerPack,
|
||||
APITeam,
|
||||
APITeamMember,
|
||||
APITemplate,
|
||||
APIThreadMember,
|
||||
APIUnavailableGuild,
|
||||
APIUser,
|
||||
APIVoiceRegion,
|
||||
APIVoiceState,
|
||||
APIWebhook,
|
||||
GatewayActivity,
|
||||
GatewayActivityAssets,
|
||||
GatewayActivityEmoji,
|
||||
GatewayGuildBanAddDispatchData,
|
||||
GatewayGuildMemberAddDispatchData,
|
||||
GatewayGuildMemberUpdateDispatchData,
|
||||
GatewayInteractionCreateDispatchData,
|
||||
GatewayInviteCreateDispatchData,
|
||||
GatewayInviteDeleteDispatchData,
|
||||
GatewayMessageReactionAddDispatchData,
|
||||
GatewayMessageUpdateDispatchData,
|
||||
GatewayPresenceUpdate,
|
||||
GatewayReadyDispatchData,
|
||||
GatewayTypingStartDispatchData,
|
||||
RESTAPIPartialCurrentUserGuild,
|
||||
RESTGetAPIWebhookWithTokenResult,
|
||||
RESTPatchAPIChannelMessageJSONBody,
|
||||
RESTPatchAPICurrentGuildMemberNicknameJSONBody,
|
||||
RESTPatchAPIInteractionFollowupJSONBody,
|
||||
RESTPatchAPIInteractionOriginalResponseJSONBody,
|
||||
RESTPatchAPIWebhookWithTokenJSONBody,
|
||||
RESTPostAPIChannelMessageJSONBody,
|
||||
RESTPostAPIInteractionCallbackFormDataBody,
|
||||
RESTPostAPIInteractionFollowupJSONBody,
|
||||
RESTPostAPIWebhookWithTokenJSONBody,
|
||||
Snowflake,
|
||||
APIGuildScheduledEvent,
|
||||
} from 'discord-api-types/v10';
|
||||
import { GuildChannel, Guild, PermissionOverwrites } from './index.js';
|
||||
|
||||
export type RawActivityData = GatewayActivity;
|
||||
|
||||
export type RawApplicationData = RawClientApplicationData | RawIntegrationApplicationData;
|
||||
export type RawClientApplicationData = GatewayReadyDispatchData['application'] | APIMessage['application'];
|
||||
export type RawIntegrationApplicationData = APIGuildIntegrationApplication | Partial<APIApplication>;
|
||||
|
||||
export type RawApplicationCommandData = APIApplicationCommand;
|
||||
|
||||
export type RawChannelData =
|
||||
| RawGuildChannelData
|
||||
| RawThreadChannelData
|
||||
| RawDMChannelData
|
||||
| RawPartialGroupDMChannelData;
|
||||
export type RawDMChannelData = APIChannel | APIInteractionDataResolvedChannel;
|
||||
export type RawGuildChannelData = APIChannel | APIInteractionDataResolvedChannel | Required<APIPartialChannel>;
|
||||
export type RawPartialGroupDMChannelData = APIChannel | Required<APIPartialChannel>;
|
||||
export type RawThreadChannelData = APIChannel | APIInteractionDataResolvedChannel;
|
||||
|
||||
export type RawEmojiData =
|
||||
| RawGuildEmojiData
|
||||
| RawReactionEmojiData
|
||||
| GatewayActivityEmoji
|
||||
| Omit<Partial<APIPartialEmoji>, 'animated'>;
|
||||
export type RawApplicationEmojiData = APIEmoji;
|
||||
export type RawGuildEmojiData = APIEmoji;
|
||||
export type RawReactionEmojiData = APIEmoji | APIPartialEmoji;
|
||||
|
||||
export type RawGuildAuditLogData = APIAuditLog;
|
||||
|
||||
export type RawGuildAuditLogEntryData = APIAuditLogEntry;
|
||||
|
||||
export type RawGuildBanData = GatewayGuildBanAddDispatchData | APIBan;
|
||||
|
||||
export type RawGuildData = APIGuild | APIUnavailableGuild;
|
||||
export type RawAnonymousGuildData = RawGuildData | RawInviteGuildData;
|
||||
export type RawBaseGuildData = RawAnonymousGuildData | RawOAuth2GuildData;
|
||||
export type RawInviteGuildData = APIPartialGuild;
|
||||
export type RawOAuth2GuildData = RESTAPIPartialCurrentUserGuild;
|
||||
|
||||
export type RawGuildMemberData =
|
||||
| APIGuildMember
|
||||
| APIInteractionGuildMember
|
||||
| APIInteractionDataResolvedGuildMember
|
||||
| GatewayGuildMemberAddDispatchData
|
||||
| GatewayGuildMemberUpdateDispatchData
|
||||
| Required<RESTPatchAPICurrentGuildMemberNicknameJSONBody>
|
||||
| { user: { id: Snowflake } };
|
||||
export type RawThreadMemberData = APIThreadMember;
|
||||
|
||||
export type RawGuildPreviewData = APIGuildPreview;
|
||||
|
||||
export type RawGuildScheduledEventData = APIGuildScheduledEvent;
|
||||
|
||||
export type RawGuildTemplateData = APITemplate;
|
||||
|
||||
export type RawIntegrationData = APIGuildIntegration;
|
||||
|
||||
export type RawInteractionData = GatewayInteractionCreateDispatchData;
|
||||
export type RawCommandInteractionData = APIApplicationCommandInteraction;
|
||||
export type RawMessageComponentInteractionData = APIMessageComponentInteraction;
|
||||
export type RawMessageButtonInteractionData = APIMessageButtonInteractionData;
|
||||
export type RawMessageSelectMenuInteractionData = APIMessageSelectMenuInteractionData;
|
||||
|
||||
export type RawInviteData =
|
||||
| APIExtendedInvite
|
||||
| APIInvite
|
||||
| (GatewayInviteCreateDispatchData & { channel: GuildChannel; guild: Guild })
|
||||
| (GatewayInviteDeleteDispatchData & { channel: GuildChannel; guild: Guild });
|
||||
|
||||
export type RawMessageData = APIMessage;
|
||||
export type RawPartialMessageData = GatewayMessageUpdateDispatchData;
|
||||
|
||||
export type RawAttachmentData = APIAttachment;
|
||||
|
||||
export type RawMessagePayloadData =
|
||||
| RESTPostAPIChannelMessageJSONBody
|
||||
| RESTPatchAPIChannelMessageJSONBody
|
||||
| RESTPostAPIWebhookWithTokenJSONBody
|
||||
| RESTPatchAPIWebhookWithTokenJSONBody
|
||||
| RESTPostAPIInteractionCallbackFormDataBody
|
||||
| RESTPatchAPIInteractionOriginalResponseJSONBody
|
||||
| RESTPostAPIInteractionFollowupJSONBody
|
||||
| RESTPatchAPIInteractionFollowupJSONBody;
|
||||
|
||||
export type RawMessageReactionData = APIReaction | GatewayMessageReactionAddDispatchData;
|
||||
|
||||
export type RawPermissionOverwriteData = APIOverwrite | PermissionOverwrites;
|
||||
|
||||
export type RawPresenceData = GatewayPresenceUpdate;
|
||||
|
||||
export type RawRoleData = APIRole;
|
||||
|
||||
export type RawRichPresenceAssets = GatewayActivityAssets;
|
||||
|
||||
export type RawStageInstanceData =
|
||||
| APIStageInstance
|
||||
| (Partial<APIStageInstance> & Pick<APIStageInstance, 'id' | 'channel_id' | 'guild_id'>);
|
||||
|
||||
export type RawStickerData = APISticker | APIStickerItem;
|
||||
|
||||
export type RawStickerPackData = APIStickerPack;
|
||||
|
||||
export type RawTeamData = APITeam;
|
||||
|
||||
export type RawTeamMemberData = APITeamMember;
|
||||
|
||||
export type RawTypingData = GatewayTypingStartDispatchData;
|
||||
|
||||
export type RawUserData =
|
||||
| (APIUser & { member?: Omit<APIGuildMember, 'user'> })
|
||||
| (GatewayPresenceUpdate['user'] & Pick<APIUser, 'username'>);
|
||||
|
||||
export type RawVoiceRegionData = APIVoiceRegion;
|
||||
|
||||
export type RawVoiceStateData = APIVoiceState | Omit<APIVoiceState, 'guild_id'>;
|
||||
|
||||
export type RawWebhookData =
|
||||
| APIWebhook
|
||||
| RESTGetAPIWebhookWithTokenResult
|
||||
| (Partial<APIWebhook> & Required<Pick<APIWebhook, 'id' | 'guild_id'>>);
|
||||
|
||||
export type RawWelcomeChannelData = APIGuildWelcomeScreenChannel;
|
||||
|
||||
export type RawWelcomeScreenData = APIGuildWelcomeScreen;
|
||||
|
||||
export type RawWidgetData = APIGuildWidget;
|
||||
|
||||
export type RawWidgetMemberData = APIGuildWidgetMember;
|
||||
@@ -1,15 +1,19 @@
|
||||
import type { InternalRequest, RawFile } from '../utils/types.js';
|
||||
|
||||
interface DiscordErrorFieldInformation {
|
||||
export interface DiscordErrorFieldInformation {
|
||||
code: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface DiscordErrorGroupWrapper {
|
||||
export interface DiscordErrorGroupWrapper {
|
||||
_errors: DiscordError[];
|
||||
}
|
||||
|
||||
type DiscordError = DiscordErrorFieldInformation | DiscordErrorGroupWrapper | string | { [k: string]: DiscordError };
|
||||
export type DiscordError =
|
||||
| DiscordErrorFieldInformation
|
||||
| DiscordErrorGroupWrapper
|
||||
| string
|
||||
| { [k: string]: DiscordError };
|
||||
|
||||
export interface DiscordErrorData {
|
||||
code: number;
|
||||
|
||||
@@ -363,8 +363,6 @@ export type RouteLike = `/${string}`;
|
||||
|
||||
/**
|
||||
* Internal request options
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export interface InternalRequest extends RequestData {
|
||||
fullRoute: RouteLike;
|
||||
@@ -377,8 +375,6 @@ export interface HandlerRequestData extends Pick<InternalRequest, 'body' | 'file
|
||||
|
||||
/**
|
||||
* Parsed route data for an endpoint
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export interface RouteData {
|
||||
bucketRoute: string;
|
||||
@@ -388,8 +384,6 @@ export interface RouteData {
|
||||
|
||||
/**
|
||||
* Represents a hash and its associated fields
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export interface HashData {
|
||||
lastAccess: number;
|
||||
|
||||
@@ -2,6 +2,7 @@ export * from './lib/CDN.js';
|
||||
export * from './lib/errors/DiscordAPIError.js';
|
||||
export * from './lib/errors/HTTPError.js';
|
||||
export * from './lib/errors/RateLimitError.js';
|
||||
export type * from './lib/interfaces/Handler.js';
|
||||
export * from './lib/REST.js';
|
||||
export * from './lib/utils/constants.js';
|
||||
export * from './lib/utils/types.js';
|
||||
|
||||
@@ -272,14 +272,14 @@ export class VoiceConnection extends EventEmitter {
|
||||
|
||||
/**
|
||||
* The current state of the voice connection.
|
||||
*
|
||||
* @remarks
|
||||
* The setter will perform clean-up operations where necessary.
|
||||
*/
|
||||
public get state() {
|
||||
return this._state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the state of the voice connection, performing clean-up operations where necessary.
|
||||
*/
|
||||
public set state(newState: VoiceConnectionState) {
|
||||
const oldState = this._state;
|
||||
const oldNetworking = Reflect.get(oldState, 'networking') as Networking | undefined;
|
||||
|
||||
@@ -304,14 +304,14 @@ export class AudioPlayer extends EventEmitter {
|
||||
|
||||
/**
|
||||
* The state that the player is in.
|
||||
*
|
||||
* @remarks
|
||||
* The setter will perform clean-up operations where necessary.
|
||||
*/
|
||||
public get state() {
|
||||
return this._state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a new state for the player, performing clean-up operations where necessary.
|
||||
*/
|
||||
public set state(newState: AudioPlayerState) {
|
||||
const oldState = this._state;
|
||||
const newResource = Reflect.get(newState, 'resource') as AudioResource | undefined;
|
||||
|
||||
@@ -17,4 +17,4 @@ export { AudioResource, type CreateAudioResourceOptions, createAudioResource } f
|
||||
|
||||
export { PlayerSubscription } from './PlayerSubscription';
|
||||
|
||||
export { StreamType } from './TransformerGraph';
|
||||
export { StreamType, type Edge, TransformerType, Node } from './TransformerGraph';
|
||||
|
||||
@@ -3,6 +3,24 @@ export * from './audio/index';
|
||||
export * from './util/index';
|
||||
export * from './receive/index';
|
||||
|
||||
export {
|
||||
Networking,
|
||||
type ConnectionData,
|
||||
type ConnectionOptions,
|
||||
type NetworkingState,
|
||||
type NetworkingResumingState,
|
||||
type NetworkingSelectingProtocolState,
|
||||
type NetworkingUdpHandshakingState,
|
||||
type NetworkingClosedState,
|
||||
type NetworkingIdentifyingState,
|
||||
type NetworkingOpeningWsState,
|
||||
type NetworkingReadyState,
|
||||
NetworkingStatusCode,
|
||||
VoiceUDPSocket,
|
||||
VoiceWebSocket,
|
||||
type SocketConfig,
|
||||
} from './networking/index.js';
|
||||
|
||||
export {
|
||||
VoiceConnection,
|
||||
type VoiceConnectionState,
|
||||
|
||||
@@ -131,7 +131,7 @@ export type NetworkingState =
|
||||
* are first received on the main bot gateway, in the form of VOICE_SERVER_UPDATE
|
||||
* and VOICE_STATE_UPDATE packets.
|
||||
*/
|
||||
interface ConnectionOptions {
|
||||
export interface ConnectionOptions {
|
||||
endpoint: string;
|
||||
serverId: string;
|
||||
sessionId: string;
|
||||
@@ -254,14 +254,14 @@ export class Networking extends EventEmitter {
|
||||
|
||||
/**
|
||||
* The current state of the networking instance.
|
||||
*
|
||||
* @remarks
|
||||
* The setter will perform clean-up operations where necessary.
|
||||
*/
|
||||
public get state(): NetworkingState {
|
||||
return this._state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a new state for the networking instance, performing clean-up operations where necessary.
|
||||
*/
|
||||
public set state(newState: NetworkingState) {
|
||||
const oldWs = Reflect.get(this._state, 'ws') as VoiceWebSocket | undefined;
|
||||
const newWs = Reflect.get(newState, 'ws') as VoiceWebSocket | undefined;
|
||||
|
||||
Reference in New Issue
Block a user