mirror of
https://github.com/discordjs/discord-api-types.git
synced 2026-05-22 11:20:10 +00:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6296ac9e4f | ||
|
|
7d873f73c7 | ||
|
|
60c38fd32c | ||
|
|
e196e65254 | ||
|
|
21b9ae4aaf | ||
|
|
39ea1f4429 | ||
|
|
fde45f9235 | ||
|
|
2ee557a598 | ||
|
|
fed4749dd4 | ||
|
|
666a0c7152 | ||
|
|
e40530599e | ||
|
|
7992fab135 | ||
|
|
61db1eee25 |
@@ -61,10 +61,10 @@ import { APIUser } from 'discord-api-types';
|
||||
You should instead consider adding the API version you want to target by appending `/v*`, where the `*` represents the API version.
|
||||
|
||||
```js
|
||||
const { APIUser } = require('discord-api-types/v6');
|
||||
const { APIUser } = require('discord-api-types/v8');
|
||||
```
|
||||
|
||||
```ts
|
||||
// TypeScript/ES Module support
|
||||
import { APIUser } from 'discord-api-types/v6';
|
||||
import { APIUser } from 'discord-api-types/v8';
|
||||
```
|
||||
|
||||
@@ -52,6 +52,8 @@ export enum RESTJSONErrorCodes {
|
||||
MaximumNumberOfAttachmentsInAMessageReached = 30015,
|
||||
MaximumNumberOfInvitesReached,
|
||||
|
||||
GuildAlreadyHasTemplate = 30031,
|
||||
|
||||
Unauthorized = 40001,
|
||||
VerifyYourAccount,
|
||||
|
||||
@@ -92,6 +94,8 @@ export enum RESTJSONErrorCodes {
|
||||
|
||||
CannotDeleteChannelRequiredForCommunityGuilds = 50074,
|
||||
|
||||
InvalidStickerSent = 50081,
|
||||
|
||||
TwoFactorAuthenticationIsRequired = 60003,
|
||||
|
||||
ReactionWasBlocked = 90001,
|
||||
|
||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "discord-api-types",
|
||||
"version": "0.7.0",
|
||||
"version": "0.10.0",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "discord-api-types",
|
||||
"version": "0.7.0",
|
||||
"version": "0.10.0",
|
||||
"description": "Discord API typings that are kept up to date for use in bot library creation.",
|
||||
"main": "default/index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -74,7 +74,8 @@ export enum VoiceOPCodes {
|
||||
Hello,
|
||||
Resumed,
|
||||
|
||||
ClientDisconnect = 13,
|
||||
ClientConnect = 12,
|
||||
ClientDisconnect,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -664,11 +665,16 @@ export interface GatewayUpdatePresence {
|
||||
*/
|
||||
export interface GatewayPresenceUpdateData {
|
||||
since: number | null;
|
||||
activities: GatewayActivity[] | null;
|
||||
activities: GatewayActivityUpdateData[] | null;
|
||||
status: PresenceUpdateStatus;
|
||||
afk: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-structure
|
||||
*/
|
||||
export type GatewayActivityUpdateData = Pick<GatewayActivity, 'name' | 'type' | 'url'>;
|
||||
|
||||
// #endregion Sendable Payloads
|
||||
|
||||
// #region Shared
|
||||
|
||||
@@ -79,6 +79,7 @@ export interface APIMessage {
|
||||
message_reference?: APIMessageReference;
|
||||
flags?: MessageFlags;
|
||||
referenced_message?: APIMessage | null;
|
||||
stickers?: APISticker[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,7 +103,7 @@ export enum MessageType {
|
||||
GUILD_DISCOVERY_REQUALIFIED,
|
||||
GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNING,
|
||||
GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNING,
|
||||
INLINE_REPLY,
|
||||
REPLY = 19,
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,7 +130,7 @@ export interface APIMessageApplication {
|
||||
*/
|
||||
export interface APIMessageReference {
|
||||
message_id?: string;
|
||||
channel_id: string;
|
||||
channel_id?: string;
|
||||
guild_id?: string;
|
||||
}
|
||||
|
||||
@@ -154,6 +155,29 @@ export enum MessageFlags {
|
||||
URGENT = 1 << 4,
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#message-object-message-sticker-structure
|
||||
*/
|
||||
export interface APISticker {
|
||||
id: string;
|
||||
pack_id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
tags?: string;
|
||||
asset: string;
|
||||
preview_asset: string | null;
|
||||
format_type: StickerFormatType;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#message-object-message-sticker-format-types
|
||||
*/
|
||||
export enum StickerFormatType {
|
||||
PNG = 1,
|
||||
APNG,
|
||||
LOTTIE,
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#reaction-object-reaction-structure
|
||||
*/
|
||||
|
||||
@@ -56,7 +56,7 @@ export enum PresenceUpdateStatus {
|
||||
export type GatewayPresenceClientStatus = Partial<Record<'desktop' | 'mobile' | 'web', PresenceUpdateStatus>>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#activity-object
|
||||
* https://discord.com/developers/docs/topics/gateway#activity-object-activity-structure
|
||||
*/
|
||||
export interface GatewayActivity {
|
||||
name: string;
|
||||
|
||||
@@ -17,6 +17,9 @@ export interface APIUnavailableGuild {
|
||||
unavailable: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#guild-object-guild-structure
|
||||
*/
|
||||
export interface APIPartialGuild extends Omit<APIUnavailableGuild, 'unavailable'>, Pick<APIGuild, 'welcome_screen'> {
|
||||
name: string;
|
||||
icon: string | null;
|
||||
@@ -29,7 +32,11 @@ export interface APIPartialGuild extends Omit<APIUnavailableGuild, 'unavailable'
|
||||
unavailable?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#guild-object-guild-structure
|
||||
*/
|
||||
export interface APIGuild extends APIPartialGuild {
|
||||
icon_hash?: string | null;
|
||||
discovery_splash: string | null;
|
||||
owner?: boolean;
|
||||
owner_id: string;
|
||||
|
||||
@@ -7,6 +7,7 @@ export * from './invite';
|
||||
export * from './oauth2';
|
||||
export * from './permissions';
|
||||
export * from './teams';
|
||||
export * from './template';
|
||||
export * from './user';
|
||||
export * from './voice';
|
||||
export * from './webhook';
|
||||
|
||||
29
v8/payloads/template.ts
Normal file
29
v8/payloads/template.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Types extracted from https://discord.com/developers/docs/resources/template
|
||||
*/
|
||||
|
||||
import type { APIUser } from './user';
|
||||
import type { RESTPostAPIGuildsJSONBody } from '../rest';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/template#template-object
|
||||
*/
|
||||
export interface APITemplate {
|
||||
code: string;
|
||||
name: string;
|
||||
description: string | null;
|
||||
usage_count: number;
|
||||
creator_id: string;
|
||||
creator: APIUser;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
source_guild_id: string;
|
||||
serialized_source_guild: APITemplateSerializedSourceGuild;
|
||||
is_dirty: boolean | null;
|
||||
}
|
||||
|
||||
export interface APITemplateSerializedSourceGuild extends Omit<RESTPostAPIGuildsJSONBody, 'icon'> {
|
||||
description: string | null;
|
||||
preferred_locale: string;
|
||||
icon_hash: string | null;
|
||||
}
|
||||
@@ -31,6 +31,7 @@ export interface APIAllowedMentionsSend {
|
||||
parse?: AllowedMentionsTypes[];
|
||||
roles?: string[];
|
||||
users?: string[];
|
||||
replied_user?: boolean;
|
||||
}
|
||||
|
||||
// #endregion TypeDefs
|
||||
@@ -66,6 +67,8 @@ export interface RESTGetAPIChannelMessagesQuery {
|
||||
|
||||
export type RESTGetAPIChannelMessagesResult = APIMessage[];
|
||||
|
||||
export type APIMessageReferenceSend = APIMessageReference & Required<Pick<APIMessageReference, 'message_id'>>;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#create-message
|
||||
*/
|
||||
@@ -75,7 +78,7 @@ export interface RESTPostAPIChannelMessageJSONBody {
|
||||
tts?: boolean;
|
||||
embed?: APIEmbed;
|
||||
allowed_mentions?: APIAllowedMentionsSend;
|
||||
message_reference?: APIMessageReference;
|
||||
message_reference?: APIMessageReferenceSend;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,7 +101,7 @@ export type RESTPostAPIChannelMessageFormDataBody =
|
||||
tts?: boolean;
|
||||
embed?: APIEmbed;
|
||||
allowed_mentions?: APIAllowedMentionsSend;
|
||||
message_reference?: APIMessageReference;
|
||||
message_reference?: APIMessageReferenceSend;
|
||||
/**
|
||||
* The file contents
|
||||
*/
|
||||
|
||||
@@ -13,6 +13,7 @@ import type {
|
||||
GuildDefaultMessageNotifications,
|
||||
GuildExplicitContentFilter,
|
||||
GuildFeature,
|
||||
GuildSystemChannelFlags,
|
||||
GuildVerificationLevel,
|
||||
GuildWidgetStyle,
|
||||
IntegrationExpireBehavior,
|
||||
@@ -51,6 +52,7 @@ export interface RESTPostAPIGuildsJSONBody {
|
||||
afk_channel_id?: number | string;
|
||||
afk_timeout?: number;
|
||||
system_channel_id?: number | string;
|
||||
system_channel_flags: GuildSystemChannelFlags;
|
||||
}
|
||||
|
||||
export type RESTPostAPIGuildsResult = APIGuild;
|
||||
@@ -86,6 +88,7 @@ export interface RESTPatchAPIGuildJSONBody {
|
||||
discovery_splash?: string | null;
|
||||
banner?: string | null;
|
||||
system_channel_id?: string | null;
|
||||
system_channel_flags: GuildSystemChannelFlags;
|
||||
rules_channel_id?: string | null;
|
||||
public_updates_channel_id?: string | null;
|
||||
preferred_locale?: string;
|
||||
@@ -308,13 +311,6 @@ export type RESTGetAPIGuildVoiceRegionsResult = APIVoiceRegion[];
|
||||
*/
|
||||
export type RESTGetAPIGuildInvitesResult = APIInvite[];
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/guild#get-guild-integrations
|
||||
*/
|
||||
export interface RESTGetAPIGuildIntegrationsQuery {
|
||||
include_applications?: boolean;
|
||||
}
|
||||
|
||||
export type RESTGetAPIGuildIntegrationsResult = APIGuildIntegration[];
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@ export * from './gateway';
|
||||
export * from './guild';
|
||||
export * from './invite';
|
||||
export * from './oauth2';
|
||||
export * from './template';
|
||||
export * from './user';
|
||||
export * from './voice';
|
||||
export * from './webhook';
|
||||
@@ -53,7 +54,7 @@ export const Routes = {
|
||||
* - POST `/channels/{channel.id}/messages/{message.id}/crosspost`
|
||||
*/
|
||||
channelCrosspost(channelID: string, messageID: string) {
|
||||
return `/channels/${channelID}/message/${messageID}/crosspost`;
|
||||
return `/channels/${channelID}/messages/${messageID}/crosspost`;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -101,7 +102,7 @@ export const Routes = {
|
||||
* - POST `/channels/{channel.id}/messages/bulk-delete`
|
||||
*/
|
||||
channelBulkDelete(channelID: string) {
|
||||
return `/channels/${channelID}/bulk-delete`;
|
||||
return `/channels/${channelID}/messages/bulk-delete`;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -119,7 +120,7 @@ export const Routes = {
|
||||
* - POST `/channels/{channel.id}/invites`
|
||||
*/
|
||||
channelInvite(channelID: string) {
|
||||
return `/channels/${channelID}`;
|
||||
return `/channels/${channelID}/invites`;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -393,6 +394,34 @@ export const Routes = {
|
||||
return `/invites/${code}`;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/templates/{template.code}`
|
||||
* - POST `/guilds/templates/{template.code}`
|
||||
*/
|
||||
template(code: string) {
|
||||
return `/guilds/templates/${code}`;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/guilds/{guild.id}/templates`
|
||||
* - POST `/guilds/{guild.id}/templates`
|
||||
*/
|
||||
guildTemplates(guildID: string) {
|
||||
return `/guilds/${guildID}/templates`;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - PUT `/guilds/{guild.id}/templates/{template.code}`
|
||||
* - PATCH `/guilds/{guild.id}/templates/{template.code}`
|
||||
* - DELETE `/guilds/{guild.id}/templates/{template.code}`
|
||||
*/
|
||||
guildTemplate(guildID: string, code: string) {
|
||||
return `/guilds/${guildID}/templates/${code}`;
|
||||
},
|
||||
|
||||
/**
|
||||
* Route for:
|
||||
* - GET `/users/@me`
|
||||
@@ -484,7 +513,7 @@ export const Routes = {
|
||||
* - POST `/webhooks/{webhook.id}/{webhook.token}/github`
|
||||
*/
|
||||
webhookPlatform(webhookID: string, webhookToken: string, platform: 'github' | 'slack') {
|
||||
return `/${webhookID}/${webhookToken}/${platform}`;
|
||||
return `/webhooks/${webhookID}/${webhookToken}/${platform}`;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
33
v8/rest/template.ts
Normal file
33
v8/rest/template.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import type { APIGuild, APITemplate } from '../payloads';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/template#get-template
|
||||
*/
|
||||
export type RESTGetAPITemplateResult = APITemplate;
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/template#create-guild-from-template
|
||||
*/
|
||||
export interface RESTPostAPITemplateCreateGuildJSONBody {
|
||||
name: string;
|
||||
icon?: string;
|
||||
}
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/template#create-guild-from-template
|
||||
*/
|
||||
export type RESTPostAPITemplateCreateGuildResult = APIGuild;
|
||||
|
||||
export type RESTGetAPIGuildTemplatesResult = APITemplate[];
|
||||
|
||||
export interface RESTPostAPIGuildTemplatesJSONBody {
|
||||
name: string;
|
||||
description?: string | null;
|
||||
}
|
||||
export type RESTPostAPIGuildTemplatesResult = APITemplate;
|
||||
|
||||
export type RESTPutAPIGuildTemplateSyncResult = APITemplate;
|
||||
|
||||
export type RESTPatchAPIGuildTemplateJSONBody = Partial<RESTPostAPIGuildTemplatesJSONBody>;
|
||||
export type RESTPatchAPIGuildTemplateResult = APITemplate;
|
||||
|
||||
export type RESTDeleteAPIGuildTemplateResult = APITemplate;
|
||||
Reference in New Issue
Block a user