mirror of
https://github.com/discordjs/discord-api-types.git
synced 2026-05-28 06:20:11 +00:00
Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
78d6acfdb8 | ||
|
|
19a8371695 | ||
|
|
d5cdb37a8f | ||
|
|
2023a0ab2a | ||
|
|
8fe9c072b3 | ||
|
|
d446be5ecd | ||
|
|
27840d1086 | ||
|
|
1fc2a6ece8 | ||
|
|
f90b47c95c | ||
|
|
cf076b868b | ||
|
|
470f340e75 | ||
|
|
d9b6935b01 | ||
|
|
907c1685a3 | ||
|
|
3f61ce43e9 | ||
|
|
92d0ef46d9 | ||
|
|
b648c89b5e | ||
|
|
6ace234311 | ||
|
|
a9ba1e18bc | ||
|
|
ee53ef7306 | ||
|
|
cddd038a8b | ||
|
|
fc4e7bebc5 | ||
|
|
a81f31178f | ||
|
|
5c6e5ca7bb | ||
|
|
6c13d341a6 | ||
|
|
a7d019eab9 | ||
|
|
936a03982b | ||
|
|
6d8fd9f3d8 | ||
|
|
d222c61e0a | ||
|
|
9f327dd999 | ||
|
|
5d472cbfba | ||
|
|
bcb13de75b | ||
|
|
61592d6a85 | ||
|
|
b3e818fd33 | ||
|
|
3faaf75970 | ||
|
|
fb7c6b8903 | ||
|
|
20f44ac7d9 | ||
|
|
68e19d38e4 | ||
|
|
534dc2f1be |
2
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
2
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
@@ -1,6 +1,6 @@
|
||||
name: Feature request
|
||||
description: Request a feature for the discord-api-types library (we accept documented features of the official Discord developer API only!)
|
||||
labels: [discussion]
|
||||
labels: [feature request]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
|
||||
73
CHANGELOG.md
73
CHANGELOG.md
@@ -1,3 +1,76 @@
|
||||
## [0.37.119](https://github.com/discordjs/discord-api-types/compare/0.37.118...0.37.119) (2025-02-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* route escaping round three ([d5cdb37](https://github.com/discordjs/discord-api-types/commit/d5cdb37a8f06128e472f1ef13ec4d7823f956e7d))
|
||||
|
||||
|
||||
|
||||
## [0.37.118](https://github.com/discordjs/discord-api-types/compare/0.37.117...0.37.118) (2025-01-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **APIGuild:** add `incidents_data` ([#822](https://github.com/discordjs/discord-api-types/issues/822)) ([8fe9c07](https://github.com/discordjs/discord-api-types/commit/8fe9c072b3188c51bb3713dae640ba227a266438))
|
||||
* **MessageFlags:** add HasSnapshot ([#1141](https://github.com/discordjs/discord-api-types/issues/1141)) ([d446be5](https://github.com/discordjs/discord-api-types/commit/d446be5ecdcc3889e30a8af1ce2ac598ffe1b49d))
|
||||
|
||||
|
||||
|
||||
## [0.37.117](https://github.com/discordjs/discord-api-types/compare/0.37.116...0.37.117) (2025-01-20)
|
||||
|
||||
|
||||
|
||||
## [0.37.116](https://github.com/discordjs/discord-api-types/compare/0.37.115...0.37.116) (2025-01-16)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **VoiceCloseCodes:** add `BadRequest` ([#1191](https://github.com/discordjs/discord-api-types/issues/1191)) ([d9b6935](https://github.com/discordjs/discord-api-types/commit/d9b6935b01665db70ddf8971be5ee42c96f12706))
|
||||
|
||||
|
||||
|
||||
## [0.37.115](https://github.com/discordjs/discord-api-types/compare/0.37.114...0.37.115) (2025-01-02)
|
||||
|
||||
|
||||
|
||||
## [0.37.114](https://github.com/discordjs/discord-api-types/compare/0.37.113...0.37.114) (2024-12-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* reset pattern index after testing an input ([ee53ef7](https://github.com/discordjs/discord-api-types/commit/ee53ef7306e73d6b9bf341503231186ef27403fb)), closes [/github.com/discordjs/discord-api-types/issues/1181#issuecomment-2558971449](https://github.com//github.com/discordjs/discord-api-types/issues/1181/issues/issuecomment-2558971449)
|
||||
|
||||
|
||||
|
||||
## [0.37.113](https://github.com/discordjs/discord-api-types/compare/0.37.112...0.37.113) (2024-12-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* skip encoded url parts from re-encoding ([fc4e7be](https://github.com/discordjs/discord-api-types/commit/fc4e7bebc50fe67a0aa5c49a95793e53d3ff0da9))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **ConnectionService:** `Bluesky` and `Mastodon` ([#1174](https://github.com/discordjs/discord-api-types/issues/1174)) ([61592d6](https://github.com/discordjs/discord-api-types/commit/61592d6a85232a6d675a6faeddc096ae3467df6a))
|
||||
* **payloads:** add entrypoint command payloads ([#1166](https://github.com/discordjs/discord-api-types/issues/1166)) ([bcb13de](https://github.com/discordjs/discord-api-types/commit/bcb13de75b6b45e2a5c1ebde5fa77719123b7993))
|
||||
|
||||
|
||||
|
||||
## [0.37.112](https://github.com/discordjs/discord-api-types/compare/0.37.111...0.37.112) (2024-12-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **APISubscription:** add `renewal_sku_ids` ([#1172](https://github.com/discordjs/discord-api-types/issues/1172)) ([fb7c6b8](https://github.com/discordjs/discord-api-types/commit/fb7c6b8903bded49c379ba61a520818ba5ab15ba))
|
||||
|
||||
|
||||
|
||||
## [0.37.111](https://github.com/discordjs/discord-api-types/compare/0.37.110...0.37.111) (2024-12-09)
|
||||
|
||||
|
||||
|
||||
## [0.37.110](https://github.com/discordjs/discord-api-types/compare/0.37.109...0.37.110) (2024-11-28)
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,76 @@
|
||||
## [0.37.119](https://github.com/discordjs/discord-api-types/compare/0.37.118...0.37.119) (2025-02-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* route escaping round three ([d5cdb37](https://github.com/discordjs/discord-api-types/commit/d5cdb37a8f06128e472f1ef13ec4d7823f956e7d))
|
||||
|
||||
|
||||
|
||||
## [0.37.118](https://github.com/discordjs/discord-api-types/compare/0.37.117...0.37.118) (2025-01-27)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **APIGuild:** add `incidents_data` ([#822](https://github.com/discordjs/discord-api-types/issues/822)) ([8fe9c07](https://github.com/discordjs/discord-api-types/commit/8fe9c072b3188c51bb3713dae640ba227a266438))
|
||||
* **MessageFlags:** add HasSnapshot ([#1141](https://github.com/discordjs/discord-api-types/issues/1141)) ([d446be5](https://github.com/discordjs/discord-api-types/commit/d446be5ecdcc3889e30a8af1ce2ac598ffe1b49d))
|
||||
|
||||
|
||||
|
||||
## [0.37.117](https://github.com/discordjs/discord-api-types/compare/0.37.116...0.37.117) (2025-01-20)
|
||||
|
||||
|
||||
|
||||
## [0.37.116](https://github.com/discordjs/discord-api-types/compare/0.37.115...0.37.116) (2025-01-16)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **VoiceCloseCodes:** add `BadRequest` ([#1191](https://github.com/discordjs/discord-api-types/issues/1191)) ([d9b6935](https://github.com/discordjs/discord-api-types/commit/d9b6935b01665db70ddf8971be5ee42c96f12706))
|
||||
|
||||
|
||||
|
||||
## [0.37.115](https://github.com/discordjs/discord-api-types/compare/0.37.114...0.37.115) (2025-01-02)
|
||||
|
||||
|
||||
|
||||
## [0.37.114](https://github.com/discordjs/discord-api-types/compare/0.37.113...0.37.114) (2024-12-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* reset pattern index after testing an input ([ee53ef7](https://github.com/discordjs/discord-api-types/commit/ee53ef7306e73d6b9bf341503231186ef27403fb)), closes [/github.com/discordjs/discord-api-types/issues/1181#issuecomment-2558971449](https://github.com//github.com/discordjs/discord-api-types/issues/1181/issues/issuecomment-2558971449)
|
||||
|
||||
|
||||
|
||||
## [0.37.113](https://github.com/discordjs/discord-api-types/compare/0.37.112...0.37.113) (2024-12-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* skip encoded url parts from re-encoding ([fc4e7be](https://github.com/discordjs/discord-api-types/commit/fc4e7bebc50fe67a0aa5c49a95793e53d3ff0da9))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **ConnectionService:** `Bluesky` and `Mastodon` ([#1174](https://github.com/discordjs/discord-api-types/issues/1174)) ([61592d6](https://github.com/discordjs/discord-api-types/commit/61592d6a85232a6d675a6faeddc096ae3467df6a))
|
||||
* **payloads:** add entrypoint command payloads ([#1166](https://github.com/discordjs/discord-api-types/issues/1166)) ([bcb13de](https://github.com/discordjs/discord-api-types/commit/bcb13de75b6b45e2a5c1ebde5fa77719123b7993))
|
||||
|
||||
|
||||
|
||||
## [0.37.112](https://github.com/discordjs/discord-api-types/compare/0.37.111...0.37.112) (2024-12-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **APISubscription:** add `renewal_sku_ids` ([#1172](https://github.com/discordjs/discord-api-types/issues/1172)) ([fb7c6b8](https://github.com/discordjs/discord-api-types/commit/fb7c6b8903bded49c379ba61a520818ba5ab15ba))
|
||||
|
||||
|
||||
|
||||
## [0.37.111](https://github.com/discordjs/discord-api-types/compare/0.37.110...0.37.111) (2024-12-09)
|
||||
|
||||
|
||||
|
||||
## [0.37.110](https://github.com/discordjs/discord-api-types/compare/0.37.109...0.37.110) (2024-11-28)
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands.ts';
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
|
||||
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data
|
||||
*/
|
||||
export type APIPrimaryEntryPointCommandInteractionData =
|
||||
APIBaseApplicationCommandInteractionData<ApplicationCommandType.PrimaryEntryPoint>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIPrimaryEntryPointCommandInteraction =
|
||||
APIApplicationCommandInteractionWrapper<APIPrimaryEntryPointCommandInteractionData>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIPrimaryEntryPointCommandDMInteraction = APIDMInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIPrimaryEntryPointCommandGuildInteraction =
|
||||
APIGuildInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;
|
||||
@@ -13,12 +13,19 @@ import type {
|
||||
APIContextMenuInteraction,
|
||||
APIContextMenuInteractionData,
|
||||
} from './_applicationCommands/contextMenu.ts';
|
||||
import type {
|
||||
APIPrimaryEntryPointCommandDMInteraction,
|
||||
APIPrimaryEntryPointCommandGuildInteraction,
|
||||
APIPrimaryEntryPointCommandInteraction,
|
||||
APIPrimaryEntryPointCommandInteractionData,
|
||||
} from './_applicationCommands/entryPoint.ts';
|
||||
import type { APIBaseInteraction } from './base.ts';
|
||||
import type { InteractionType } from './responses.ts';
|
||||
|
||||
export * from './_applicationCommands/chatInput.ts';
|
||||
export * from './_applicationCommands/contextMenu.ts';
|
||||
export * from './_applicationCommands/permissions.ts';
|
||||
export * from './_applicationCommands/entryPoint.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object
|
||||
@@ -185,7 +192,8 @@ export enum EntryPointCommandHandlerType {
|
||||
*/
|
||||
export type APIApplicationCommandInteractionData =
|
||||
| APIChatInputApplicationCommandInteractionData
|
||||
| APIContextMenuInteractionData;
|
||||
| APIContextMenuInteractionData
|
||||
| APIPrimaryEntryPointCommandInteractionData;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
@@ -202,18 +210,23 @@ export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationC
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction;
|
||||
export type APIApplicationCommandInteraction =
|
||||
| APIChatInputApplicationCommandInteraction
|
||||
| APIContextMenuInteraction
|
||||
| APIPrimaryEntryPointCommandInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandDMInteraction =
|
||||
| APIChatInputApplicationCommandDMInteraction
|
||||
| APIContextMenuDMInteraction;
|
||||
| APIContextMenuDMInteraction
|
||||
| APIPrimaryEntryPointCommandDMInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandGuildInteraction =
|
||||
| APIChatInputApplicationCommandGuildInteraction
|
||||
| APIContextMenuGuildInteraction;
|
||||
| APIContextMenuGuildInteraction
|
||||
| APIPrimaryEntryPointCommandGuildInteraction;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v10.ts';
|
||||
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel.ts';
|
||||
import type { MessageFlags } from '../mod.ts';
|
||||
import type { APIApplicationCommandOptionChoice } from './applicationCommands.ts';
|
||||
|
||||
/**
|
||||
@@ -22,6 +21,7 @@ export type APIInteractionResponse =
|
||||
| APIInteractionResponseChannelMessageWithSource
|
||||
| APIInteractionResponseDeferredChannelMessageWithSource
|
||||
| APIInteractionResponseDeferredMessageUpdate
|
||||
| APIInteractionResponseLaunchActivity
|
||||
| APIInteractionResponsePong
|
||||
| APIInteractionResponseUpdateMessage
|
||||
| APIModalInteractionResponse
|
||||
@@ -64,6 +64,10 @@ export interface APIInteractionResponseUpdateMessage {
|
||||
data?: APIInteractionResponseCallbackData;
|
||||
}
|
||||
|
||||
export interface APIInteractionResponseLaunchActivity {
|
||||
type: InteractionResponseType.LaunchActivity;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
|
||||
*/
|
||||
@@ -115,10 +119,7 @@ export enum InteractionResponseType {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure
|
||||
*/
|
||||
export type APIInteractionResponseCallbackData = Omit<
|
||||
RESTPostAPIWebhookWithTokenJSONBody,
|
||||
'avatar_url' | 'username'
|
||||
> & { flags?: MessageFlags };
|
||||
export type APIInteractionResponseCallbackData = Omit<RESTPostAPIWebhookWithTokenJSONBody, 'avatar_url' | 'username'>;
|
||||
|
||||
export interface APICommandAutocompleteInteractionResponseCallbackData {
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
|
||||
@@ -910,6 +910,10 @@ export enum MessageFlags {
|
||||
* This message is a voice message
|
||||
*/
|
||||
IsVoiceMessage = 1 << 13,
|
||||
/**
|
||||
* This message has a snapshot (via Message Forwarding)
|
||||
*/
|
||||
HasSnapshot = 1 << 14,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1162,10 +1166,6 @@ export interface APIEmbed {
|
||||
title?: string;
|
||||
/**
|
||||
* Type of embed (always "rich" for webhook embeds)
|
||||
*
|
||||
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object-embed-types
|
||||
*/
|
||||
type?: EmbedType;
|
||||
/**
|
||||
@@ -1234,8 +1234,6 @@ export interface APIEmbed {
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#embed-object-embed-types
|
||||
*
|
||||
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
|
||||
*/
|
||||
export enum EmbedType {
|
||||
/**
|
||||
|
||||
@@ -281,6 +281,10 @@ export interface APIGuild extends APIPartialGuild {
|
||||
* The id of the channel where admins and moderators of Community guilds receive safety alerts from Discord
|
||||
*/
|
||||
safety_alerts_channel_id: Snowflake | null;
|
||||
/**
|
||||
* The incidents data for this guild
|
||||
*/
|
||||
incidents_data: APIIncidentsData | null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1160,3 +1164,22 @@ export enum GuildOnboardingPromptType {
|
||||
MultipleChoice,
|
||||
Dropdown,
|
||||
}
|
||||
|
||||
export interface APIIncidentsData {
|
||||
/**
|
||||
* When invites get enabled again
|
||||
*/
|
||||
invites_disabled_until: string | null;
|
||||
/**
|
||||
* When direct messages get enabled again
|
||||
*/
|
||||
dms_disabled_until: string | null;
|
||||
/**
|
||||
* When the dm spam was detected
|
||||
*/
|
||||
dm_spam_detected_at?: string | null;
|
||||
/**
|
||||
* When the raid was detected
|
||||
*/
|
||||
raid_detected_at?: string | null;
|
||||
}
|
||||
|
||||
@@ -33,13 +33,13 @@ export interface APIEntitlement {
|
||||
*/
|
||||
deleted: boolean;
|
||||
/**
|
||||
* Start date at which the entitlement is valid. Not present when using test entitlements.
|
||||
* Start date at which the entitlement is valid.
|
||||
*/
|
||||
starts_at?: string;
|
||||
starts_at: string | null;
|
||||
/**
|
||||
* Date at which the entitlement is no longer valid. Not present when using test entitlements.
|
||||
* Date at which the entitlement is no longer valid.
|
||||
*/
|
||||
ends_at?: string;
|
||||
ends_at: string | null;
|
||||
/**
|
||||
* For consumable items, whether or not the entitlement has been consumed
|
||||
*/
|
||||
@@ -177,6 +177,10 @@ export interface APISubscription {
|
||||
* List of entitlements granted for this subscription
|
||||
*/
|
||||
entitlement_ids: Snowflake[];
|
||||
/**
|
||||
* List of SKUs that this user will be subscribed to at renewal
|
||||
*/
|
||||
renewal_sku_ids: Snowflake[] | null;
|
||||
/**
|
||||
* Start of the current subscription period
|
||||
*/
|
||||
|
||||
@@ -275,6 +275,7 @@ export interface APIConnection {
|
||||
export enum ConnectionService {
|
||||
AmazonMusic = 'amazon-music',
|
||||
BattleNet = 'battlenet',
|
||||
Bluesky = 'bluesky',
|
||||
BungieNet = 'bungie',
|
||||
Crunchyroll = 'crunchyroll',
|
||||
Domain = 'domain',
|
||||
@@ -284,6 +285,7 @@ export enum ConnectionService {
|
||||
GitHub = 'github',
|
||||
Instagram = 'instagram',
|
||||
LeagueOfLegends = 'leagueoflegends',
|
||||
Mastodon = 'mastodon',
|
||||
PayPal = 'paypal',
|
||||
PlayStationNetwork = 'playstation',
|
||||
Reddit = 'reddit',
|
||||
|
||||
@@ -219,9 +219,6 @@ export enum OverwriteType {
|
||||
*/
|
||||
export interface APIEmbed {
|
||||
title?: string;
|
||||
/**
|
||||
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
|
||||
*/
|
||||
type?: EmbedType;
|
||||
description?: string;
|
||||
url?: string;
|
||||
@@ -239,7 +236,6 @@ export interface APIEmbed {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#embed-object-embed-types
|
||||
*
|
||||
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
|
||||
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
|
||||
*/
|
||||
export enum EmbedType {
|
||||
|
||||
@@ -693,10 +693,6 @@ export interface APIEmbed {
|
||||
title?: string;
|
||||
/**
|
||||
* Type of embed (always "rich" for webhook embeds)
|
||||
*
|
||||
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object-embed-types
|
||||
*/
|
||||
type?: EmbedType;
|
||||
/**
|
||||
@@ -766,7 +762,6 @@ export interface APIEmbed {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#embed-object-embed-types
|
||||
*
|
||||
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
|
||||
* @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10.
|
||||
*/
|
||||
export enum EmbedType {
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands.ts';
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base.ts';
|
||||
import type { APIBaseApplicationCommandInteractionData } from './internals.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data
|
||||
*/
|
||||
export type APIPrimaryEntryPointCommandInteractionData =
|
||||
APIBaseApplicationCommandInteractionData<ApplicationCommandType.PrimaryEntryPoint>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIPrimaryEntryPointCommandInteraction =
|
||||
APIApplicationCommandInteractionWrapper<APIPrimaryEntryPointCommandInteractionData>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIPrimaryEntryPointCommandDMInteraction = APIDMInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIPrimaryEntryPointCommandGuildInteraction =
|
||||
APIGuildInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;
|
||||
@@ -13,12 +13,19 @@ import type {
|
||||
APIContextMenuInteraction,
|
||||
APIContextMenuInteractionData,
|
||||
} from './_applicationCommands/contextMenu.ts';
|
||||
import type {
|
||||
APIPrimaryEntryPointCommandDMInteraction,
|
||||
APIPrimaryEntryPointCommandGuildInteraction,
|
||||
APIPrimaryEntryPointCommandInteraction,
|
||||
APIPrimaryEntryPointCommandInteractionData,
|
||||
} from './_applicationCommands/entryPoint.ts';
|
||||
import type { APIBaseInteraction } from './base.ts';
|
||||
import type { InteractionType } from './responses.ts';
|
||||
|
||||
export * from './_applicationCommands/chatInput.ts';
|
||||
export * from './_applicationCommands/contextMenu.ts';
|
||||
export * from './_applicationCommands/permissions.ts';
|
||||
export * from './_applicationCommands/entryPoint.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object
|
||||
@@ -185,7 +192,8 @@ export enum EntryPointCommandHandlerType {
|
||||
*/
|
||||
export type APIApplicationCommandInteractionData =
|
||||
| APIChatInputApplicationCommandInteractionData
|
||||
| APIContextMenuInteractionData;
|
||||
| APIContextMenuInteractionData
|
||||
| APIPrimaryEntryPointCommandInteractionData;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
@@ -202,18 +210,23 @@ export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationC
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction;
|
||||
export type APIApplicationCommandInteraction =
|
||||
| APIChatInputApplicationCommandInteraction
|
||||
| APIContextMenuInteraction
|
||||
| APIPrimaryEntryPointCommandInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandDMInteraction =
|
||||
| APIChatInputApplicationCommandDMInteraction
|
||||
| APIContextMenuDMInteraction;
|
||||
| APIContextMenuDMInteraction
|
||||
| APIPrimaryEntryPointCommandDMInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandGuildInteraction =
|
||||
| APIChatInputApplicationCommandGuildInteraction
|
||||
| APIContextMenuGuildInteraction;
|
||||
| APIContextMenuGuildInteraction
|
||||
| APIPrimaryEntryPointCommandGuildInteraction;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9.ts';
|
||||
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel.ts';
|
||||
import type { MessageFlags } from '../mod.ts';
|
||||
import type { APIApplicationCommandOptionChoice } from './applicationCommands.ts';
|
||||
|
||||
/**
|
||||
@@ -22,6 +21,7 @@ export type APIInteractionResponse =
|
||||
| APIInteractionResponseChannelMessageWithSource
|
||||
| APIInteractionResponseDeferredChannelMessageWithSource
|
||||
| APIInteractionResponseDeferredMessageUpdate
|
||||
| APIInteractionResponseLaunchActivity
|
||||
| APIInteractionResponsePong
|
||||
| APIInteractionResponseUpdateMessage
|
||||
| APIModalInteractionResponse
|
||||
@@ -64,6 +64,10 @@ export interface APIInteractionResponseUpdateMessage {
|
||||
data?: APIInteractionResponseCallbackData;
|
||||
}
|
||||
|
||||
export interface APIInteractionResponseLaunchActivity {
|
||||
type: InteractionResponseType.LaunchActivity;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
|
||||
*/
|
||||
@@ -115,10 +119,7 @@ export enum InteractionResponseType {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure
|
||||
*/
|
||||
export type APIInteractionResponseCallbackData = Omit<
|
||||
RESTPostAPIWebhookWithTokenJSONBody,
|
||||
'avatar_url' | 'username'
|
||||
> & { flags?: MessageFlags };
|
||||
export type APIInteractionResponseCallbackData = Omit<RESTPostAPIWebhookWithTokenJSONBody, 'avatar_url' | 'username'>;
|
||||
|
||||
export interface APICommandAutocompleteInteractionResponseCallbackData {
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
|
||||
@@ -895,6 +895,10 @@ export enum MessageFlags {
|
||||
* This message is a voice message
|
||||
*/
|
||||
IsVoiceMessage = 1 << 13,
|
||||
/**
|
||||
* This message has a snapshot (via Message Forwarding)
|
||||
*/
|
||||
HasSnapshot = 1 << 14,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1129,10 +1133,6 @@ export interface APIEmbed {
|
||||
title?: string;
|
||||
/**
|
||||
* Type of embed (always "rich" for webhook embeds)
|
||||
*
|
||||
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object-embed-types
|
||||
*/
|
||||
type?: EmbedType;
|
||||
/**
|
||||
@@ -1201,8 +1201,6 @@ export interface APIEmbed {
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#embed-object-embed-types
|
||||
*
|
||||
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
|
||||
*/
|
||||
export enum EmbedType {
|
||||
/**
|
||||
|
||||
@@ -281,6 +281,10 @@ export interface APIGuild extends APIPartialGuild {
|
||||
* The id of the channel where admins and moderators of Community guilds receive safety alerts from Discord
|
||||
*/
|
||||
safety_alerts_channel_id: Snowflake | null;
|
||||
/**
|
||||
* The incidents data for this guild
|
||||
*/
|
||||
incidents_data: APIIncidentsData | null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1152,3 +1156,22 @@ export enum GuildOnboardingPromptType {
|
||||
MultipleChoice,
|
||||
Dropdown,
|
||||
}
|
||||
|
||||
export interface APIIncidentsData {
|
||||
/**
|
||||
* When invites get enabled again
|
||||
*/
|
||||
invites_disabled_until: string | null;
|
||||
/**
|
||||
* When direct messages get enabled again
|
||||
*/
|
||||
dms_disabled_until: string | null;
|
||||
/**
|
||||
* When the dm spam was detected
|
||||
*/
|
||||
dm_spam_detected_at?: string | null;
|
||||
/**
|
||||
* When the raid was detected
|
||||
*/
|
||||
raid_detected_at?: string | null;
|
||||
}
|
||||
|
||||
@@ -33,13 +33,13 @@ export interface APIEntitlement {
|
||||
*/
|
||||
deleted: boolean;
|
||||
/**
|
||||
* Start date at which the entitlement is valid. Not present when using test entitlements.
|
||||
* Start date at which the entitlement is valid.
|
||||
*/
|
||||
starts_at?: string;
|
||||
starts_at: string | null;
|
||||
/**
|
||||
* Date at which the entitlement is no longer valid. Not present when using test entitlements.
|
||||
* Date at which the entitlement is no longer valid.
|
||||
*/
|
||||
ends_at?: string;
|
||||
ends_at: string | null;
|
||||
/**
|
||||
* For consumable items, whether or not the entitlement has been consumed
|
||||
*/
|
||||
@@ -177,6 +177,10 @@ export interface APISubscription {
|
||||
* List of entitlements granted for this subscription
|
||||
*/
|
||||
entitlement_ids: Snowflake[];
|
||||
/**
|
||||
* List of SKUs that this user will be subscribed to at renewal
|
||||
*/
|
||||
renewal_sku_ids: Snowflake[] | null;
|
||||
/**
|
||||
* Start of the current subscription period
|
||||
*/
|
||||
|
||||
@@ -275,6 +275,7 @@ export interface APIConnection {
|
||||
export enum ConnectionService {
|
||||
AmazonMusic = 'amazon-music',
|
||||
BattleNet = 'battlenet',
|
||||
Bluesky = 'bluesky',
|
||||
BungieNet = 'bungie',
|
||||
Crunchyroll = 'crunchyroll',
|
||||
Domain = 'domain',
|
||||
@@ -284,6 +285,7 @@ export enum ConnectionService {
|
||||
GitHub = 'github',
|
||||
Instagram = 'instagram',
|
||||
LeagueOfLegends = 'leagueoflegends',
|
||||
Mastodon = 'mastodon',
|
||||
PayPal = 'paypal',
|
||||
PlayStationNetwork = 'playstation',
|
||||
Reddit = 'reddit',
|
||||
|
||||
@@ -997,3 +997,17 @@ export type RESTAPIModifyGuildOnboardingPromptOptionData = RESTAPIGuildOnboardin
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-onboarding
|
||||
*/
|
||||
export type RESTPutAPIGuildOnboardingResult = APIGuildOnboarding;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-incidents-actions
|
||||
*/
|
||||
export interface RESTPutAPIGuildIncidentActionsJSONBody {
|
||||
/**
|
||||
* When invites will be enabled again
|
||||
*/
|
||||
invites_disabled_until?: string | undefined;
|
||||
/**
|
||||
* When direct messages will be enabled again
|
||||
*/
|
||||
dms_disabled_until?: string | undefined;
|
||||
}
|
||||
|
||||
@@ -83,12 +83,21 @@ export interface RESTPostAPIContextMenuApplicationCommandsJSONBody extends RESTP
|
||||
type: ApplicationCommandType.Message | ApplicationCommandType.User;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
|
||||
*/
|
||||
export interface RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody
|
||||
extends RESTPostAPIBaseApplicationCommandsJSONBody {
|
||||
type: ApplicationCommandType.PrimaryEntryPoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
|
||||
*/
|
||||
export type RESTPostAPIApplicationCommandsJSONBody =
|
||||
| RESTPostAPIChatInputApplicationCommandsJSONBody
|
||||
| RESTPostAPIContextMenuApplicationCommandsJSONBody;
|
||||
| RESTPostAPIContextMenuApplicationCommandsJSONBody
|
||||
| RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
import { urlSafeCharacters } from '../../utils/internals.ts';
|
||||
|
||||
export * from '../common.ts';
|
||||
export * from './application.ts';
|
||||
@@ -932,6 +933,14 @@ export const Routes = {
|
||||
return `/guilds/${guildId}/onboarding` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - PUT `/guilds/${guild.id}/incident-actions`
|
||||
*/
|
||||
guildIncidentActions(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/incident-actions` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/applications/@me`
|
||||
@@ -1056,7 +1065,18 @@ export const Routes = {
|
||||
|
||||
for (const [key, fn] of Object.entries(Routes)) {
|
||||
Routes[key as keyof typeof Routes] = (...args: (boolean | number | string | undefined)[]) => {
|
||||
const escaped = args.map((arg) => arg && encodeURIComponent(arg));
|
||||
const escaped = args.map((arg) => {
|
||||
if (arg) {
|
||||
// Skip already "safe" urls
|
||||
if (urlSafeCharacters.test(String(arg))) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
return encodeURIComponent(arg);
|
||||
}
|
||||
|
||||
return arg;
|
||||
});
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
@@ -1363,8 +1383,19 @@ export const CDNRoutes = {
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(CDNRoutes)) {
|
||||
CDNRoutes[key as keyof typeof CDNRoutes] = (...args: (number | string | undefined)[]) => {
|
||||
const escaped = args.map((arg) => arg && encodeURIComponent(arg));
|
||||
CDNRoutes[key as keyof typeof CDNRoutes] = (...args: (boolean | number | string | undefined)[]) => {
|
||||
const escaped = args.map((arg) => {
|
||||
if (arg) {
|
||||
// Skip already "safe" urls
|
||||
if (urlSafeCharacters.test(String(arg))) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
return encodeURIComponent(arg);
|
||||
}
|
||||
|
||||
return arg;
|
||||
});
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { urlSafeCharacters } from '../../utils/internals.ts';
|
||||
|
||||
export * from '../common.ts';
|
||||
|
||||
export * from './auditLog.ts';
|
||||
@@ -521,8 +523,19 @@ export const Routes = {
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(Routes)) {
|
||||
Routes[key] = (...args: string[]) => {
|
||||
const escaped = args.map((arg) => encodeURIComponent(arg));
|
||||
Routes[key] = (...args: (boolean | number | string | undefined)[]) => {
|
||||
const escaped = args.map((arg) => {
|
||||
if (arg) {
|
||||
// Skip already "safe" urls
|
||||
if (urlSafeCharacters.test(String(arg))) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
return encodeURIComponent(arg);
|
||||
}
|
||||
|
||||
return arg;
|
||||
});
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
import { urlSafeCharacters } from '../../utils/internals.ts';
|
||||
|
||||
export * from '../common.ts';
|
||||
|
||||
@@ -778,8 +779,19 @@ export const Routes = {
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(Routes)) {
|
||||
Routes[key] = (...args: string[]) => {
|
||||
const escaped = args.map((arg) => encodeURIComponent(arg));
|
||||
Routes[key] = (...args: (boolean | number | string | undefined)[]) => {
|
||||
const escaped = args.map((arg) => {
|
||||
if (arg) {
|
||||
// Skip already "safe" urls
|
||||
if (urlSafeCharacters.test(String(arg))) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
return encodeURIComponent(arg);
|
||||
}
|
||||
|
||||
return arg;
|
||||
});
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
|
||||
@@ -1003,3 +1003,17 @@ export type RESTAPIModifyGuildOnboardingPromptOptionData = RESTAPIGuildOnboardin
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-onboarding
|
||||
*/
|
||||
export type RESTPutAPIGuildOnboardingResult = APIGuildOnboarding;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-incidents-actions
|
||||
*/
|
||||
export interface RESTPutAPIGuildIncidentActionsJSONBody {
|
||||
/**
|
||||
* When invites will be enabled again
|
||||
*/
|
||||
invites_disabled_until?: string | undefined;
|
||||
/**
|
||||
* When direct messages will be enabled again
|
||||
*/
|
||||
dms_disabled_until?: string | undefined;
|
||||
}
|
||||
|
||||
@@ -83,12 +83,21 @@ export interface RESTPostAPIContextMenuApplicationCommandsJSONBody extends RESTP
|
||||
type: ApplicationCommandType.Message | ApplicationCommandType.User;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
|
||||
*/
|
||||
export interface RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody
|
||||
extends RESTPostAPIBaseApplicationCommandsJSONBody {
|
||||
type: ApplicationCommandType.PrimaryEntryPoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
|
||||
*/
|
||||
export type RESTPostAPIApplicationCommandsJSONBody =
|
||||
| RESTPostAPIChatInputApplicationCommandsJSONBody
|
||||
| RESTPostAPIContextMenuApplicationCommandsJSONBody;
|
||||
| RESTPostAPIContextMenuApplicationCommandsJSONBody
|
||||
| RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
import { urlSafeCharacters } from '../../utils/internals.ts';
|
||||
|
||||
export * from '../common.ts';
|
||||
export * from './application.ts';
|
||||
@@ -941,6 +942,14 @@ export const Routes = {
|
||||
return `/guilds/${guildId}/onboarding` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - PUT `/guilds/${guild.id}/incident-actions`
|
||||
*/
|
||||
guildIncidentActions(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/incident-actions` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/applications/@me`
|
||||
@@ -1065,7 +1074,18 @@ export const Routes = {
|
||||
|
||||
for (const [key, fn] of Object.entries(Routes)) {
|
||||
Routes[key as keyof typeof Routes] = (...args: (boolean | number | string | undefined)[]) => {
|
||||
const escaped = args.map((arg) => arg && encodeURIComponent(arg));
|
||||
const escaped = args.map((arg) => {
|
||||
if (arg) {
|
||||
// Skip already "safe" urls
|
||||
if (urlSafeCharacters.test(String(arg))) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
return encodeURIComponent(arg);
|
||||
}
|
||||
|
||||
return arg;
|
||||
});
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
@@ -1372,8 +1392,19 @@ export const CDNRoutes = {
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(CDNRoutes)) {
|
||||
CDNRoutes[key as keyof typeof CDNRoutes] = (...args: (number | string | undefined)[]) => {
|
||||
const escaped = args.map((arg) => arg && encodeURIComponent(arg));
|
||||
CDNRoutes[key as keyof typeof CDNRoutes] = (...args: (boolean | number | string | undefined)[]) => {
|
||||
const escaped = args.map((arg) => {
|
||||
if (arg) {
|
||||
// Skip already "safe" urls
|
||||
if (urlSafeCharacters.test(String(arg))) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
return encodeURIComponent(arg);
|
||||
}
|
||||
|
||||
return arg;
|
||||
});
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
@@ -1398,8 +1429,8 @@ export type ApplicationCoverFormat = Exclude<ImageFormat, ImageFormat.GIF | Imag
|
||||
export type ApplicationAssetFormat = Exclude<ImageFormat, ImageFormat.GIF | ImageFormat.Lottie>;
|
||||
export type AchievementIconFormat = Exclude<ImageFormat, ImageFormat.GIF | ImageFormat.Lottie>;
|
||||
export type StickerPackBannerFormat = Exclude<ImageFormat, ImageFormat.GIF | ImageFormat.Lottie>;
|
||||
export type StorePageAssetFormat = Exclude<ImageFormat, ImageFormat.GIF | ImageFormat.Lottie>;
|
||||
export type TeamIconFormat = Exclude<ImageFormat, ImageFormat.GIF | ImageFormat.Lottie>;
|
||||
export type StorePageAssetFormat = Exclude<ImageFormat, ImageFormat.GIF | ImageFormat.Lottie>;
|
||||
export type StickerFormat = Extract<ImageFormat, ImageFormat.GIF | ImageFormat.Lottie | ImageFormat.PNG>;
|
||||
export type RoleIconFormat = Exclude<ImageFormat, ImageFormat.GIF | ImageFormat.Lottie>;
|
||||
export type GuildScheduledEventCoverFormat = Exclude<ImageFormat, ImageFormat.GIF | ImageFormat.Lottie>;
|
||||
@@ -1417,6 +1448,7 @@ export interface CDNQuery {
|
||||
export const RouteBases = {
|
||||
api: `https://discord.com/api/v${APIVersion}`,
|
||||
cdn: 'https://cdn.discordapp.com',
|
||||
media: 'https://media.discordapp.net',
|
||||
invite: 'https://discord.gg',
|
||||
template: 'https://discord.new',
|
||||
gift: 'https://discord.gift',
|
||||
|
||||
@@ -39,3 +39,16 @@ export type DistributiveOmit<T, K extends DistributiveKeys<T>> =
|
||||
T extends unknown ? { [P in keyof Omit_<T, K>]: Omit_<T, K>[P] } : never;
|
||||
|
||||
type Omit_<T, K> = Omit<T, Extract<keyof T, K>>;
|
||||
|
||||
// eslint-disable-next-line unicorn/better-regex
|
||||
const pattern = /^[\d%A-Za-z-_]+$/g;
|
||||
|
||||
export const urlSafeCharacters = {
|
||||
test(input: string) {
|
||||
const result = pattern.test(input);
|
||||
|
||||
pattern.lastIndex = 0;
|
||||
|
||||
return result;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -106,4 +106,8 @@ export enum VoiceCloseCodes {
|
||||
* We didn't recognize your encryption
|
||||
*/
|
||||
UnknownEncryptionMode,
|
||||
/**
|
||||
* You sent a malformed request
|
||||
*/
|
||||
BadRequest = 4_020,
|
||||
}
|
||||
|
||||
1347
package-lock.json
generated
1347
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "discord-api-types",
|
||||
"version": "0.37.110",
|
||||
"version": "0.37.119",
|
||||
"description": "Discord API typings that are kept up to date for use in bot library creation.",
|
||||
"homepage": "https://discord-api-types.dev",
|
||||
"exports": {
|
||||
@@ -144,7 +144,7 @@
|
||||
"eslint-plugin-local": "^6.0.0",
|
||||
"gen-esm-wrapper": "^1.1.3",
|
||||
"husky": "^9.0.11",
|
||||
"is-ci": "^3.0.1",
|
||||
"is-ci": "^4.0.0",
|
||||
"lint-staged": "^15.2.2",
|
||||
"npm-run-all2": "^7.0.0",
|
||||
"prettier": "^3.2.5",
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands';
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
|
||||
import type { APIBaseApplicationCommandInteractionData } from './internals';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data
|
||||
*/
|
||||
export type APIPrimaryEntryPointCommandInteractionData =
|
||||
APIBaseApplicationCommandInteractionData<ApplicationCommandType.PrimaryEntryPoint>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIPrimaryEntryPointCommandInteraction =
|
||||
APIApplicationCommandInteractionWrapper<APIPrimaryEntryPointCommandInteractionData>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIPrimaryEntryPointCommandDMInteraction = APIDMInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIPrimaryEntryPointCommandGuildInteraction =
|
||||
APIGuildInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;
|
||||
@@ -13,12 +13,19 @@ import type {
|
||||
APIContextMenuInteraction,
|
||||
APIContextMenuInteractionData,
|
||||
} from './_applicationCommands/contextMenu';
|
||||
import type {
|
||||
APIPrimaryEntryPointCommandDMInteraction,
|
||||
APIPrimaryEntryPointCommandGuildInteraction,
|
||||
APIPrimaryEntryPointCommandInteraction,
|
||||
APIPrimaryEntryPointCommandInteractionData,
|
||||
} from './_applicationCommands/entryPoint';
|
||||
import type { APIBaseInteraction } from './base';
|
||||
import type { InteractionType } from './responses';
|
||||
|
||||
export * from './_applicationCommands/chatInput';
|
||||
export * from './_applicationCommands/contextMenu';
|
||||
export * from './_applicationCommands/permissions';
|
||||
export * from './_applicationCommands/entryPoint';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object
|
||||
@@ -185,7 +192,8 @@ export enum EntryPointCommandHandlerType {
|
||||
*/
|
||||
export type APIApplicationCommandInteractionData =
|
||||
| APIChatInputApplicationCommandInteractionData
|
||||
| APIContextMenuInteractionData;
|
||||
| APIContextMenuInteractionData
|
||||
| APIPrimaryEntryPointCommandInteractionData;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
@@ -202,18 +210,23 @@ export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationC
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction;
|
||||
export type APIApplicationCommandInteraction =
|
||||
| APIChatInputApplicationCommandInteraction
|
||||
| APIContextMenuInteraction
|
||||
| APIPrimaryEntryPointCommandInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandDMInteraction =
|
||||
| APIChatInputApplicationCommandDMInteraction
|
||||
| APIContextMenuDMInteraction;
|
||||
| APIContextMenuDMInteraction
|
||||
| APIPrimaryEntryPointCommandDMInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandGuildInteraction =
|
||||
| APIChatInputApplicationCommandGuildInteraction
|
||||
| APIContextMenuGuildInteraction;
|
||||
| APIContextMenuGuildInteraction
|
||||
| APIPrimaryEntryPointCommandGuildInteraction;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v10';
|
||||
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel';
|
||||
import type { MessageFlags } from '../index';
|
||||
import type { APIApplicationCommandOptionChoice } from './applicationCommands';
|
||||
|
||||
/**
|
||||
@@ -22,6 +21,7 @@ export type APIInteractionResponse =
|
||||
| APIInteractionResponseChannelMessageWithSource
|
||||
| APIInteractionResponseDeferredChannelMessageWithSource
|
||||
| APIInteractionResponseDeferredMessageUpdate
|
||||
| APIInteractionResponseLaunchActivity
|
||||
| APIInteractionResponsePong
|
||||
| APIInteractionResponseUpdateMessage
|
||||
| APIModalInteractionResponse
|
||||
@@ -64,6 +64,10 @@ export interface APIInteractionResponseUpdateMessage {
|
||||
data?: APIInteractionResponseCallbackData;
|
||||
}
|
||||
|
||||
export interface APIInteractionResponseLaunchActivity {
|
||||
type: InteractionResponseType.LaunchActivity;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
|
||||
*/
|
||||
@@ -115,10 +119,7 @@ export enum InteractionResponseType {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure
|
||||
*/
|
||||
export type APIInteractionResponseCallbackData = Omit<
|
||||
RESTPostAPIWebhookWithTokenJSONBody,
|
||||
'avatar_url' | 'username'
|
||||
> & { flags?: MessageFlags };
|
||||
export type APIInteractionResponseCallbackData = Omit<RESTPostAPIWebhookWithTokenJSONBody, 'avatar_url' | 'username'>;
|
||||
|
||||
export interface APICommandAutocompleteInteractionResponseCallbackData {
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
|
||||
@@ -910,6 +910,10 @@ export enum MessageFlags {
|
||||
* This message is a voice message
|
||||
*/
|
||||
IsVoiceMessage = 1 << 13,
|
||||
/**
|
||||
* This message has a snapshot (via Message Forwarding)
|
||||
*/
|
||||
HasSnapshot = 1 << 14,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1162,10 +1166,6 @@ export interface APIEmbed {
|
||||
title?: string;
|
||||
/**
|
||||
* Type of embed (always "rich" for webhook embeds)
|
||||
*
|
||||
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object-embed-types
|
||||
*/
|
||||
type?: EmbedType;
|
||||
/**
|
||||
@@ -1234,8 +1234,6 @@ export interface APIEmbed {
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#embed-object-embed-types
|
||||
*
|
||||
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
|
||||
*/
|
||||
export enum EmbedType {
|
||||
/**
|
||||
|
||||
@@ -281,6 +281,10 @@ export interface APIGuild extends APIPartialGuild {
|
||||
* The id of the channel where admins and moderators of Community guilds receive safety alerts from Discord
|
||||
*/
|
||||
safety_alerts_channel_id: Snowflake | null;
|
||||
/**
|
||||
* The incidents data for this guild
|
||||
*/
|
||||
incidents_data: APIIncidentsData | null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1160,3 +1164,22 @@ export enum GuildOnboardingPromptType {
|
||||
MultipleChoice,
|
||||
Dropdown,
|
||||
}
|
||||
|
||||
export interface APIIncidentsData {
|
||||
/**
|
||||
* When invites get enabled again
|
||||
*/
|
||||
invites_disabled_until: string | null;
|
||||
/**
|
||||
* When direct messages get enabled again
|
||||
*/
|
||||
dms_disabled_until: string | null;
|
||||
/**
|
||||
* When the dm spam was detected
|
||||
*/
|
||||
dm_spam_detected_at?: string | null;
|
||||
/**
|
||||
* When the raid was detected
|
||||
*/
|
||||
raid_detected_at?: string | null;
|
||||
}
|
||||
|
||||
@@ -33,13 +33,13 @@ export interface APIEntitlement {
|
||||
*/
|
||||
deleted: boolean;
|
||||
/**
|
||||
* Start date at which the entitlement is valid. Not present when using test entitlements.
|
||||
* Start date at which the entitlement is valid.
|
||||
*/
|
||||
starts_at?: string;
|
||||
starts_at: string | null;
|
||||
/**
|
||||
* Date at which the entitlement is no longer valid. Not present when using test entitlements.
|
||||
* Date at which the entitlement is no longer valid.
|
||||
*/
|
||||
ends_at?: string;
|
||||
ends_at: string | null;
|
||||
/**
|
||||
* For consumable items, whether or not the entitlement has been consumed
|
||||
*/
|
||||
@@ -177,6 +177,10 @@ export interface APISubscription {
|
||||
* List of entitlements granted for this subscription
|
||||
*/
|
||||
entitlement_ids: Snowflake[];
|
||||
/**
|
||||
* List of SKUs that this user will be subscribed to at renewal
|
||||
*/
|
||||
renewal_sku_ids: Snowflake[] | null;
|
||||
/**
|
||||
* Start of the current subscription period
|
||||
*/
|
||||
|
||||
@@ -275,6 +275,7 @@ export interface APIConnection {
|
||||
export enum ConnectionService {
|
||||
AmazonMusic = 'amazon-music',
|
||||
BattleNet = 'battlenet',
|
||||
Bluesky = 'bluesky',
|
||||
BungieNet = 'bungie',
|
||||
Crunchyroll = 'crunchyroll',
|
||||
Domain = 'domain',
|
||||
@@ -284,6 +285,7 @@ export enum ConnectionService {
|
||||
GitHub = 'github',
|
||||
Instagram = 'instagram',
|
||||
LeagueOfLegends = 'leagueoflegends',
|
||||
Mastodon = 'mastodon',
|
||||
PayPal = 'paypal',
|
||||
PlayStationNetwork = 'playstation',
|
||||
Reddit = 'reddit',
|
||||
|
||||
@@ -219,9 +219,6 @@ export enum OverwriteType {
|
||||
*/
|
||||
export interface APIEmbed {
|
||||
title?: string;
|
||||
/**
|
||||
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
|
||||
*/
|
||||
type?: EmbedType;
|
||||
description?: string;
|
||||
url?: string;
|
||||
@@ -239,7 +236,6 @@ export interface APIEmbed {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#embed-object-embed-types
|
||||
*
|
||||
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
|
||||
* @deprecated API and Gateway v6 are deprecated and the types will not receive further updates, please update to v8.
|
||||
*/
|
||||
export enum EmbedType {
|
||||
|
||||
@@ -693,10 +693,6 @@ export interface APIEmbed {
|
||||
title?: string;
|
||||
/**
|
||||
* Type of embed (always "rich" for webhook embeds)
|
||||
*
|
||||
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object-embed-types
|
||||
*/
|
||||
type?: EmbedType;
|
||||
/**
|
||||
@@ -766,7 +762,6 @@ export interface APIEmbed {
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#embed-object-embed-types
|
||||
*
|
||||
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
|
||||
* @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10.
|
||||
*/
|
||||
export enum EmbedType {
|
||||
|
||||
26
payloads/v9/_interactions/_applicationCommands/entryPoint.ts
Normal file
26
payloads/v9/_interactions/_applicationCommands/entryPoint.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import type { APIApplicationCommandInteractionWrapper, ApplicationCommandType } from '../applicationCommands';
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from '../base';
|
||||
import type { APIBaseApplicationCommandInteractionData } from './internals';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data
|
||||
*/
|
||||
export type APIPrimaryEntryPointCommandInteractionData =
|
||||
APIBaseApplicationCommandInteractionData<ApplicationCommandType.PrimaryEntryPoint>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIPrimaryEntryPointCommandInteraction =
|
||||
APIApplicationCommandInteractionWrapper<APIPrimaryEntryPointCommandInteractionData>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIPrimaryEntryPointCommandDMInteraction = APIDMInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIPrimaryEntryPointCommandGuildInteraction =
|
||||
APIGuildInteractionWrapper<APIPrimaryEntryPointCommandInteraction>;
|
||||
@@ -13,12 +13,19 @@ import type {
|
||||
APIContextMenuInteraction,
|
||||
APIContextMenuInteractionData,
|
||||
} from './_applicationCommands/contextMenu';
|
||||
import type {
|
||||
APIPrimaryEntryPointCommandDMInteraction,
|
||||
APIPrimaryEntryPointCommandGuildInteraction,
|
||||
APIPrimaryEntryPointCommandInteraction,
|
||||
APIPrimaryEntryPointCommandInteractionData,
|
||||
} from './_applicationCommands/entryPoint';
|
||||
import type { APIBaseInteraction } from './base';
|
||||
import type { InteractionType } from './responses';
|
||||
|
||||
export * from './_applicationCommands/chatInput';
|
||||
export * from './_applicationCommands/contextMenu';
|
||||
export * from './_applicationCommands/permissions';
|
||||
export * from './_applicationCommands/entryPoint';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#application-command-object
|
||||
@@ -185,7 +192,8 @@ export enum EntryPointCommandHandlerType {
|
||||
*/
|
||||
export type APIApplicationCommandInteractionData =
|
||||
| APIChatInputApplicationCommandInteractionData
|
||||
| APIContextMenuInteractionData;
|
||||
| APIContextMenuInteractionData
|
||||
| APIPrimaryEntryPointCommandInteractionData;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
@@ -202,18 +210,23 @@ export type APIApplicationCommandInteractionWrapper<Data extends APIApplicationC
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandInteraction = APIChatInputApplicationCommandInteraction | APIContextMenuInteraction;
|
||||
export type APIApplicationCommandInteraction =
|
||||
| APIChatInputApplicationCommandInteraction
|
||||
| APIContextMenuInteraction
|
||||
| APIPrimaryEntryPointCommandInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandDMInteraction =
|
||||
| APIChatInputApplicationCommandDMInteraction
|
||||
| APIContextMenuDMInteraction;
|
||||
| APIContextMenuDMInteraction
|
||||
| APIPrimaryEntryPointCommandDMInteraction;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object
|
||||
*/
|
||||
export type APIApplicationCommandGuildInteraction =
|
||||
| APIChatInputApplicationCommandGuildInteraction
|
||||
| APIContextMenuGuildInteraction;
|
||||
| APIContextMenuGuildInteraction
|
||||
| APIPrimaryEntryPointCommandGuildInteraction;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9';
|
||||
import type { APIActionRowComponent, APIModalActionRowComponent } from '../channel';
|
||||
import type { MessageFlags } from '../index';
|
||||
import type { APIApplicationCommandOptionChoice } from './applicationCommands';
|
||||
|
||||
/**
|
||||
@@ -22,6 +21,7 @@ export type APIInteractionResponse =
|
||||
| APIInteractionResponseChannelMessageWithSource
|
||||
| APIInteractionResponseDeferredChannelMessageWithSource
|
||||
| APIInteractionResponseDeferredMessageUpdate
|
||||
| APIInteractionResponseLaunchActivity
|
||||
| APIInteractionResponsePong
|
||||
| APIInteractionResponseUpdateMessage
|
||||
| APIModalInteractionResponse
|
||||
@@ -64,6 +64,10 @@ export interface APIInteractionResponseUpdateMessage {
|
||||
data?: APIInteractionResponseCallbackData;
|
||||
}
|
||||
|
||||
export interface APIInteractionResponseLaunchActivity {
|
||||
type: InteractionResponseType.LaunchActivity;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-type
|
||||
*/
|
||||
@@ -115,10 +119,7 @@ export enum InteractionResponseType {
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object-interaction-callback-data-structure
|
||||
*/
|
||||
export type APIInteractionResponseCallbackData = Omit<
|
||||
RESTPostAPIWebhookWithTokenJSONBody,
|
||||
'avatar_url' | 'username'
|
||||
> & { flags?: MessageFlags };
|
||||
export type APIInteractionResponseCallbackData = Omit<RESTPostAPIWebhookWithTokenJSONBody, 'avatar_url' | 'username'>;
|
||||
|
||||
export interface APICommandAutocompleteInteractionResponseCallbackData {
|
||||
choices?: APIApplicationCommandOptionChoice[];
|
||||
|
||||
@@ -895,6 +895,10 @@ export enum MessageFlags {
|
||||
* This message is a voice message
|
||||
*/
|
||||
IsVoiceMessage = 1 << 13,
|
||||
/**
|
||||
* This message has a snapshot (via Message Forwarding)
|
||||
*/
|
||||
HasSnapshot = 1 << 14,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1129,10 +1133,6 @@ export interface APIEmbed {
|
||||
title?: string;
|
||||
/**
|
||||
* Type of embed (always "rich" for webhook embeds)
|
||||
*
|
||||
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object-embed-types
|
||||
*/
|
||||
type?: EmbedType;
|
||||
/**
|
||||
@@ -1201,8 +1201,6 @@ export interface APIEmbed {
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#embed-object-embed-types
|
||||
*
|
||||
* @deprecated *Embed types should be considered deprecated and might be removed in a future API version*
|
||||
*/
|
||||
export enum EmbedType {
|
||||
/**
|
||||
|
||||
@@ -281,6 +281,10 @@ export interface APIGuild extends APIPartialGuild {
|
||||
* The id of the channel where admins and moderators of Community guilds receive safety alerts from Discord
|
||||
*/
|
||||
safety_alerts_channel_id: Snowflake | null;
|
||||
/**
|
||||
* The incidents data for this guild
|
||||
*/
|
||||
incidents_data: APIIncidentsData | null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1152,3 +1156,22 @@ export enum GuildOnboardingPromptType {
|
||||
MultipleChoice,
|
||||
Dropdown,
|
||||
}
|
||||
|
||||
export interface APIIncidentsData {
|
||||
/**
|
||||
* When invites get enabled again
|
||||
*/
|
||||
invites_disabled_until: string | null;
|
||||
/**
|
||||
* When direct messages get enabled again
|
||||
*/
|
||||
dms_disabled_until: string | null;
|
||||
/**
|
||||
* When the dm spam was detected
|
||||
*/
|
||||
dm_spam_detected_at?: string | null;
|
||||
/**
|
||||
* When the raid was detected
|
||||
*/
|
||||
raid_detected_at?: string | null;
|
||||
}
|
||||
|
||||
@@ -33,13 +33,13 @@ export interface APIEntitlement {
|
||||
*/
|
||||
deleted: boolean;
|
||||
/**
|
||||
* Start date at which the entitlement is valid. Not present when using test entitlements.
|
||||
* Start date at which the entitlement is valid.
|
||||
*/
|
||||
starts_at?: string;
|
||||
starts_at: string | null;
|
||||
/**
|
||||
* Date at which the entitlement is no longer valid. Not present when using test entitlements.
|
||||
* Date at which the entitlement is no longer valid.
|
||||
*/
|
||||
ends_at?: string;
|
||||
ends_at: string | null;
|
||||
/**
|
||||
* For consumable items, whether or not the entitlement has been consumed
|
||||
*/
|
||||
@@ -177,6 +177,10 @@ export interface APISubscription {
|
||||
* List of entitlements granted for this subscription
|
||||
*/
|
||||
entitlement_ids: Snowflake[];
|
||||
/**
|
||||
* List of SKUs that this user will be subscribed to at renewal
|
||||
*/
|
||||
renewal_sku_ids: Snowflake[] | null;
|
||||
/**
|
||||
* Start of the current subscription period
|
||||
*/
|
||||
|
||||
@@ -275,6 +275,7 @@ export interface APIConnection {
|
||||
export enum ConnectionService {
|
||||
AmazonMusic = 'amazon-music',
|
||||
BattleNet = 'battlenet',
|
||||
Bluesky = 'bluesky',
|
||||
BungieNet = 'bungie',
|
||||
Crunchyroll = 'crunchyroll',
|
||||
Domain = 'domain',
|
||||
@@ -284,6 +285,7 @@ export enum ConnectionService {
|
||||
GitHub = 'github',
|
||||
Instagram = 'instagram',
|
||||
LeagueOfLegends = 'leagueoflegends',
|
||||
Mastodon = 'mastodon',
|
||||
PayPal = 'paypal',
|
||||
PlayStationNetwork = 'playstation',
|
||||
Reddit = 'reddit',
|
||||
|
||||
@@ -997,3 +997,17 @@ export type RESTAPIModifyGuildOnboardingPromptOptionData = RESTAPIGuildOnboardin
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-onboarding
|
||||
*/
|
||||
export type RESTPutAPIGuildOnboardingResult = APIGuildOnboarding;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-incidents-actions
|
||||
*/
|
||||
export interface RESTPutAPIGuildIncidentActionsJSONBody {
|
||||
/**
|
||||
* When invites will be enabled again
|
||||
*/
|
||||
invites_disabled_until?: string | undefined;
|
||||
/**
|
||||
* When direct messages will be enabled again
|
||||
*/
|
||||
dms_disabled_until?: string | undefined;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Snowflake } from '../../globals';
|
||||
import { urlSafeCharacters } from '../../utils/internals';
|
||||
|
||||
export * from '../common';
|
||||
export * from './application';
|
||||
@@ -932,6 +933,14 @@ export const Routes = {
|
||||
return `/guilds/${guildId}/onboarding` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - PUT `/guilds/${guild.id}/incident-actions`
|
||||
*/
|
||||
guildIncidentActions(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/incident-actions` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/applications/@me`
|
||||
@@ -1056,7 +1065,18 @@ export const Routes = {
|
||||
|
||||
for (const [key, fn] of Object.entries(Routes)) {
|
||||
Routes[key as keyof typeof Routes] = (...args: (boolean | number | string | undefined)[]) => {
|
||||
const escaped = args.map((arg) => arg && encodeURIComponent(arg));
|
||||
const escaped = args.map((arg) => {
|
||||
if (arg) {
|
||||
// Skip already "safe" urls
|
||||
if (urlSafeCharacters.test(String(arg))) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
return encodeURIComponent(arg);
|
||||
}
|
||||
|
||||
return arg;
|
||||
});
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
@@ -1363,8 +1383,19 @@ export const CDNRoutes = {
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(CDNRoutes)) {
|
||||
CDNRoutes[key as keyof typeof CDNRoutes] = (...args: (number | string | undefined)[]) => {
|
||||
const escaped = args.map((arg) => arg && encodeURIComponent(arg));
|
||||
CDNRoutes[key as keyof typeof CDNRoutes] = (...args: (boolean | number | string | undefined)[]) => {
|
||||
const escaped = args.map((arg) => {
|
||||
if (arg) {
|
||||
// Skip already "safe" urls
|
||||
if (urlSafeCharacters.test(String(arg))) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
return encodeURIComponent(arg);
|
||||
}
|
||||
|
||||
return arg;
|
||||
});
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
|
||||
@@ -83,12 +83,21 @@ export interface RESTPostAPIContextMenuApplicationCommandsJSONBody extends RESTP
|
||||
type: ApplicationCommandType.Message | ApplicationCommandType.User;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
|
||||
*/
|
||||
export interface RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody
|
||||
extends RESTPostAPIBaseApplicationCommandsJSONBody {
|
||||
type: ApplicationCommandType.PrimaryEntryPoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
|
||||
*/
|
||||
export type RESTPostAPIApplicationCommandsJSONBody =
|
||||
| RESTPostAPIChatInputApplicationCommandsJSONBody
|
||||
| RESTPostAPIContextMenuApplicationCommandsJSONBody;
|
||||
| RESTPostAPIContextMenuApplicationCommandsJSONBody
|
||||
| RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { urlSafeCharacters } from '../../utils/internals';
|
||||
|
||||
export * from '../common';
|
||||
|
||||
export * from './auditLog';
|
||||
@@ -521,8 +523,19 @@ export const Routes = {
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(Routes)) {
|
||||
Routes[key] = (...args: string[]) => {
|
||||
const escaped = args.map((arg) => encodeURIComponent(arg));
|
||||
Routes[key] = (...args: (boolean | number | string | undefined)[]) => {
|
||||
const escaped = args.map((arg) => {
|
||||
if (arg) {
|
||||
// Skip already "safe" urls
|
||||
if (urlSafeCharacters.test(String(arg))) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
return encodeURIComponent(arg);
|
||||
}
|
||||
|
||||
return arg;
|
||||
});
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Snowflake } from '../../globals';
|
||||
import { urlSafeCharacters } from '../../utils/internals';
|
||||
|
||||
export * from '../common';
|
||||
|
||||
@@ -778,8 +779,19 @@ export const Routes = {
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(Routes)) {
|
||||
Routes[key] = (...args: string[]) => {
|
||||
const escaped = args.map((arg) => encodeURIComponent(arg));
|
||||
Routes[key] = (...args: (boolean | number | string | undefined)[]) => {
|
||||
const escaped = args.map((arg) => {
|
||||
if (arg) {
|
||||
// Skip already "safe" urls
|
||||
if (urlSafeCharacters.test(String(arg))) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
return encodeURIComponent(arg);
|
||||
}
|
||||
|
||||
return arg;
|
||||
});
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
|
||||
@@ -1003,3 +1003,17 @@ export type RESTAPIModifyGuildOnboardingPromptOptionData = RESTAPIGuildOnboardin
|
||||
* https://discord.com/developers/docs/resources/guild#modify-guild-onboarding
|
||||
*/
|
||||
export type RESTPutAPIGuildOnboardingResult = APIGuildOnboarding;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#modify-incidents-actions
|
||||
*/
|
||||
export interface RESTPutAPIGuildIncidentActionsJSONBody {
|
||||
/**
|
||||
* When invites will be enabled again
|
||||
*/
|
||||
invites_disabled_until?: string | undefined;
|
||||
/**
|
||||
* When direct messages will be enabled again
|
||||
*/
|
||||
dms_disabled_until?: string | undefined;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Snowflake } from '../../globals';
|
||||
import { urlSafeCharacters } from '../../utils/internals';
|
||||
|
||||
export * from '../common';
|
||||
export * from './application';
|
||||
@@ -941,6 +942,14 @@ export const Routes = {
|
||||
return `/guilds/${guildId}/onboarding` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - PUT `/guilds/${guild.id}/incident-actions`
|
||||
*/
|
||||
guildIncidentActions(guildId: Snowflake) {
|
||||
return `/guilds/${guildId}/incident-actions` as const;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/applications/@me`
|
||||
@@ -1065,7 +1074,18 @@ export const Routes = {
|
||||
|
||||
for (const [key, fn] of Object.entries(Routes)) {
|
||||
Routes[key as keyof typeof Routes] = (...args: (boolean | number | string | undefined)[]) => {
|
||||
const escaped = args.map((arg) => arg && encodeURIComponent(arg));
|
||||
const escaped = args.map((arg) => {
|
||||
if (arg) {
|
||||
// Skip already "safe" urls
|
||||
if (urlSafeCharacters.test(String(arg))) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
return encodeURIComponent(arg);
|
||||
}
|
||||
|
||||
return arg;
|
||||
});
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
@@ -1372,8 +1392,19 @@ export const CDNRoutes = {
|
||||
};
|
||||
|
||||
for (const [key, fn] of Object.entries(CDNRoutes)) {
|
||||
CDNRoutes[key as keyof typeof CDNRoutes] = (...args: (number | string | undefined)[]) => {
|
||||
const escaped = args.map((arg) => arg && encodeURIComponent(arg));
|
||||
CDNRoutes[key as keyof typeof CDNRoutes] = (...args: (boolean | number | string | undefined)[]) => {
|
||||
const escaped = args.map((arg) => {
|
||||
if (arg) {
|
||||
// Skip already "safe" urls
|
||||
if (urlSafeCharacters.test(String(arg))) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
return encodeURIComponent(arg);
|
||||
}
|
||||
|
||||
return arg;
|
||||
});
|
||||
// eslint-disable-next-line no-useless-call
|
||||
return fn.call(null, ...escaped);
|
||||
};
|
||||
@@ -1398,8 +1429,8 @@ export type ApplicationCoverFormat = Exclude<ImageFormat, ImageFormat.GIF | Imag
|
||||
export type ApplicationAssetFormat = Exclude<ImageFormat, ImageFormat.GIF | ImageFormat.Lottie>;
|
||||
export type AchievementIconFormat = Exclude<ImageFormat, ImageFormat.GIF | ImageFormat.Lottie>;
|
||||
export type StickerPackBannerFormat = Exclude<ImageFormat, ImageFormat.GIF | ImageFormat.Lottie>;
|
||||
export type StorePageAssetFormat = Exclude<ImageFormat, ImageFormat.GIF | ImageFormat.Lottie>;
|
||||
export type TeamIconFormat = Exclude<ImageFormat, ImageFormat.GIF | ImageFormat.Lottie>;
|
||||
export type StorePageAssetFormat = Exclude<ImageFormat, ImageFormat.GIF | ImageFormat.Lottie>;
|
||||
export type StickerFormat = Extract<ImageFormat, ImageFormat.GIF | ImageFormat.Lottie | ImageFormat.PNG>;
|
||||
export type RoleIconFormat = Exclude<ImageFormat, ImageFormat.GIF | ImageFormat.Lottie>;
|
||||
export type GuildScheduledEventCoverFormat = Exclude<ImageFormat, ImageFormat.GIF | ImageFormat.Lottie>;
|
||||
@@ -1417,6 +1448,7 @@ export interface CDNQuery {
|
||||
export const RouteBases = {
|
||||
api: `https://discord.com/api/v${APIVersion}`,
|
||||
cdn: 'https://cdn.discordapp.com',
|
||||
media: 'https://media.discordapp.net',
|
||||
invite: 'https://discord.gg',
|
||||
template: 'https://discord.new',
|
||||
gift: 'https://discord.gift',
|
||||
|
||||
@@ -83,12 +83,21 @@ export interface RESTPostAPIContextMenuApplicationCommandsJSONBody extends RESTP
|
||||
type: ApplicationCommandType.Message | ApplicationCommandType.User;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
|
||||
*/
|
||||
export interface RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody
|
||||
extends RESTPostAPIBaseApplicationCommandsJSONBody {
|
||||
type: ApplicationCommandType.PrimaryEntryPoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
|
||||
*/
|
||||
export type RESTPostAPIApplicationCommandsJSONBody =
|
||||
| RESTPostAPIChatInputApplicationCommandsJSONBody
|
||||
| RESTPostAPIContextMenuApplicationCommandsJSONBody;
|
||||
| RESTPostAPIContextMenuApplicationCommandsJSONBody
|
||||
| RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
|
||||
|
||||
@@ -1,25 +1,11 @@
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
import { execSync } from 'node:child_process';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import process from 'node:process';
|
||||
import { Octokit } from '@octokit/action';
|
||||
|
||||
const octokit = new Octokit();
|
||||
const [OWNER, REPOSITORY] = process.env.GITHUB_REPOSITORY.split('/');
|
||||
|
||||
const commitUrl = `https://github.com/${OWNER}/${REPOSITORY}/commit/${process.env.GITHUB_SHA}`;
|
||||
|
||||
/** @type {import('@octokit/webhooks-types').PullRequestOpenedEvent | import('@octokit/webhooks-types').PullRequestSynchronizeEvent} */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const prEvent = JSON.parse(await readFile(process.env.GITHUB_EVENT_PATH, 'utf8'));
|
||||
|
||||
const {
|
||||
pull_request: {
|
||||
number,
|
||||
user: { login },
|
||||
},
|
||||
} = prEvent;
|
||||
|
||||
console.info(`👀 Verifying that deno types are up to date with commit ${process.env.GITHUB_SHA}`);
|
||||
console.debug('Running build:deno script');
|
||||
execSync(`npm run build:deno`);
|
||||
@@ -32,23 +18,6 @@ const diff = execSync(`git diff --name-only ${process.env.GITHUB_SHA}`)
|
||||
|
||||
if (!diff.length) {
|
||||
console.info('✅ Nothing to do here!');
|
||||
const allReviews = await octokit.pulls.listReviews({
|
||||
owner: OWNER,
|
||||
pull_number: number,
|
||||
repo: REPOSITORY,
|
||||
});
|
||||
|
||||
const lastReviewByBot = allReviews.data.filter((item) => item.user?.id === 41_898_282).at(-1);
|
||||
|
||||
if (lastReviewByBot?.state === 'CHANGES_REQUESTED') {
|
||||
await octokit.pulls.dismissReview({
|
||||
owner: OWNER,
|
||||
repo: REPOSITORY,
|
||||
pull_number: number,
|
||||
message: 'No longer applicable as deno types are in sync once again! 🎉',
|
||||
review_id: lastReviewByBot.id,
|
||||
});
|
||||
}
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
@@ -56,15 +25,15 @@ if (!diff.length) {
|
||||
console.debug(`⚠️ Found ${diff.length} different files.`, { diff });
|
||||
|
||||
const messageBody = [
|
||||
`Hey @${login}! Taking a look at commit ${commitUrl}, it seems that you forgot to run \`npm run build:deno\`. Here are the files that are different from the base:`,
|
||||
`Taking a look at commit ${commitUrl}, it seems that you forgot to run \`npm run build:deno\`. Here are the files that are different from the base:`,
|
||||
'',
|
||||
];
|
||||
|
||||
for (const file of diff) {
|
||||
messageBody.push(
|
||||
`- [Node: \`${file.slice(5)}\`](https://github.com/${process.env.GITHUB_REPOSITORY}/blob/${
|
||||
`- \`${file.slice(5)}\`: Node (https://github.com/${process.env.GITHUB_REPOSITORY}/blob/${
|
||||
process.env.GITHUB_SHA
|
||||
}/${file.slice(5)}) - [Deno: \`${file}\`](https://github.com/${process.env.GITHUB_REPOSITORY}/blob/${
|
||||
}/${file.slice(5)}) - Deno (https://github.com/${process.env.GITHUB_REPOSITORY}/blob/${
|
||||
process.env.GITHUB_SHA
|
||||
}/${file})`,
|
||||
);
|
||||
@@ -72,13 +41,7 @@ for (const file of diff) {
|
||||
|
||||
messageBody.push('', 'Please run `npm run build:deno` and commit the results to update the deno types.');
|
||||
|
||||
console.info('🔈 Requesting changes in the pull request');
|
||||
await octokit.pulls.createReview({
|
||||
event: 'REQUEST_CHANGES',
|
||||
body: messageBody.join('\n'),
|
||||
owner: OWNER,
|
||||
repo: REPOSITORY,
|
||||
pull_number: number,
|
||||
});
|
||||
console.error('❌ Deno types are not up to date with the commit!');
|
||||
console.error(messageBody.join('\n'));
|
||||
|
||||
console.info('✅ Done!');
|
||||
process.exit(1);
|
||||
|
||||
26
tests/v10/routes-escaping.ts
Normal file
26
tests/v10/routes-escaping.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { strictEqual } from 'node:assert';
|
||||
import { Routes } from '../../v10';
|
||||
|
||||
const channelId = '1320466398597615666';
|
||||
const messageId = '1320622300642545705';
|
||||
|
||||
const expected = `/channels/${channelId}/messages/${messageId}/reactions/%F0%9F%95%99/@me`;
|
||||
|
||||
// Run multiple times to ensure that the validation isn't intermittent
|
||||
strictEqual(Routes.channelMessageOwnReaction(channelId, messageId, '%F0%9F%95%99'), expected);
|
||||
strictEqual(Routes.channelMessageOwnReaction(channelId, messageId, '%F0%9F%95%99'), expected);
|
||||
strictEqual(Routes.channelMessageOwnReaction(channelId, messageId, '%F0%9F%95%99'), expected);
|
||||
|
||||
// make sure that the emoji is properly encoded
|
||||
const emoji = '🕙';
|
||||
|
||||
strictEqual(Routes.channelMessageOwnReaction(channelId, messageId, emoji), expected);
|
||||
|
||||
// test custom emojis too
|
||||
const animated = '1_:1234567890';
|
||||
const encodedExpected = '1_%3A1234567890';
|
||||
|
||||
const expected2 = `/channels/${channelId}/messages/${messageId}/reactions/${encodedExpected}/@me`;
|
||||
|
||||
strictEqual(Routes.channelMessageOwnReaction(channelId, messageId, animated), expected2);
|
||||
strictEqual(Routes.channelMessageOwnReaction(channelId, messageId, encodedExpected), expected2);
|
||||
@@ -39,3 +39,16 @@ export type DistributiveOmit<T, K extends DistributiveKeys<T>> =
|
||||
T extends unknown ? { [P in keyof Omit_<T, K>]: Omit_<T, K>[P] } : never;
|
||||
|
||||
type Omit_<T, K> = Omit<T, Extract<keyof T, K>>;
|
||||
|
||||
// eslint-disable-next-line unicorn/better-regex
|
||||
const pattern = /^[\d%A-Za-z-_]+$/g;
|
||||
|
||||
export const urlSafeCharacters = {
|
||||
test(input: string) {
|
||||
const result = pattern.test(input);
|
||||
|
||||
pattern.lastIndex = 0;
|
||||
|
||||
return result;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -106,4 +106,8 @@ export enum VoiceCloseCodes {
|
||||
* We didn't recognize your encryption
|
||||
*/
|
||||
UnknownEncryptionMode,
|
||||
/**
|
||||
* You sent a malformed request
|
||||
*/
|
||||
BadRequest = 4_020,
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"root": true,
|
||||
"extends": ["neon/common", "neon/node", "neon/typescript", "neon/react", "neon/jsx", "neon/jsx-a11y", "neon/prettier"],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2020,
|
||||
"ecmaVersion": 2022,
|
||||
"sourceType": "module",
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
@@ -28,6 +28,9 @@
|
||||
"rules": {
|
||||
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
||||
"import/extensions": "off",
|
||||
"no-restricted-globals": "off"
|
||||
"no-restricted-globals": "off",
|
||||
"tsdoc/syntax": "off",
|
||||
"@typescript-eslint/unbound-method": "off",
|
||||
"import/order": "off"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,12 +28,52 @@ Discord API Types is a community-maintained project that brings API types for Di
|
||||
|
||||
## Installation
|
||||
|
||||
Install with [`npm`](https://www.npmjs.com/) / [`yarn`](https://yarnpkg.com) / [`pnpm`](https://pnpm.js.org/):
|
||||
Install with [`npm`](https://www.npmjs.com/) / [`yarn`](https://yarnpkg.com) / [`pnpm`](https://pnpm.js.org/) /
|
||||
[`bun`](https://bun.sh/) / [`deno`](https://deno.land/):
|
||||
|
||||
```bash npm2yarn2pnpm
|
||||
<Tabs groupId="npm2yarn2pnpm">
|
||||
<TabItem value="npm" label="npm">
|
||||
|
||||
```bash
|
||||
npm install discord-api-types
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="yarn" label="yarn">
|
||||
|
||||
```bash
|
||||
yarn add discord-api-types
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="pnpm" label="pnpm">
|
||||
|
||||
```bash
|
||||
pnpm add discord-api-types
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bun" label="bun">
|
||||
|
||||
```bash
|
||||
bun add discord-api-types
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="deno" label="deno">
|
||||
|
||||
```bash
|
||||
deno install npm:discord-api-types
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Usage
|
||||
|
||||
You can only import this module by specifying the API version you want to target. Append `/v*` to the import path, where
|
||||
|
||||
@@ -1,255 +0,0 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
|
||||
const { join } = require('node:path');
|
||||
const { npm2yarn2pnpm } = require('@sapphire/docusaurus-plugin-npm2yarn2pnpm');
|
||||
const { ts2esm2cjs } = require('@sapphire/docusaurus-plugin-ts2esm2cjs');
|
||||
const lightCodeTheme = require('prism-react-renderer/themes/github');
|
||||
const darkCodeTheme = require('prism-react-renderer/themes/vsDark');
|
||||
|
||||
/** @type {string[]} */
|
||||
const versions = require('./versions.json');
|
||||
|
||||
const Description = "discord-api-types is a simple Node/Deno module that brings up to date typings for Discord's API";
|
||||
const BaseUrl = 'https://discord-api-types.dev';
|
||||
const Email = 'vlad@discord-api-types.dev';
|
||||
const Title = 'discord-api-types documentation';
|
||||
|
||||
/** @type {import('@docusaurus/types').Config} */
|
||||
const config = {
|
||||
title: 'discord-api-types documentation',
|
||||
url: BaseUrl,
|
||||
baseUrl: '/',
|
||||
onBrokenLinks: 'throw',
|
||||
onBrokenMarkdownLinks: 'throw',
|
||||
onDuplicateRoutes: 'throw',
|
||||
favicon: '/favicon.ico',
|
||||
tagline: Description,
|
||||
organizationName: 'discordjs',
|
||||
projectName: 'discord-api-types',
|
||||
|
||||
themes: [],
|
||||
|
||||
plugins: [
|
||||
'docusaurus-plugin-sass',
|
||||
[
|
||||
'@docusaurus/plugin-pwa',
|
||||
{
|
||||
offlineModeActivationStrategies: ['appInstalled', 'standalone', 'queryString'],
|
||||
pwaHead: [
|
||||
{
|
||||
tagName: 'link',
|
||||
rel: 'icon',
|
||||
href: '/android-chrome-192x192.png'
|
||||
},
|
||||
{
|
||||
tagName: 'link',
|
||||
rel: 'manifest',
|
||||
href: '/manifest.webmanifest'
|
||||
},
|
||||
{
|
||||
tagName: 'meta',
|
||||
name: 'theme-color',
|
||||
content: '#2563EB'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
'docusaurus-plugin-typedoc-api',
|
||||
/** @type {Parameters<import('docusaurus-plugin-typedoc-api')['default']>[1]} */ ({
|
||||
projectRoot: join(__dirname, '../'),
|
||||
packages: [
|
||||
{
|
||||
path: './',
|
||||
entry: {
|
||||
v10: { path: 'v10.ts', label: 'API v10' },
|
||||
v9: { path: 'v9.ts', label: 'API v9' },
|
||||
'voice/v4': { path: 'voice/v4.ts', label: 'Voice v4' },
|
||||
globals: { path: 'globals.ts', label: 'Global Types' },
|
||||
},
|
||||
slug: 'discord-api-types'
|
||||
}
|
||||
],
|
||||
gitRefName: 'main',
|
||||
})
|
||||
]
|
||||
],
|
||||
|
||||
presets: [
|
||||
[
|
||||
'@docusaurus/preset-classic',
|
||||
/** @type {import('@docusaurus/preset-classic').Options} */
|
||||
({
|
||||
docs: {
|
||||
sidebarPath: require.resolve('./sidebars.js'),
|
||||
showLastUpdateAuthor: false,
|
||||
showLastUpdateTime: false,
|
||||
remarkPlugins: [npm2yarn2pnpm, ts2esm2cjs]
|
||||
},
|
||||
blog: false,
|
||||
theme: {
|
||||
customCss: [
|
||||
require.resolve('./src/css/custom.scss'),
|
||||
require.resolve('./src/css/tippy-discord.css'),
|
||||
require.resolve('./src/css/discordjs.scss'),
|
||||
require.resolve('./src/css/font.scss')
|
||||
]
|
||||
}
|
||||
})
|
||||
]
|
||||
],
|
||||
|
||||
themeConfig:
|
||||
/** @type {Partial<import('@docusaurus/preset-classic').ThemeConfig>} */
|
||||
({
|
||||
image: 'https://discord-api-types.dev/opengraph.png',
|
||||
colorMode: {
|
||||
defaultMode: 'dark',
|
||||
respectPrefersColorScheme: true
|
||||
},
|
||||
metadata: [
|
||||
// Tags from realfavicongenerator
|
||||
{ name: 'apple-mobile-web-app-title', content: Title },
|
||||
{ name: 'application-name', content: Title },
|
||||
{ name: 'msapplication-TileColor', content: '#2563EB' },
|
||||
{ name: 'msapplication-TileImage', content: '/mstile-144x144.png' },
|
||||
{ name: 'theme-color', content: '#2563EB' },
|
||||
|
||||
{ name: 'apple-mobile-web-app-capable', content: 'yes' },
|
||||
{ name: 'apple-mobile-web-app-status-bar-style', content: 'black' },
|
||||
{ name: 'audience', content: 'all' },
|
||||
{ name: 'author', content: `Vlad Frangu, ${Email}` },
|
||||
{ name: 'coverage', content: 'Worldwide' },
|
||||
{ name: 'description', content: Description },
|
||||
{ name: 'designer', content: `Vlad Frangu, ${Email}` },
|
||||
{ name: 'distribution', content: 'Global' },
|
||||
{ name: 'googlebot', content: 'index,follow' },
|
||||
{ name: 'HandheldFriendly', content: 'True' },
|
||||
{ name: 'identifier-URL', content: BaseUrl },
|
||||
{ name: 'keywords', content: 'discord, bot, discord api, documentation, guide, discord-api-types' },
|
||||
{ name: 'msapplication-config', content: '/browserconfig.xml' },
|
||||
{ name: 'owner', content: `Vlad Frangu, ${Email}` },
|
||||
{ name: 'rating', content: 'safe for kids' },
|
||||
{ name: 'reply-to', content: Email },
|
||||
{ name: 'revisit-after', content: '7 days' },
|
||||
{ name: 'robots', content: 'archive,follow,imageindex,index,odp,snippet,translate' },
|
||||
{ name: 'shortlink', content: BaseUrl },
|
||||
{ name: 'subject', content: 'Documentation website for discord-api-types' },
|
||||
{ name: 'summary', content: Description },
|
||||
{ name: 'target', content: 'all' },
|
||||
{ name: 'twitter:card', content: 'summary_large_image' },
|
||||
{ name: 'twitter:creator', content: '@WolfgalVlad' },
|
||||
{ name: 'twitter:site', content: '@WolfgalVlad' },
|
||||
{ name: 'twitter:title', content: 'discord-api-types - Imagine typings' },
|
||||
{ name: 'twitter:description', content: Description },
|
||||
{ name: 'url', content: BaseUrl },
|
||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
||||
{ property: 'og:description', content: Description },
|
||||
{ property: 'og:email', content: Email },
|
||||
{ property: 'og:image:alt', content: 'OpenGraphImage' },
|
||||
{ property: 'og:image:height', content: '512' },
|
||||
{ property: 'og:image:width', content: '1024' },
|
||||
{ property: 'og:locale', content: 'en_US' },
|
||||
{ property: 'og:site_name', content: Title },
|
||||
{ property: 'og:title', content: 'discord-api-types - Imagine typings' },
|
||||
{ property: 'og:type', content: 'article' },
|
||||
{ property: 'og:url', content: BaseUrl }
|
||||
],
|
||||
navbar: {
|
||||
logo: {
|
||||
src: '/svgs/mini_logo.svg'
|
||||
},
|
||||
items: [
|
||||
{
|
||||
to: '/',
|
||||
label: 'discord-api-types',
|
||||
position: 'left',
|
||||
activeBaseRegex: '^/$'
|
||||
},
|
||||
{
|
||||
to: 'docs/introduction_to_discord-api-types',
|
||||
label: 'Introduction to the module',
|
||||
position: 'left'
|
||||
},
|
||||
{
|
||||
type: 'dropdown',
|
||||
to: 'api',
|
||||
label: 'API',
|
||||
position: 'left',
|
||||
items: [
|
||||
{ label: versions.length === 0 ? 'Development Time' : 'next 🚧', to: versions.length === 0 ? 'api' : 'api/next' },
|
||||
...versions.map((version, i) => ({
|
||||
activeBaseRegex: `api/(${version}/)${i === 0 ? '?' : ''}discord-api-types.*`,
|
||||
label: version,
|
||||
to: i === 0 ? 'api' : `api/${version}`
|
||||
}))
|
||||
]
|
||||
},
|
||||
|
||||
// Right
|
||||
{
|
||||
href: 'https://github.com/discordjs/discord-api-types',
|
||||
position: 'right',
|
||||
className: 'header-github-link',
|
||||
'aria-label': 'GitHub repository',
|
||||
label: 'GitHub'
|
||||
}
|
||||
]
|
||||
},
|
||||
footer: {
|
||||
style: 'dark',
|
||||
logo: {
|
||||
alt: 'Powered By Vercel',
|
||||
src: '/powered-by-vercel.svg',
|
||||
href: 'https://vercel.com/?utm_source=discordjs&utm_campaign=oss'
|
||||
},
|
||||
links: [
|
||||
{
|
||||
title: 'Donate',
|
||||
items: [
|
||||
{
|
||||
label: 'Ko-fi',
|
||||
href: 'https://discord-api-types.dev/kofi'
|
||||
},
|
||||
{
|
||||
label: 'Patreon',
|
||||
href: 'https://discord-api-types.dev/patreon'
|
||||
},
|
||||
{
|
||||
label: 'GitHub Sponsors',
|
||||
href: 'https://discord-api-types.dev/sponsor'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Our Platforms',
|
||||
items: [
|
||||
{
|
||||
label: 'Discord Server',
|
||||
href: 'https://discord-api-types.dev/discord'
|
||||
},
|
||||
{
|
||||
label: 'GitHub Organization',
|
||||
href: 'https://discord-api-types.dev/ghorg'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
copyright: `Copyright © 2021 - ${new Date().getFullYear()} The discord.js Community and its contributors.`
|
||||
},
|
||||
prism: {
|
||||
defaultLanguage: 'typescript',
|
||||
theme: lightCodeTheme,
|
||||
darkTheme: darkCodeTheme,
|
||||
additionalLanguages: ['powershell', 'batch']
|
||||
},
|
||||
algolia: {
|
||||
appId: 'TR1O0DBFL9',
|
||||
apiKey: '6822440beca69053ab122881d75064dc',
|
||||
indexName: 'discord-api-types',
|
||||
contextualSearch: true
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
280
website/docusaurus.config.ts
Normal file
280
website/docusaurus.config.ts
Normal file
@@ -0,0 +1,280 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
|
||||
import type { Config } from '@docusaurus/types';
|
||||
import type * as Preset from '@docusaurus/preset-classic';
|
||||
import type typedocPluginFunction from '@apify/docusaurus-plugin-typedoc-api/src/index.ts';
|
||||
// import type { Options as RedirectOptions } from '@docusaurus/plugin-client-redirects';
|
||||
import { convertNpmToPackageManagers } from '@sapphire/docusaurus-plugin-npm2yarn2pnpm';
|
||||
import { ts2esm2cjs } from '@sapphire/docusaurus-plugin-ts2esm2cjs';
|
||||
import { themes } from 'prism-react-renderer';
|
||||
import { URL, fileURLToPath } from 'node:url';
|
||||
|
||||
import versions from './versions.json' with { type: 'json' };
|
||||
|
||||
const { github: lightCodeTheme, vsDark: darkCodeTheme } = themes;
|
||||
|
||||
type TypedocPluginOptions = Parameters<typeof typedocPluginFunction>[1];
|
||||
|
||||
const Description = "discord-api-types is a simple Node/Deno module that brings up to date typings for Discord's API";
|
||||
const BaseUrl = 'https://discord-api-types.dev';
|
||||
const Email = 'vlad@discord-api-types.dev';
|
||||
const Title = 'discord-api-types documentation';
|
||||
|
||||
const defaultApiVersion = 'v10';
|
||||
|
||||
const config: Config = {
|
||||
title: 'discord-api-types documentation',
|
||||
url: BaseUrl,
|
||||
baseUrl: '/',
|
||||
// Banner at the top of `/api/next` route redirects to the wrong URL
|
||||
onBrokenLinks: 'warn',
|
||||
onBrokenMarkdownLinks: 'throw',
|
||||
onDuplicateRoutes: 'throw',
|
||||
favicon: '/favicon.ico',
|
||||
tagline: Description,
|
||||
organizationName: 'discordjs',
|
||||
projectName: 'discord-api-types',
|
||||
|
||||
themes: [],
|
||||
|
||||
plugins: [
|
||||
'docusaurus-plugin-sass',
|
||||
[
|
||||
'@docusaurus/plugin-pwa',
|
||||
{
|
||||
offlineModeActivationStrategies: ['appInstalled', 'standalone', 'queryString'],
|
||||
pwaHead: [
|
||||
{
|
||||
tagName: 'link',
|
||||
rel: 'icon',
|
||||
href: '/android-chrome-192x192.png'
|
||||
},
|
||||
{
|
||||
tagName: 'link',
|
||||
rel: 'manifest',
|
||||
href: '/manifest.webmanifest'
|
||||
},
|
||||
{
|
||||
tagName: 'meta',
|
||||
name: 'theme-color',
|
||||
content: '#2563EB'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
[
|
||||
'@apify/docusaurus-plugin-typedoc-api',
|
||||
{
|
||||
projectRoot: fileURLToPath(new URL('../', import.meta.url)),
|
||||
packages: [
|
||||
{
|
||||
path: './',
|
||||
entry: {
|
||||
v10: { path: 'v10.ts', label: 'API v10' },
|
||||
v9: { path: 'v9.ts', label: 'API v9' },
|
||||
'voice/v4': { path: 'voice/v4.ts', label: 'Voice v4' },
|
||||
globals: { path: 'globals.ts', label: 'Global Types' }
|
||||
},
|
||||
slug: 'discord-api-types'
|
||||
}
|
||||
],
|
||||
gitRefName: 'main',
|
||||
rehypePlugins: [],
|
||||
remarkPlugins: []
|
||||
} satisfies Partial<TypedocPluginOptions>
|
||||
]
|
||||
// [
|
||||
// '@docusaurus/plugin-client-redirects',
|
||||
// {
|
||||
// redirects: [
|
||||
// {
|
||||
// from: '/api',
|
||||
// to: `/api/discord-api-types-${defaultApiVersion}`
|
||||
// }
|
||||
// ]
|
||||
// } satisfies RedirectOptions
|
||||
// ]
|
||||
],
|
||||
|
||||
presets: [
|
||||
[
|
||||
'@docusaurus/preset-classic',
|
||||
{
|
||||
docs: {
|
||||
sidebarPath: './sidebars.ts',
|
||||
showLastUpdateAuthor: false,
|
||||
showLastUpdateTime: false,
|
||||
remarkPlugins: [convertNpmToPackageManagers, ts2esm2cjs]
|
||||
},
|
||||
blog: false,
|
||||
theme: {
|
||||
customCss: [
|
||||
require.resolve('./src/css/custom.scss'),
|
||||
require.resolve('./src/css/tippy-discord.css'),
|
||||
require.resolve('./src/css/discordjs.scss'),
|
||||
require.resolve('./src/css/font.scss')
|
||||
]
|
||||
}
|
||||
} satisfies Preset.Options
|
||||
]
|
||||
],
|
||||
|
||||
themeConfig: {
|
||||
image: 'https://discord-api-types.dev/opengraph.png',
|
||||
colorMode: {
|
||||
defaultMode: 'dark',
|
||||
respectPrefersColorScheme: true
|
||||
},
|
||||
metadata: [
|
||||
// Tags from realfavicongenerator
|
||||
{ name: 'apple-mobile-web-app-title', content: Title },
|
||||
{ name: 'application-name', content: Title },
|
||||
{ name: 'msapplication-TileColor', content: '#2563EB' },
|
||||
{ name: 'msapplication-TileImage', content: '/mstile-144x144.png' },
|
||||
{ name: 'theme-color', content: '#2563EB' },
|
||||
|
||||
{ name: 'apple-mobile-web-app-capable', content: 'yes' },
|
||||
{ name: 'mobile-web-app-capable', content: 'yes' },
|
||||
{ name: 'apple-mobile-web-app-status-bar-style', content: 'black' },
|
||||
{ name: 'audience', content: 'all' },
|
||||
{ name: 'author', content: `Vlad Frangu, ${Email}` },
|
||||
{ name: 'coverage', content: 'Worldwide' },
|
||||
{ name: 'description', content: Description },
|
||||
{ name: 'designer', content: `Vlad Frangu, ${Email}` },
|
||||
{ name: 'distribution', content: 'Global' },
|
||||
{ name: 'googlebot', content: 'index,follow' },
|
||||
{ name: 'HandheldFriendly', content: 'True' },
|
||||
{ name: 'identifier-URL', content: BaseUrl },
|
||||
{ name: 'keywords', content: 'discord, bot, discord api, documentation, guide, discord-api-types' },
|
||||
{ name: 'msapplication-config', content: '/browserconfig.xml' },
|
||||
{ name: 'owner', content: `Vlad Frangu, ${Email}` },
|
||||
{ name: 'rating', content: 'safe for kids' },
|
||||
{ name: 'reply-to', content: Email },
|
||||
{ name: 'revisit-after', content: '7 days' },
|
||||
{ name: 'robots', content: 'archive,follow,imageindex,index,odp,snippet,translate' },
|
||||
{ name: 'shortlink', content: BaseUrl },
|
||||
{ name: 'subject', content: 'Documentation website for discord-api-types' },
|
||||
{ name: 'summary', content: Description },
|
||||
{ name: 'target', content: 'all' },
|
||||
{ name: 'twitter:card', content: 'summary_large_image' },
|
||||
{ name: 'twitter:creator', content: '@WolfgalVlad' },
|
||||
{ name: 'twitter:site', content: '@WolfgalVlad' },
|
||||
{ name: 'twitter:title', content: 'discord-api-types - Imagine typings' },
|
||||
{ name: 'twitter:description', content: Description },
|
||||
{ name: 'url', content: BaseUrl },
|
||||
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
||||
{ property: 'og:description', content: Description },
|
||||
{ property: 'og:email', content: Email },
|
||||
{ property: 'og:image:alt', content: 'OpenGraphImage' },
|
||||
{ property: 'og:image:height', content: '512' },
|
||||
{ property: 'og:image:width', content: '1024' },
|
||||
{ property: 'og:locale', content: 'en_US' },
|
||||
{ property: 'og:site_name', content: Title },
|
||||
{ property: 'og:title', content: 'discord-api-types - Imagine typings' },
|
||||
{ property: 'og:type', content: 'article' },
|
||||
{ property: 'og:url', content: BaseUrl }
|
||||
],
|
||||
navbar: {
|
||||
logo: {
|
||||
src: '/svgs/mini_logo.svg'
|
||||
},
|
||||
items: [
|
||||
{
|
||||
to: '/',
|
||||
label: 'discord-api-types',
|
||||
position: 'left',
|
||||
activeBaseRegex: '^/$'
|
||||
},
|
||||
{
|
||||
to: 'docs/introduction_to_discord-api-types',
|
||||
label: 'Introduction to the module',
|
||||
position: 'left'
|
||||
},
|
||||
{
|
||||
type: 'dropdown',
|
||||
to: `api/discord-api-types-${defaultApiVersion}`,
|
||||
label: 'API',
|
||||
position: 'left',
|
||||
items: [
|
||||
{
|
||||
label: versions.length === 0 ? 'Development Time' : 'next 🚧',
|
||||
to:
|
||||
versions.length === 0
|
||||
? `api/discord-api-types-${defaultApiVersion}`
|
||||
: `api/next/discord-api-types-${defaultApiVersion}`
|
||||
},
|
||||
...versions.map((version, index) => ({
|
||||
activeBaseRegex: `api/(${version}/)${index === 0 ? '?' : ''}discord-api-types.*`,
|
||||
label: version,
|
||||
to: index === 0 ? `api/discord-api-types-${defaultApiVersion}` : `api/${version}/discord-api-types-${defaultApiVersion}`
|
||||
}))
|
||||
]
|
||||
},
|
||||
|
||||
// Right
|
||||
{
|
||||
href: 'https://github.com/discordjs/discord-api-types',
|
||||
position: 'right',
|
||||
className: 'header-github-link',
|
||||
'aria-label': 'GitHub repository',
|
||||
label: 'GitHub'
|
||||
}
|
||||
]
|
||||
},
|
||||
footer: {
|
||||
style: 'dark',
|
||||
logo: {
|
||||
alt: 'Powered By Vercel',
|
||||
src: '/powered-by-vercel.svg',
|
||||
href: 'https://vercel.com/?utm_source=discordjs&utm_campaign=oss'
|
||||
},
|
||||
links: [
|
||||
{
|
||||
title: 'Donate',
|
||||
items: [
|
||||
{
|
||||
label: 'GitHub Sponsors',
|
||||
href: 'https://discord-api-types.dev/sponsor'
|
||||
},
|
||||
{
|
||||
label: 'Ko-fi',
|
||||
href: 'https://discord-api-types.dev/kofi'
|
||||
},
|
||||
{
|
||||
label: 'Patreon',
|
||||
href: 'https://discord-api-types.dev/patreon'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Our Platforms',
|
||||
items: [
|
||||
{
|
||||
label: 'Discord Server',
|
||||
href: 'https://discord-api-types.dev/discord'
|
||||
},
|
||||
{
|
||||
label: 'GitHub Organization',
|
||||
href: 'https://discord-api-types.dev/ghorg'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
copyright: `Copyright © 2021 - ${new Date().getFullYear()} The discord.js Community and its contributors.`
|
||||
},
|
||||
prism: {
|
||||
defaultLanguage: 'typescript',
|
||||
theme: lightCodeTheme,
|
||||
darkTheme: darkCodeTheme,
|
||||
additionalLanguages: ['powershell', 'batch']
|
||||
},
|
||||
algolia: {
|
||||
appId: 'TR1O0DBFL9',
|
||||
apiKey: '6822440beca69053ab122881d75064dc',
|
||||
indexName: 'discord-api-types',
|
||||
contextualSearch: true
|
||||
}
|
||||
} satisfies Preset.ThemeConfig
|
||||
};
|
||||
|
||||
export default config;
|
||||
39133
website/package-lock.json
generated
39133
website/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@
|
||||
"scripts": {
|
||||
"docusaurus": "docusaurus",
|
||||
"start": "npm run clean && docusaurus start",
|
||||
"build": "npm run clean && cross-env DOCUSAURUS_SSR_CONCURRENCY=2 NODE_OPTIONS=\"--max_old_space_size=7500\" docusaurus build",
|
||||
"build": "npm run clean && cross-env NODE_OPTIONS=\"--max_old_space_size=7500\" docusaurus build",
|
||||
"swizzle": "docusaurus swizzle",
|
||||
"deploy": "docusaurus deploy",
|
||||
"clear": "docusaurus clear",
|
||||
@@ -24,56 +24,53 @@
|
||||
"format": "prettier --write \"{src,static,scripts,docs}/**/*.{js,jsx,ts,tsx,css,scss,json,md,mdx,yml}\"",
|
||||
"format:check": "prettier --check \"{src,static,scripts,docs}/**/*.{js,jsx,ts,tsx,css,scss,json,md,mdx,yml}\"",
|
||||
"test:lint": "run-s lint:no-fix format:check lint:md-no-fix",
|
||||
"vercel-build": "npm run build"
|
||||
"vercel-build": "npm run build",
|
||||
"postinstall": "patch-package"
|
||||
},
|
||||
"dependencies": {
|
||||
"@docusaurus/core": "canary",
|
||||
"@docusaurus/plugin-pwa": "canary",
|
||||
"@docusaurus/preset-classic": "canary",
|
||||
"@docusaurus/theme-common": "canary",
|
||||
"@docusaurus/theme-search-algolia": "canary",
|
||||
"@heroicons/react": "^1.0.6",
|
||||
"@mdx-js/react": "^1.6.22",
|
||||
"@sapphire/docusaurus-plugin-npm2yarn2pnpm": "^1.1.0",
|
||||
"@sapphire/docusaurus-plugin-ts2esm2cjs": "^1.1.0",
|
||||
"@svgr/webpack": "^6.2.1",
|
||||
"@docusaurus/core": "^3.6.3",
|
||||
"@docusaurus/plugin-client-redirects": "^3.6.3",
|
||||
"@docusaurus/plugin-pwa": "^3.6.3",
|
||||
"@docusaurus/preset-classic": "^3.6.3",
|
||||
"@docusaurus/theme-common": "^3.6.3",
|
||||
"@docusaurus/theme-search-algolia": "^3.6.3",
|
||||
"@heroicons/react": "^2.2.0",
|
||||
"@mdx-js/react": "^3.1.0",
|
||||
"@sapphire/docusaurus-plugin-npm2yarn2pnpm": "^2.0.2",
|
||||
"@sapphire/docusaurus-plugin-ts2esm2cjs": "^2.0.2",
|
||||
"@svgr/webpack": "^8.1.0",
|
||||
"@tippyjs/react": "^4.2.6",
|
||||
"clsx": "^1.1.1",
|
||||
"docusaurus-plugin-sass": "^0.2.2",
|
||||
"docusaurus-plugin-typedoc-api": "^2.0.1",
|
||||
"npm-to-yarn": "^1.0.1",
|
||||
"prism-react-renderer": "^1.3.3",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"sass": "^1.52.3",
|
||||
"swr": "^1.3.0"
|
||||
"clsx": "^2.1.1",
|
||||
"docusaurus-plugin-sass": "^0.2.5",
|
||||
"npm-to-yarn": "^3.0.0",
|
||||
"prism-react-renderer": "^2.4.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"sass": "^1.81.0",
|
||||
"swr": "^2.2.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^17.0.2",
|
||||
"@commitlint/config-conventional": "^17.0.2",
|
||||
"@docusaurus/module-type-aliases": "canary",
|
||||
"@sapphire/prettier-config": "^1.4.3",
|
||||
"@sapphire/ts-config": "^3.3.4",
|
||||
"@types/node": "^17.0.42",
|
||||
"@types/react": "^18.0.12",
|
||||
"@types/react-dom": "^18.0.5",
|
||||
"@apify/docusaurus-plugin-typedoc-api": "^4.3.1",
|
||||
"@docusaurus/module-type-aliases": "^3.6.3",
|
||||
"@sapphire/prettier-config": "^2.0.0",
|
||||
"@sapphire/ts-config": "^5.0.1",
|
||||
"@types/node": "^22.10.1",
|
||||
"@types/react": "^18.3.12",
|
||||
"@types/react-dom": "^18.3.1",
|
||||
"cross-env": "^7.0.3",
|
||||
"cz-conventional-changelog": "^3.3.0",
|
||||
"eslint": "^8.17.0",
|
||||
"eslint-config-neon": "^0.1.42",
|
||||
"lint-staged": "^13.0.1",
|
||||
"markdownlint": "^0.25.1",
|
||||
"markdownlint-cli2": "^0.14.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"prettier": "^2.6.2",
|
||||
"pretty-quick": "^3.1.3",
|
||||
"replace-in-file": "^6.3.5",
|
||||
"rimraf": "^3.0.2",
|
||||
"typedoc": "^0.22.17",
|
||||
"typedoc-plugin-djs-links": "^1.0.4",
|
||||
"typedoc-plugin-markdown": "^3.12.1",
|
||||
"typedoc-plugin-mdn-links": "^1.0.6",
|
||||
"typescript": "^4.7.3"
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-neon": "^0.1.62",
|
||||
"markdownlint": "^0.36.1",
|
||||
"markdownlint-cli2": "^0.15.0",
|
||||
"patch-package": "^8.0.0",
|
||||
"prettier": "^3.4.1",
|
||||
"pretty-quick": "^4.0.0",
|
||||
"typedoc": "^0.27.1",
|
||||
"typedoc-plugin-djs-links": "^2.2.1",
|
||||
"typedoc-plugin-markdown": "^4.3.0",
|
||||
"typedoc-plugin-mdn-links": "^4.0.2",
|
||||
"typescript": "^5.7.2"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
diff --git a/node_modules/@apify/docusaurus-plugin-typedoc-api/lib/plugin/sidebar.js b/node_modules/@apify/docusaurus-plugin-typedoc-api/lib/plugin/sidebar.js
|
||||
index e85a672..3287970 100644
|
||||
--- a/node_modules/@apify/docusaurus-plugin-typedoc-api/lib/plugin/sidebar.js
|
||||
+++ b/node_modules/@apify/docusaurus-plugin-typedoc-api/lib/plugin/sidebar.js
|
||||
@@ -71,11 +71,13 @@ function extractSidebar(packages, scopes, changelogs, sortSidebar) {
|
||||
// Always include the overview as the 1st item
|
||||
const indexHref = pkg.entryPoints.find(entry => entry.index)?.reflection.permalink ?? '';
|
||||
subItems = subItems.sort((a, d) => sortSidebar('label' in a ? a.label : '', 'label' in d ? d.label : ''));
|
||||
- subItems.unshift({
|
||||
- href: indexHref,
|
||||
- label: 'Overview',
|
||||
- type: 'link'
|
||||
- });
|
||||
+ // DAPI-TYPES START - Remove overview as it has no use
|
||||
+ // subItems.unshift({
|
||||
+ // href: indexHref,
|
||||
+ // label: 'Overview',
|
||||
+ // type: 'link'
|
||||
+ // });
|
||||
+ // DAPI-TYPES END
|
||||
if (pkg.changelogPath && changelogs) {
|
||||
subItems.push({
|
||||
href: utils.normalizeUrl([indexHref, 'changelog']),
|
||||
diff --git a/node_modules/@apify/docusaurus-plugin-typedoc-api/lib/plugin/url.js b/node_modules/@apify/docusaurus-plugin-typedoc-api/lib/plugin/url.js
|
||||
index efff9c4..2956729 100644
|
||||
--- a/node_modules/@apify/docusaurus-plugin-typedoc-api/lib/plugin/url.js
|
||||
+++ b/node_modules/@apify/docusaurus-plugin-typedoc-api/lib/plugin/url.js
|
||||
@@ -29,9 +29,11 @@ function getKindSlug(decl) {
|
||||
}
|
||||
function getPackageSlug(pkgConfig, importPath, isSinglePackage) {
|
||||
// Monorepo with 1 package has special handling
|
||||
- if (isSinglePackage && pkgConfig.packageSlug !== '.') {
|
||||
- return '.';
|
||||
- }
|
||||
+// DAPI-TYPES START - This breaks the website since we are a single-package, multiple entrypoint module
|
||||
+// if (isSinglePackage && pkgConfig.packageSlug !== '.') {
|
||||
+// return '.';
|
||||
+// }
|
||||
+// DAPI-TYPES END
|
||||
|
||||
// packages/foo -> foo
|
||||
const slug = pkgConfig.packageSlug ?? path__default.default.basename(pkgConfig.packagePath);
|
||||
@@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
export default {
|
||||
sidebar: [
|
||||
{
|
||||
type: 'autogenerated',
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ClipboardCopyIcon } from '@heroicons/react/outline';
|
||||
import { ClipboardIcon } from '@heroicons/react/24/outline';
|
||||
import Tippy from '@tippyjs/react';
|
||||
import clsx from 'clsx';
|
||||
import type { FC } from 'react';
|
||||
@@ -7,7 +7,7 @@ import styles from './InstallTabButton.module.css';
|
||||
|
||||
interface Props {
|
||||
handleClickInstallButton(): void;
|
||||
installCommand: string;
|
||||
readonly installCommand: string;
|
||||
}
|
||||
|
||||
const InstallTabButton: FC<Props> = ({ installCommand, handleClickInstallButton }) => {
|
||||
@@ -33,7 +33,7 @@ const InstallTabButton: FC<Props> = ({ installCommand, handleClickInstallButton
|
||||
>
|
||||
<div className={clsx(styles.buttonContent)}>
|
||||
{installCommand}
|
||||
<ClipboardCopyIcon className={styles.copyIcon} />
|
||||
<ClipboardIcon className={styles.copyIcon} />
|
||||
</div>
|
||||
</button>
|
||||
</Tippy>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { npmToPnpm } from '@sapphire/docusaurus-plugin-npm2yarn2pnpm';
|
||||
import { npmToPnpm, npmToYarn, npmToBun } from '@sapphire/docusaurus-plugin-npm2yarn2pnpm';
|
||||
import TabItem from '@theme/TabItem';
|
||||
import Tabs from '@theme/Tabs';
|
||||
import npmToYarn from 'npm-to-yarn';
|
||||
import type { FC } from 'react';
|
||||
import React from 'react';
|
||||
import InstallTabButton from './InstallTabButton';
|
||||
@@ -14,8 +13,10 @@ async function handleClickInstallButton(command: string) {
|
||||
|
||||
const InstallTabs: FC = () => {
|
||||
const npmInstallCommand = 'npm install discord-api-types';
|
||||
const yarnInstallCommand = npmToYarn(npmInstallCommand, 'yarn');
|
||||
const yarnInstallCommand = npmToYarn(npmInstallCommand);
|
||||
const pnpmInstallCommand = npmToPnpm(npmInstallCommand);
|
||||
const bunInstallCommand = npmToBun(npmInstallCommand);
|
||||
const denoInstallCommand = 'deno install npm:discord-api-types';
|
||||
|
||||
return (
|
||||
<div className={styles.buttons}>
|
||||
@@ -44,6 +45,22 @@ const InstallTabs: FC = () => {
|
||||
installCommand={pnpmInstallCommand}
|
||||
/>
|
||||
</TabItem>
|
||||
<TabItem label="bun" value="bun">
|
||||
<InstallTabButton
|
||||
handleClickInstallButton={() => {
|
||||
void handleClickInstallButton(bunInstallCommand);
|
||||
}}
|
||||
installCommand={bunInstallCommand}
|
||||
/>
|
||||
</TabItem>
|
||||
<TabItem label="deno" value="deno">
|
||||
<InstallTabButton
|
||||
handleClickInstallButton={() => {
|
||||
void handleClickInstallButton(denoInstallCommand);
|
||||
}}
|
||||
installCommand={denoInstallCommand}
|
||||
/>
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import Layout from '@theme/Layout';
|
||||
import React, { useEffect } from 'react';
|
||||
import React from 'react';
|
||||
import { SWRConfig } from 'swr';
|
||||
import HeadTags from '../components/Home/HeadTags';
|
||||
import HomePageHeader from '../components/Home/HomePageHeader';
|
||||
@@ -9,25 +9,6 @@ import HomePageFeatures from '../components/Home/HomepageFeatures';
|
||||
export default function Home(): JSX.Element {
|
||||
const { siteConfig } = useDocusaurusContext();
|
||||
|
||||
useEffect(() => {
|
||||
console.log('%cHold Up!', `color: #23529B; font-size: 72px; font-weight: bold; -webkit-text-stroke: 2px #23529B`);
|
||||
console.log(
|
||||
[
|
||||
'%cIf someone told you to copy/paste something here,',
|
||||
'it is likely that you are being tricked and/or scammed.',
|
||||
'For more information check out\n\nhttps://en.wikipedia.org/wiki/Self-XSS'
|
||||
].join(' '),
|
||||
'font-size: 16px;'
|
||||
);
|
||||
console.log(
|
||||
[
|
||||
'%cWhile we do everything in our power to ensure your security,',
|
||||
'pasting anything in here could give attackers access to your private information!'
|
||||
].join(' '),
|
||||
'font-size: 18px; font-weight: bold; color: red;'
|
||||
);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<HeadTags />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": ["./babel.config.js", "docs", "./docusaurus.config.js", "projects", "scripts", "./sidebars.js", "src/**/*.tsx", "static"]
|
||||
"include": ["./babel.config.js", "docs", "./docusaurus.config.ts", "projects", "scripts", "./sidebars.ts", "src/**/*.tsx", "static"]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "@sapphire/ts-config",
|
||||
"extends": ["@sapphire/ts-config"],
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"baseUrl": ".",
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
[{"entryPoints":{"v10":{"path":"v10.ts","label":"API v10"},"v9":{"path":"v9.ts","label":"API v9"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"globals":{"path":"globals.ts","label":"Global Types"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.37.109"}]
|
||||
File diff suppressed because one or more lines are too long
@@ -1,264 +0,0 @@
|
||||
---
|
||||
id: contributing_to_discord-api-types
|
||||
title: How to Contribute
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
So, you'd like to contribute to `discord-api-types` but don't know where to start or what to do? Here are some of the
|
||||
things you need to keep in mind before opening a pull request!
|
||||
|
||||
:::tip Before you begin
|
||||
|
||||
We recommend you contribute either through locally editing the files on your desktop (which means also installing
|
||||
[`npm`](https://www.npmjs.com/) dependencies as this will ensure not only a consistent code style, but also that the
|
||||
`deno` types stay in sync automatically) or through a service like
|
||||
[`GitHub Codespaces`](https://github.com/features/codespaces).
|
||||
|
||||
:::
|
||||
|
||||
:::info Still can't figure it out?
|
||||
|
||||
No problem! We await you with open hands in our [`Discord Server`](https://discord.gg/djs) in the `#developing-djs`
|
||||
channel.
|
||||
|
||||
:::
|
||||
|
||||
### Install npm dependencies first
|
||||
|
||||
One of the most crucial steps is installing [`npm`](https://www.npmjs.com/) dependencies via `npm ci`. This ensures that
|
||||
linting can be done, and it also sets up the `git` hooks for building the `deno` types and automatically
|
||||
formatting/linting the code when you commit it.
|
||||
|
||||
If you forget to install [`npm`](https://www.npmjs.com/) dependencies, or are doing the contributions through other
|
||||
means (like directly from GitHub web), you might see a comment like this one being sent as a review to your pull
|
||||
request:
|
||||
|
||||

|
||||
|
||||
The easiest way to solve this is to run the `build:deno` script (`npm run build:deno`) and pushing the results.
|
||||
|
||||
### Figure out if the update you want to contribute respects our rules about documentation
|
||||
|
||||
:::danger
|
||||
|
||||
We will not document client-only / client related types. If you plan on contributing, make sure the types you want to
|
||||
document can be used by bots and are _intended_ for usage by bots. This is a hard rule that will never change.
|
||||
|
||||
:::
|
||||
|
||||
Not every single update to the API is valid to be documented here. Our main stance for documentation is that properties
|
||||
must be known and documented on [`Discord's API Documentation repository`](https://github.com/discord/discord-api-docs),
|
||||
must be mentioned in an open pull request, must have received the green light to be used, or must be present in the
|
||||
[stable OpenAPI specification](https://github.com/discord/discord-api-spec/blob/main/specs/openapi.json).
|
||||
|
||||
With that aside, there are times where documentation for certain types is not approved/merged by Discord on the grounds
|
||||
that `it isn't helpful for bots` (or similar), but it would actually benefit bot developers to have it documented (one
|
||||
good example is the UserFlags `SPAMMER` flag). As such, if you think your update should still be merged, please propose
|
||||
it and we will be handled on a case by case basis. If approved, your update will be documented with an `@unstable` tag.
|
||||
It will also not be subject to the same versioning rules as the rest of the types.
|
||||
|
||||
### Figure out what API versions need to receive the update
|
||||
|
||||
`discord-api-types` has multiple API versions in the repository, some of which may be considered `deprecated` or
|
||||
`discontinued` as we keep them till the version is completely dead before removing them. This is a good time to figure
|
||||
out which API versions need to be updated, and you can use the table below to guide you.
|
||||
|
||||
You can also check [`Discord's API versioning table`](https://discord.com/developers/docs/reference#api-versioning) if
|
||||
you want to be 1000% sure.
|
||||
|
||||
| **API Version** | **Should receive updates** |
|
||||
| :-------------: | :------------------------: |
|
||||
| 10 | Yes |
|
||||
| 9 | Yes |
|
||||
| 8 | No |
|
||||
| 7 | No |
|
||||
| 6 | No |
|
||||
|
||||
If the version you want to contribute to is not listed above (for instance if a new API version rolls out) or if the
|
||||
version you want to contribute to is for a different part of the API (for instance `voice`), feel free to submit it and
|
||||
we will review it accordingly.
|
||||
|
||||
### Figure out where exactly are the files you need to modify to make the update
|
||||
|
||||
The file structure might seem confusing at first, especially if it's your first time contributing, but we're here to
|
||||
guide you through it.
|
||||
|
||||
When you clone the repository for the first time, you'll see a folder structure like this (we've not mentioned some
|
||||
tooling specific files like `.eslintrc.json` to keep the structure clean). We've highlighted the important folders and
|
||||
files you need to keep in mind when contributing.
|
||||
|
||||
```bash {2,4-6,9-10,12-16}
|
||||
├── deno
|
||||
├── gateway
|
||||
├── node_modules (once you ran `npm ci`)
|
||||
├── payloads
|
||||
├── rest
|
||||
├── rpc
|
||||
├── scripts
|
||||
├── tests
|
||||
├── utils
|
||||
├── voice
|
||||
├── website
|
||||
├── globals.ts
|
||||
├── v6.ts
|
||||
├── v8.ts
|
||||
├── v9.ts
|
||||
├── v10.ts
|
||||
└── package.json
|
||||
```
|
||||
|
||||
#### `deno`
|
||||
|
||||
This folder stores the [`deno`](https://deno.land/) compatible typings for Discord's API.
|
||||
|
||||
:::danger
|
||||
|
||||
This folder should not be manually modified. Any manual changes will be overwritten by the `build:deno` script.
|
||||
|
||||
Any changes that need to be done to this folder need to be done through the `scripts/deno.mjs` file.
|
||||
|
||||
:::
|
||||
|
||||
#### `gateway`
|
||||
|
||||
This folder holds types that are strictly received from
|
||||
[`Discord's gateway`](https://discord.com/developers/docs/topics/gateway). It stores the gateway version the types are
|
||||
for, the intents and opcodes, and any data that can be received/sent through the gateway.
|
||||
|
||||
Each file in the folder represents a gateway version. It references types from the versioned [`payloads`](#payloads)
|
||||
folder unless the payloads come _only_ through the gateway. There is also a `common.ts` file which represents shared
|
||||
types across all versions, as well as an `index.ts` file that exports the recommended gateway version's types.
|
||||
|
||||
:::info
|
||||
|
||||
Types created here must start with the `Gateway` prefix (for instance `GatewayGuildCreateDispatchData` which is an
|
||||
extension of the `APIGuild` type with extra fields received only through the gateway).
|
||||
|
||||
:::
|
||||
|
||||
#### `payloads`
|
||||
|
||||
This folder holds the bulk of type definitions for Discord's APIs. Each API version receives its own folder. Inside of
|
||||
each folder there is always an `index.ts` file that exports every type available in that version, as well as the common
|
||||
types that can be found in `payloads/common.ts`. At the root of the `payloads` folder is also an `index.ts` file which
|
||||
exports the recommended API version's types.
|
||||
|
||||
Inside of each versioned folder, the files are defined from the structure in
|
||||
[`Discord's API Documentation`](https://discord.dev), under the `Resources` category. Depending on the complexity of the
|
||||
resource, you may opt for splitting it up into multiple files. If you want to do so, please create a folder named
|
||||
`_{resource_name}` where the `resource_name` is the same name as the resource you're splitting up (a good example is the
|
||||
`_interactions` folder which stores all the types for interactions in a neater structure), and create a
|
||||
`{resource_name}.ts` file which exports everything from that folder). If you feel like you need to split it up even
|
||||
more, just repeat the same structure of creating an `_{file_name}` folder and exporting everything from it in the
|
||||
`{file_name}.ts` file (you can see an example
|
||||
[here](https://github.com/discordjs/discord-api-types/tree/85802f1/payloads/v10/_interactions)).
|
||||
|
||||
:::info
|
||||
|
||||
Types created here must start with the `API` prefix (for instance `APIUser`), **except** for enums, which should have a
|
||||
normal name (for instance `UserFlags`).
|
||||
|
||||
:::
|
||||
|
||||
#### `rest`
|
||||
|
||||
This folder holds all the types that are related to Discord's REST API. Just like [`payloads`](#payloads), it is split
|
||||
into folders that have an `index.ts` file, from the structure in [`Discord's API Documentation`](https://discord.dev),
|
||||
under the `Resources` category.
|
||||
|
||||
:::info
|
||||
|
||||
Types created here must start with the `REST` prefix (for instance `RESTGetAPIUserResult`) unless they are objects or
|
||||
enums (for instance `Routes`).
|
||||
|
||||
They must also follow the following structure: `REST{http_method}{type_name}{Query|(JSON|FormData)Body|Result}`, where:
|
||||
|
||||
- `http_method` is the PascalCase HTTP method name (for instance `Get`, `Post`, and so on)
|
||||
- `type_name` is the actual name of the type it returns (for instance `APIUser`)
|
||||
- `Query|(JSON|FormData)Body|Result` should be used depending on what the route takes or returns
|
||||
- If a route doesn't take in any parameters, be it query, JSON or FormData, it shouldn't define any of those types
|
||||
- A route should always define a `Result` type, and should reference an `API*` type unless the data returned is only
|
||||
received through a REST call
|
||||
- If a route returns a `204 No Content` response, it should define a `Result` type with `never` as its value (this
|
||||
does not account for errors)
|
||||
|
||||
This structure should be followed whenever possible, however that might not always be doable. Specifically, types for
|
||||
OAuth2 may not follow the structure exactly, but should aim to follow it as much as possible.
|
||||
|
||||
:::
|
||||
|
||||
#### `rpc`
|
||||
|
||||
This folder holds types that are strictly related to
|
||||
[`Discord's RPC API`](https://discord.com/developers/docs/topics/rpc). Just like [`gateway`](#gateway), each RPC API
|
||||
version receives its own file.
|
||||
|
||||
:::info
|
||||
|
||||
Types created here must start with the `RPC` prefix (for instance `RPCErrorCodes`).
|
||||
|
||||
:::
|
||||
|
||||
#### `scripts`
|
||||
|
||||
This folder holds the module's scripts that empower our Continuous Integration / Deployment pipelines, as well as other
|
||||
miscellaneous scripts we might need. There's really not much to say about these really...
|
||||
|
||||
#### `tests`
|
||||
|
||||
This folder holds tests for certain complex types that the module might have, and is especially useful for validating
|
||||
unions.
|
||||
|
||||
:::info
|
||||
|
||||
Files created here **must** end in `.test-d.ts`, as otherwise they will not be picked up by
|
||||
[`tsd`](https://www.npmjs.com/package/tsd).
|
||||
|
||||
:::
|
||||
|
||||
#### `utils`
|
||||
|
||||
This folder holds certain utility functions which can be used while working with some complicated types (for instance
|
||||
for more complicated unions). Each API version gets its own file with utility functions, but a folder can be created if
|
||||
a lot of methods are created.
|
||||
|
||||
:::info
|
||||
|
||||
The `internals.ts` file stores types that are strictly used inside the module to help build out our strict types. These
|
||||
types should never be exported from the module.
|
||||
|
||||
:::
|
||||
|
||||
#### `voice`
|
||||
|
||||
This folder holds types that are strictly related to
|
||||
[`Discord's Voice API`](https://discord.com/developers/docs/topics/voice-connections). It follows the same folder
|
||||
structure as [`gateway`](#gateway).
|
||||
|
||||
:::info
|
||||
|
||||
Types in this folder must start with the `Voice` prefix (for instance `VoiceOpcodes`).
|
||||
|
||||
:::
|
||||
|
||||
#### `website`
|
||||
|
||||
This folder holds...well...this very site you are reading this page from! For the most part, you do not need to alter
|
||||
its contents, except if you're contributing a new API version to the module.
|
||||
|
||||
To add the new version to this very website, edit the `docusaurus.config.js` file, and in the `plugins` array, for the
|
||||
`docusaurus-plugin-typedoc-api` plugin, you need to add an entry similar to the ones already present.
|
||||
|
||||
#### `globals.ts`
|
||||
|
||||
This file stores types that are present regardless of the API version you use.
|
||||
|
||||
#### `v*.ts`
|
||||
|
||||
These files export everything from the previously mentioned folders that match the version the file is named after. It
|
||||
serves as the entry point for importing types from the module (for example by importing `discord-api-types/v10`).
|
||||
|
||||
#### `package.json`
|
||||
|
||||
This is the entry point of the package for [`npm`](https://www.npmjs.com/). You won't need to edit this file unless
|
||||
you're adding a new API version, in which case you should follow the same structure as seen in the `exports` field.
|
||||
@@ -1,167 +0,0 @@
|
||||
---
|
||||
id: introduction_to_discord-api-types
|
||||
title: Introduction
|
||||
sidebar_position: 0
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
<div align="center">
|
||||
|
||||
<img src="/svgs/logo_long_blurple.svg" className="markdown__logo" />
|
||||
|
||||
[](https://discord-api-types.dev/discord)
|
||||
[](https://www.patreon.com/vladfrangu)
|
||||
[](https://ko-fi.com/wolfgalvlad)
|
||||
[](https://github.com/sponsors/vladfrangu)
|
||||
|
||||
[](https://www.npmjs.com/package/discord-api-types)
|
||||
[](https://www.npmjs.com/package/discord-api-types)
|
||||
[](https://deno.land/x/discord_api_types)
|
||||
|
||||
</div>
|
||||
|
||||
## About
|
||||
|
||||
Discord API Types is a community-maintained project that brings API types for Discord's REST, Gateway and Voice APIs.
|
||||
|
||||
## Installation
|
||||
|
||||
Install with [`npm`](https://www.npmjs.com/) / [`yarn`](https://yarnpkg.com) / [`pnpm`](https://pnpm.js.org/):
|
||||
|
||||
```bash npm2yarn2pnpm
|
||||
npm install discord-api-types
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
You can only import this module by specifying the API version you want to target. Append `/v*` to the import path, where
|
||||
the `*` represents the API version. Below are some examples
|
||||
|
||||
<Tabs groupId="ts2esm2cjs">
|
||||
<TabItem value="javascript" label="JavaScript">
|
||||
|
||||
```typescript showLineNumbers
|
||||
/**
|
||||
* @type {import('discord-api-types/v10').APIUser}
|
||||
*/
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="esm" label="ESM">
|
||||
|
||||
```typescript showLineNumbers
|
||||
/**
|
||||
* @type {import('discord-api-types/v10').APIUser}
|
||||
*/
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="typescript" label="TypeScript">
|
||||
|
||||
```typescript showLineNumbers
|
||||
import { type APIUser } from 'discord-api-types/v10';
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
</Tabs>
|
||||
|
||||
:::info
|
||||
|
||||
You may also import just certain parts of the module that you need. The possible values are: `globals`, `gateway`,
|
||||
`gateway/v*`, `payloads`, `payloads/v*`, `rest`, `rest/v*`, `rpc`, `rpc/v*`, `utils`, `utils/v*`, `voice`, and
|
||||
`voice/v*`. Below is an example of importing directly from the gateway submodule
|
||||
|
||||
```typescript ts2esm2cjs
|
||||
import { GatewayVersion } from 'discord-api-types/gateway/v10';
|
||||
|
||||
console.log(`Let's connect to wss://gateway.discord.gg/?v=${GatewayVersion}`);
|
||||
```
|
||||
|
||||
> _**Note:** The `v*` exports (`discord-api-types/v*`) include the appropriate version of `gateway`, `payloads`, `rest`,
|
||||
> `rpc`, and `utils` you specified, alongside the `globals` exports_
|
||||
|
||||
:::
|
||||
|
||||
### Deno
|
||||
|
||||
We also provide typings compatible with the [deno](https://deno.land/) runtime. Here are 3 examples of how you can
|
||||
import them:
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="github" label="From GitHub">
|
||||
|
||||
```typescript showLineNumbers
|
||||
// Importing a specific API version
|
||||
import { APIUser } from 'https://raw.githubusercontent.com/discordjs/discord-api-types/main/deno/v10.ts';
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="deno" label="From deno.land/x" default>
|
||||
|
||||
```typescript showLineNumbers
|
||||
// Importing a specific API version
|
||||
import { APIUser } from 'https://deno.land/x/discord_api_types/v10.ts';
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="skypack" label="From skypack.dev">
|
||||
|
||||
```typescript showLineNumbers
|
||||
// Importing a specific API version
|
||||
import { APIUser } from 'https://cdn.skypack.dev/discord-api-types/v10?dts';
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
</Tabs>
|
||||
|
||||
## Project Structure
|
||||
|
||||
The exports of each API version is split into three main parts:
|
||||
|
||||
- Everything exported with the `API` prefix represents a payload you may get from the REST API _or_ the Gateway.
|
||||
|
||||
- Everything exported with the `Gateway` prefix represents data that ONLY comes from or is directly related to the
|
||||
Gateway.
|
||||
|
||||
- Everything exported with the `REST` prefix represents data that ONLY comes from or is directly related to the REST
|
||||
API.
|
||||
|
||||
- For endpoint options, they will follow the following structure:
|
||||
`REST<HTTP Method><Type><Query|(JSON|FormData)Body|Result>` where the type represents what it will return.
|
||||
|
||||
- For example, `RESTPostAPIChannelMessageJSONBody` or `RESTGetAPIGatewayBotInfoResult`.
|
||||
|
||||
- Some exported types (specifically OAuth2 related ones) may not respect this entire structure due to the nature of
|
||||
the fields. They will start with either `RESTOAuth2` or with something similar to `REST<HTTP Method>OAuth2`
|
||||
|
||||
- If a type ends with `Result`, then it represents the expected result by calling its accompanying route.
|
||||
|
||||
- Types that are exported as `never` usually mean the result will be a `204 No Content`, so you can safely ignore
|
||||
it. This does **not** account for errors.
|
||||
|
||||
- Anything else that is miscellaneous will be exported based on what it represents (for example the `REST` route
|
||||
object).
|
||||
|
||||
- There may be types exported that are identical for all versions. These will be exported as is and can be found in the
|
||||
`globals` file. They will still be prefixed accordingly as described above.
|
||||
|
||||
:::danger A note about how types are documented
|
||||
|
||||
This package will add types only for known and documented properties that are present in Discord's
|
||||
[API Documentation repository](https://github.com/discord/discord-api-docs), that are mentioned in an open pull request,
|
||||
or known through other means _and have received the green light to be used_. Anything else will not be documented (for
|
||||
example client only types).
|
||||
|
||||
With that aside, we may allow certain types that are not documented in the
|
||||
[API Documentation repository](https://github.com/discord/discord-api-docs) on a case by case basis. They will be
|
||||
documented with an `@unstable` tag and are not subject with the same versioning rules.
|
||||
|
||||
:::
|
||||
@@ -1 +0,0 @@
|
||||
[{"entryPoints":{"v10":{"path":"v10.ts","label":"API v10"},"v9":{"path":"v9.ts","label":"API v9"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"globals":{"path":"globals.ts","label":"Global Types"}},"packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.37.110"}]
|
||||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 126 KiB |
@@ -28,12 +28,52 @@ Discord API Types is a community-maintained project that brings API types for Di
|
||||
|
||||
## Installation
|
||||
|
||||
Install with [`npm`](https://www.npmjs.com/) / [`yarn`](https://yarnpkg.com) / [`pnpm`](https://pnpm.js.org/):
|
||||
Install with [`npm`](https://www.npmjs.com/) / [`yarn`](https://yarnpkg.com) / [`pnpm`](https://pnpm.js.org/) /
|
||||
[`bun`](https://bun.sh/) / [`deno`](https://deno.land/):
|
||||
|
||||
```bash npm2yarn2pnpm
|
||||
<Tabs groupId="npm2yarn2pnpm">
|
||||
<TabItem value="npm" label="npm">
|
||||
|
||||
```bash
|
||||
npm install discord-api-types
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="yarn" label="yarn">
|
||||
|
||||
```bash
|
||||
yarn add discord-api-types
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="pnpm" label="pnpm">
|
||||
|
||||
```bash
|
||||
pnpm add discord-api-types
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="bun" label="bun">
|
||||
|
||||
```bash
|
||||
bun add discord-api-types
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="deno" label="deno">
|
||||
|
||||
```bash
|
||||
deno install npm:discord-api-types
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
|
||||
</Tabs>
|
||||
|
||||
### Usage
|
||||
|
||||
You can only import this module by specifying the API version you want to target. Append `/v*` to the import path, where
|
||||
@@ -0,0 +1 @@
|
||||
[{"entryPoints":{"v10":{"path":"v10.ts","label":"API v10"},"v9":{"path":"v9.ts","label":"API v9"},"voice/v4":{"path":"voice/v4.ts","label":"Voice v4"},"globals":{"path":"globals.ts","label":"Global Types"}},"packageRoot":"/home/runner/work/discord-api-types/discord-api-types/","packagePath":"./","packageSlug":"discord-api-types","packageName":"discord-api-types","packageVersion":"0.37.119"}]
|
||||
1
website/versioned_docs/version-0.37.119/api-typedoc.json
Normal file
1
website/versioned_docs/version-0.37.119/api-typedoc.json
Normal file
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 126 KiB |
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"sidebar": [
|
||||
{
|
||||
"type": "autogenerated",
|
||||
"dirName": "."
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
[
|
||||
"0.37.110",
|
||||
"0.37.109"
|
||||
"0.37.119"
|
||||
]
|
||||
Reference in New Issue
Block a user