mirror of
https://github.com/discordjs/discord-api-types.git
synced 2026-05-31 07:50:09 +00:00
chore: Add more missing stuff (#160)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> BREAKING CHANGE: `GatewayGuildMemberUpdateDispatchData#joined_at` is properly marked as nullable now BREAKING CHANGE: In v9, `thread_id` was incorrectly placed in `RESTPostAPIWebhookWithTokenJSONBody` and has been moved to `RESTPostAPIWebhookWithTokenQuery`
This commit is contained in:
@@ -25,6 +25,7 @@ import type {
|
||||
InviteTargetType,
|
||||
PresenceUpdateStatus,
|
||||
} from '../payloads/v8/mod.ts';
|
||||
import type { Nullable } from '../utils/internals.ts';
|
||||
|
||||
export * from './common.ts';
|
||||
|
||||
@@ -441,7 +442,7 @@ export interface GatewayReadyDispatchData {
|
||||
/**
|
||||
* Contains `id` and `flags`
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/oauth2#application-object
|
||||
* See https://discord.com/developers/docs/resources/application#application-object
|
||||
*/
|
||||
application: Pick<APIApplication, 'id' | 'flags'>;
|
||||
}
|
||||
@@ -734,9 +735,10 @@ export type GatewayGuildMemberUpdateDispatch = DataPayload<
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#guild-member-update
|
||||
*/
|
||||
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user'> &
|
||||
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user' | 'joined_at'> &
|
||||
Partial<Pick<APIGuildMember, 'deaf' | 'mute'>> &
|
||||
Required<Pick<APIGuildMember, 'user'>> & {
|
||||
Required<Pick<APIGuildMember, 'user'>> &
|
||||
Nullable<Pick<APIGuildMember, 'joined_at'>> & {
|
||||
/**
|
||||
* The id of the guild
|
||||
*/
|
||||
@@ -1375,7 +1377,7 @@ export interface GatewayIdentifyData {
|
||||
/**
|
||||
* Presence structure for initial presence information
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-status
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-presence
|
||||
*/
|
||||
presence?: GatewayPresenceUpdateData;
|
||||
/**
|
||||
@@ -1504,7 +1506,7 @@ export interface GatewayVoiceStateUpdateData {
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#update-status
|
||||
* https://discord.com/developers/docs/topics/gateway#update-presence
|
||||
*/
|
||||
export interface GatewayUpdatePresence {
|
||||
op: GatewayOpcodes.PresenceUpdate;
|
||||
@@ -1512,7 +1514,7 @@ export interface GatewayUpdatePresence {
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#update-status-gateway-status-update-structure
|
||||
* https://discord.com/developers/docs/topics/gateway#update-presence-gateway-presence-update-structure
|
||||
*/
|
||||
export interface GatewayPresenceUpdateData {
|
||||
/**
|
||||
@@ -1528,7 +1530,7 @@ export interface GatewayPresenceUpdateData {
|
||||
/**
|
||||
* The user's new status
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-status-status-types
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-presence-status-types
|
||||
*/
|
||||
status: PresenceUpdateStatus;
|
||||
/**
|
||||
|
||||
@@ -28,6 +28,7 @@ import type {
|
||||
InviteTargetType,
|
||||
PresenceUpdateStatus,
|
||||
} from '../payloads/v9/mod.ts';
|
||||
import type { Nullable } from '../utils/internals.ts';
|
||||
|
||||
export * from './common.ts';
|
||||
|
||||
@@ -451,7 +452,7 @@ export interface GatewayReadyDispatchData {
|
||||
/**
|
||||
* Contains `id` and `flags`
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/oauth2#application-object
|
||||
* See https://discord.com/developers/docs/resources/application#application-object
|
||||
*/
|
||||
application: Pick<APIApplication, 'id' | 'flags'>;
|
||||
}
|
||||
@@ -744,9 +745,10 @@ export type GatewayGuildMemberUpdateDispatch = DataPayload<
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#guild-member-update
|
||||
*/
|
||||
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user'> &
|
||||
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user' | 'joined_at'> &
|
||||
Partial<Pick<APIGuildMember, 'deaf' | 'mute'>> &
|
||||
Required<Pick<APIGuildMember, 'user'>> & {
|
||||
Required<Pick<APIGuildMember, 'user'>> &
|
||||
Nullable<Pick<APIGuildMember, 'joined_at'>> & {
|
||||
/**
|
||||
* The id of the guild
|
||||
*/
|
||||
@@ -1464,7 +1466,7 @@ export interface GatewayIdentifyData {
|
||||
/**
|
||||
* Presence structure for initial presence information
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-status
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-presence
|
||||
*/
|
||||
presence?: GatewayPresenceUpdateData;
|
||||
/**
|
||||
@@ -1601,7 +1603,7 @@ export interface GatewayUpdatePresence {
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#update-status-gateway-status-update-structure
|
||||
* https://discord.com/developers/docs/topics/gateway#update-presence-gateway-presence-update-structure
|
||||
*/
|
||||
export interface GatewayPresenceUpdateData {
|
||||
/**
|
||||
@@ -1617,7 +1619,7 @@ export interface GatewayPresenceUpdateData {
|
||||
/**
|
||||
* The user's new status
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-status-status-types
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-presence-status-types
|
||||
*/
|
||||
status: PresenceUpdateStatus;
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Permissions, Snowflake } from '../../../globals.ts';
|
||||
import { InteractionType } from '../../v8.ts';
|
||||
import { APIMessage } from '../channel.ts';
|
||||
import { APIGuildMember } from '../guild.ts';
|
||||
import { APIUser } from '../user.ts';
|
||||
import type { Permissions, Snowflake } from '../../../globals.ts';
|
||||
import type { InteractionType } from '../../v8.ts';
|
||||
import type { APIMessage } from '../channel.ts';
|
||||
import type { APIGuildMember } from '../guild.ts';
|
||||
import type { APIUser } from '../user.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/slash-commands#message-interaction-object-message-interaction-structure
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ComponentType } from '../channel.ts';
|
||||
import { APIBaseInteraction, InteractionType } from '../interactions.ts';
|
||||
import { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
|
||||
import type { ComponentType } from '../channel.ts';
|
||||
import type { APIBaseInteraction, InteractionType } from '../interactions.ts';
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
|
||||
|
||||
export type APIMessageComponentInteraction = APIBaseInteraction<
|
||||
InteractionType.MessageComponent,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MessageFlags } from '../mod.ts';
|
||||
import { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8.ts';
|
||||
import type { MessageFlags } from '../mod.ts';
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-request-type
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { APIRole, APIUser } from '../mod.ts';
|
||||
import { Permissions, Snowflake } from '../../../globals.ts';
|
||||
import { APIPartialChannel } from '../channel.ts';
|
||||
import { APIGuildMember } from '../guild.ts';
|
||||
import { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
|
||||
import { InteractionType } from './responses.ts';
|
||||
import type { APIRole, APIUser } from '../mod.ts';
|
||||
import type { Permissions, Snowflake } from '../../../globals.ts';
|
||||
import type { APIPartialChannel } from '../channel.ts';
|
||||
import type { APIGuildMember } from '../guild.ts';
|
||||
import type { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
|
||||
import type { InteractionType } from './responses.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object
|
||||
|
||||
109
deno/payloads/v8/application.ts
Normal file
109
deno/payloads/v8/application.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Types extracted from https://discord.com/developers/docs/resources/application
|
||||
*/
|
||||
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
import type { APITeam } from './teams.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/application#application-object
|
||||
*/
|
||||
export interface APIApplication {
|
||||
/**
|
||||
* The id of the app
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* The name of the app
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The icon hash of the app
|
||||
*/
|
||||
icon: string | null;
|
||||
/**
|
||||
* The description of the app
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* An array of rpc origin urls, if rpc is enabled
|
||||
*/
|
||||
rpc_origins?: string[];
|
||||
/**
|
||||
* When `false` only app owner can join the app's bot to guilds
|
||||
*/
|
||||
bot_public: boolean;
|
||||
/**
|
||||
* When `true` the app's bot will only join upon completion of the full oauth2 code grant flow
|
||||
*/
|
||||
bot_require_code_grant: boolean;
|
||||
/**
|
||||
* The url of the application's terms of service
|
||||
*/
|
||||
terms_of_service_url?: string;
|
||||
/**
|
||||
* The url of the application's privacy policy
|
||||
*/
|
||||
privacy_policy_url?: string;
|
||||
/**
|
||||
* Partial user object containing info on the owner of the application
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
owner?: APIUser;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the summary field for the store page
|
||||
* of its primary sku
|
||||
*/
|
||||
summary: string;
|
||||
/**
|
||||
* The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function
|
||||
*
|
||||
* See https://discord.com/developers/docs/game-sdk/applications#get-ticket
|
||||
*/
|
||||
verify_key: string;
|
||||
/**
|
||||
* The team this application belongs to
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/teams#data-models-team-object
|
||||
*/
|
||||
team: APITeam | null;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
|
||||
*/
|
||||
guild_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
|
||||
*/
|
||||
primary_sku_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
|
||||
*/
|
||||
slug?: string;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the hash of the image on store embeds
|
||||
*/
|
||||
cover_image?: string;
|
||||
/**
|
||||
* The application's public flags
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
*/
|
||||
flags: ApplicationFlags;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
*/
|
||||
export enum ApplicationFlags {
|
||||
ManagedEmoji = 1 << 2,
|
||||
GroupDMCreate = 1 << 4,
|
||||
RPCHasConnected = 1 << 11,
|
||||
GatewayPresence = 1 << 12,
|
||||
GatewayPresenceLimited = 1 << 13,
|
||||
GatewayGuildMembers = 1 << 14,
|
||||
GatewayGuildMembersLimited = 1 << 15,
|
||||
VerificationPendingGuildLimit = 1 << 16,
|
||||
Embedded = 1 << 17,
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import type { Permissions, Snowflake } from '../../globals.ts';
|
||||
import type { APIPartialEmoji } from './emoji.ts';
|
||||
import type { APIGuildMember } from './guild.ts';
|
||||
import type { APIMessageInteraction } from './interactions.ts';
|
||||
import type { APIApplication } from './oauth2.ts';
|
||||
import type { APIApplication } from './application.ts';
|
||||
import type { APIRole } from './permissions.ts';
|
||||
import type { APISticker, APIStickerItem } from './sticker.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
@@ -560,7 +560,7 @@ export interface APIEmbed {
|
||||
/**
|
||||
* Description of embed
|
||||
*
|
||||
* Length limit: 2048 characters
|
||||
* Length limit: 4096 characters
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
|
||||
@@ -246,7 +246,7 @@ export interface APIGuild extends APIPartialGuild {
|
||||
*/
|
||||
presences?: GatewayPresenceUpdate[];
|
||||
/**
|
||||
* The maximum number of presences for the guild (the default value, currently 25000, is in effect when `null` is returned)
|
||||
* The maximum number of presences for the guild (`null` is always returned, apart from the largest of guilds)
|
||||
*/
|
||||
max_presences?: number | null;
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
import type {
|
||||
APIMessageComponentDMInteraction,
|
||||
APIMessageComponentGuildInteraction,
|
||||
APIMessageComponentInteraction,
|
||||
} from './_interactions/messageComponents.ts';
|
||||
import {
|
||||
import type {
|
||||
APIApplicationCommandDMInteraction,
|
||||
APIApplicationCommandGuildInteraction,
|
||||
APIApplicationCommandInteraction,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import type { APIPartialChannel } from './channel.ts';
|
||||
import type { APIPartialGuild } from './guild.ts';
|
||||
import type { APIApplication } from './oauth2.ts';
|
||||
import type { APIApplication } from './application.ts';
|
||||
import type { APIInviteStageInstance } from './stageInstance.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './application.ts';
|
||||
export * from './auditLog.ts';
|
||||
export * from './channel.ts';
|
||||
export * from './emoji.ts';
|
||||
|
||||
@@ -2,107 +2,6 @@
|
||||
* Types extracted from https://discord.com/developers/docs/topics/oauth2
|
||||
*/
|
||||
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
import type { APITeam } from './teams.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/oauth2#get-current-application-information-response-structure
|
||||
*/
|
||||
export interface APIApplication {
|
||||
/**
|
||||
* The id of the app
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* The name of the app
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The icon hash of the app
|
||||
*/
|
||||
icon: string | null;
|
||||
/**
|
||||
* The description of the app
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* An array of rpc origin urls, if rpc is enabled
|
||||
*/
|
||||
rpc_origins?: string[];
|
||||
/**
|
||||
* When `false` only app owner can join the app's bot to guilds
|
||||
*/
|
||||
bot_public: boolean;
|
||||
/**
|
||||
* When `true` the app's bot will only join upon completion of the full oauth2 code grant flow
|
||||
*/
|
||||
bot_require_code_grant: boolean;
|
||||
/**
|
||||
* The url of the application's terms of service
|
||||
*/
|
||||
terms_of_service_url?: string;
|
||||
/**
|
||||
* The url of the application's privacy policy
|
||||
*/
|
||||
privacy_policy_url?: string;
|
||||
/**
|
||||
* Partial user object containing info on the owner of the application
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
owner?: APIUser;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the summary field for the store page
|
||||
* of its primary sku
|
||||
*/
|
||||
summary: string;
|
||||
/**
|
||||
* The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function
|
||||
*
|
||||
* See https://discord.com/developers/docs/game-sdk/applications#get-ticket
|
||||
*/
|
||||
verify_key: string;
|
||||
/**
|
||||
* The team this application belongs to
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/teams#data-models-team-object
|
||||
*/
|
||||
team: APITeam | null;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
|
||||
*/
|
||||
guild_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
|
||||
*/
|
||||
primary_sku_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
|
||||
*/
|
||||
slug?: string;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the hash of the image on store embeds
|
||||
*/
|
||||
cover_image?: string;
|
||||
/**
|
||||
* The application's public flags
|
||||
*/
|
||||
flags: ApplicationFlags;
|
||||
}
|
||||
|
||||
export enum ApplicationFlags {
|
||||
ManagedEmoji = 1 << 2,
|
||||
GroupDMCreate = 1 << 4,
|
||||
RPCHasConnected = 1 << 11,
|
||||
GatewayPresence = 1 << 12,
|
||||
GatewayPresenceLimited = 1 << 13,
|
||||
GatewayGuildMembers = 1 << 14,
|
||||
GatewayGuildMembersLimited = 1 << 15,
|
||||
VerificationPendingGuildLimit = 1 << 16,
|
||||
Embedded = 1 << 17,
|
||||
}
|
||||
|
||||
export enum OAuth2Scopes {
|
||||
/**
|
||||
* For oauth2 bots, this puts the bot in the user's selected guild by default
|
||||
|
||||
@@ -21,6 +21,10 @@ export interface APITeam {
|
||||
* The members of the team
|
||||
*/
|
||||
members: APITeamMember[];
|
||||
/**
|
||||
* The name of the team
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The user id of the current team owner
|
||||
*/
|
||||
|
||||
@@ -72,4 +72,8 @@ export enum WebhookType {
|
||||
* Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels
|
||||
*/
|
||||
ChannelFollower,
|
||||
/**
|
||||
* Application webhooks are webhooks used with Interactions
|
||||
*/
|
||||
Application,
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Permissions, Snowflake } from '../../../globals.ts';
|
||||
import { InteractionType } from '../../v9.ts';
|
||||
import { APIMessage } from '../channel.ts';
|
||||
import { APIGuildMember } from '../guild.ts';
|
||||
import { APIUser } from '../user.ts';
|
||||
import type { Permissions, Snowflake } from '../../../globals.ts';
|
||||
import type { InteractionType } from '../../v9.ts';
|
||||
import type { APIMessage } from '../channel.ts';
|
||||
import type { APIGuildMember } from '../guild.ts';
|
||||
import type { APIUser } from '../user.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/slash-commands#message-interaction-object-message-interaction-structure
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ComponentType } from '../channel.ts';
|
||||
import { APIBaseInteraction, InteractionType } from '../interactions.ts';
|
||||
import { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
|
||||
import type { ComponentType } from '../channel.ts';
|
||||
import type { APIBaseInteraction, InteractionType } from '../interactions.ts';
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
|
||||
|
||||
export type APIMessageComponentInteraction = APIBaseInteraction<
|
||||
InteractionType.MessageComponent,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MessageFlags } from '../mod.ts';
|
||||
import { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9.ts';
|
||||
import type { MessageFlags } from '../mod.ts';
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-request-type
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { APIRole, APIUser } from '../mod.ts';
|
||||
import { Permissions, Snowflake } from '../../../globals.ts';
|
||||
import { APIPartialChannel } from '../channel.ts';
|
||||
import { APIGuildMember } from '../guild.ts';
|
||||
import { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
|
||||
import { InteractionType } from './responses.ts';
|
||||
import type { APIRole, APIUser } from '../mod.ts';
|
||||
import type { Permissions, Snowflake } from '../../../globals.ts';
|
||||
import type { APIPartialChannel } from '../channel.ts';
|
||||
import type { APIGuildMember } from '../guild.ts';
|
||||
import type { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base.ts';
|
||||
import type { InteractionType } from './responses.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object
|
||||
|
||||
109
deno/payloads/v9/application.ts
Normal file
109
deno/payloads/v9/application.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Types extracted from https://discord.com/developers/docs/resources/application
|
||||
*/
|
||||
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
import type { APITeam } from './teams.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/application#application-object
|
||||
*/
|
||||
export interface APIApplication {
|
||||
/**
|
||||
* The id of the app
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* The name of the app
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The icon hash of the app
|
||||
*/
|
||||
icon: string | null;
|
||||
/**
|
||||
* The description of the app
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* An array of rpc origin urls, if rpc is enabled
|
||||
*/
|
||||
rpc_origins?: string[];
|
||||
/**
|
||||
* When `false` only app owner can join the app's bot to guilds
|
||||
*/
|
||||
bot_public: boolean;
|
||||
/**
|
||||
* When `true` the app's bot will only join upon completion of the full oauth2 code grant flow
|
||||
*/
|
||||
bot_require_code_grant: boolean;
|
||||
/**
|
||||
* The url of the application's terms of service
|
||||
*/
|
||||
terms_of_service_url?: string;
|
||||
/**
|
||||
* The url of the application's privacy policy
|
||||
*/
|
||||
privacy_policy_url?: string;
|
||||
/**
|
||||
* Partial user object containing info on the owner of the application
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
owner?: APIUser;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the summary field for the store page
|
||||
* of its primary sku
|
||||
*/
|
||||
summary: string;
|
||||
/**
|
||||
* The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function
|
||||
*
|
||||
* See https://discord.com/developers/docs/game-sdk/applications#get-ticket
|
||||
*/
|
||||
verify_key: string;
|
||||
/**
|
||||
* The team this application belongs to
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/teams#data-models-team-object
|
||||
*/
|
||||
team: APITeam | null;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
|
||||
*/
|
||||
guild_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
|
||||
*/
|
||||
primary_sku_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
|
||||
*/
|
||||
slug?: string;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the hash of the image on store embeds
|
||||
*/
|
||||
cover_image?: string;
|
||||
/**
|
||||
* The application's public flags
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
*/
|
||||
flags: ApplicationFlags;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
*/
|
||||
export enum ApplicationFlags {
|
||||
ManagedEmoji = 1 << 2,
|
||||
GroupDMCreate = 1 << 4,
|
||||
RPCHasConnected = 1 << 11,
|
||||
GatewayPresence = 1 << 12,
|
||||
GatewayPresenceLimited = 1 << 13,
|
||||
GatewayGuildMembers = 1 << 14,
|
||||
GatewayGuildMembersLimited = 1 << 15,
|
||||
VerificationPendingGuildLimit = 1 << 16,
|
||||
Embedded = 1 << 17,
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import type { Permissions, Snowflake } from '../../globals.ts';
|
||||
import type { APIPartialEmoji } from './emoji.ts';
|
||||
import type { APIGuildMember } from './guild.ts';
|
||||
import type { APIMessageInteraction } from './interactions.ts';
|
||||
import type { APIApplication } from './oauth2.ts';
|
||||
import type { APIApplication } from './application.ts';
|
||||
import type { APIRole } from './permissions.ts';
|
||||
import type { APISticker, APIStickerItem } from './sticker.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
@@ -680,7 +680,7 @@ export interface APIEmbed {
|
||||
/**
|
||||
* Description of embed
|
||||
*
|
||||
* Length limit: 2048 characters
|
||||
* Length limit: 4096 characters
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
|
||||
@@ -254,7 +254,7 @@ export interface APIGuild extends APIPartialGuild {
|
||||
*/
|
||||
presences?: GatewayPresenceUpdate[];
|
||||
/**
|
||||
* The maximum number of presences for the guild (the default value, currently 25000, is in effect when `null` is returned)
|
||||
* The maximum number of presences for the guild (`null` is always returned, apart from the largest of guilds)
|
||||
*/
|
||||
max_presences?: number | null;
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
import type {
|
||||
APIMessageComponentDMInteraction,
|
||||
APIMessageComponentGuildInteraction,
|
||||
APIMessageComponentInteraction,
|
||||
} from './_interactions/messageComponents.ts';
|
||||
import {
|
||||
import type {
|
||||
APIApplicationCommandDMInteraction,
|
||||
APIApplicationCommandGuildInteraction,
|
||||
APIApplicationCommandInteraction,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import type { APIPartialChannel } from './channel.ts';
|
||||
import type { APIPartialGuild } from './guild.ts';
|
||||
import type { APIApplication } from './oauth2.ts';
|
||||
import type { APIApplication } from './application.ts';
|
||||
import type { APIInviteStageInstance } from './stageInstance.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './application.ts';
|
||||
export * from './auditLog.ts';
|
||||
export * from './channel.ts';
|
||||
export * from './emoji.ts';
|
||||
|
||||
@@ -2,107 +2,6 @@
|
||||
* Types extracted from https://discord.com/developers/docs/topics/oauth2
|
||||
*/
|
||||
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
import type { APITeam } from './teams.ts';
|
||||
import type { APIUser } from './user.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/oauth2#get-current-application-information-response-structure
|
||||
*/
|
||||
export interface APIApplication {
|
||||
/**
|
||||
* The id of the app
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* The name of the app
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The icon hash of the app
|
||||
*/
|
||||
icon: string | null;
|
||||
/**
|
||||
* The description of the app
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* An array of rpc origin urls, if rpc is enabled
|
||||
*/
|
||||
rpc_origins?: string[];
|
||||
/**
|
||||
* When `false` only app owner can join the app's bot to guilds
|
||||
*/
|
||||
bot_public: boolean;
|
||||
/**
|
||||
* When `true` the app's bot will only join upon completion of the full oauth2 code grant flow
|
||||
*/
|
||||
bot_require_code_grant: boolean;
|
||||
/**
|
||||
* The url of the application's terms of service
|
||||
*/
|
||||
terms_of_service_url?: string;
|
||||
/**
|
||||
* The url of the application's privacy policy
|
||||
*/
|
||||
privacy_policy_url?: string;
|
||||
/**
|
||||
* Partial user object containing info on the owner of the application
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
owner?: APIUser;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the summary field for the store page
|
||||
* of its primary sku
|
||||
*/
|
||||
summary: string;
|
||||
/**
|
||||
* The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function
|
||||
*
|
||||
* See https://discord.com/developers/docs/game-sdk/applications#get-ticket
|
||||
*/
|
||||
verify_key: string;
|
||||
/**
|
||||
* The team this application belongs to
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/teams#data-models-team-object
|
||||
*/
|
||||
team: APITeam | null;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
|
||||
*/
|
||||
guild_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
|
||||
*/
|
||||
primary_sku_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
|
||||
*/
|
||||
slug?: string;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the hash of the image on store embeds
|
||||
*/
|
||||
cover_image?: string;
|
||||
/**
|
||||
* The application's public flags
|
||||
*/
|
||||
flags: ApplicationFlags;
|
||||
}
|
||||
|
||||
export enum ApplicationFlags {
|
||||
ManagedEmoji = 1 << 2,
|
||||
GroupDMCreate = 1 << 4,
|
||||
RPCHasConnected = 1 << 11,
|
||||
GatewayPresence = 1 << 12,
|
||||
GatewayPresenceLimited = 1 << 13,
|
||||
GatewayGuildMembers = 1 << 14,
|
||||
GatewayGuildMembersLimited = 1 << 15,
|
||||
VerificationPendingGuildLimit = 1 << 16,
|
||||
Embedded = 1 << 17,
|
||||
}
|
||||
|
||||
export enum OAuth2Scopes {
|
||||
/**
|
||||
* For oauth2 bots, this puts the bot in the user's selected guild by default
|
||||
|
||||
@@ -21,6 +21,10 @@ export interface APITeam {
|
||||
* The members of the team
|
||||
*/
|
||||
members: APITeamMember[];
|
||||
/**
|
||||
* The name of the team
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The user id of the current team owner
|
||||
*/
|
||||
|
||||
@@ -72,4 +72,8 @@ export enum WebhookType {
|
||||
* Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels
|
||||
*/
|
||||
ChannelFollower,
|
||||
/**
|
||||
* Application webhooks are webhooks used with Interactions
|
||||
*/
|
||||
Application,
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ export enum RESTJSONErrorCodes {
|
||||
UnknownUser,
|
||||
UnknownEmoji,
|
||||
UnknownWebhook,
|
||||
UnknownWebhookService,
|
||||
|
||||
UnknownSession = 10020,
|
||||
|
||||
UnknownBan = 10026,
|
||||
UnknownSKU,
|
||||
@@ -27,30 +30,52 @@ export enum RESTJSONErrorCodes {
|
||||
UnknownBuild,
|
||||
UnknownLobby,
|
||||
UnknownBranch,
|
||||
UnknownStoreDirectoryLayout,
|
||||
|
||||
UnknownRedistributable = 10036,
|
||||
|
||||
UnknownGiftCode = 10038,
|
||||
|
||||
UnknownGuildTemplate = 10057,
|
||||
|
||||
UnknownSticker = 10060,
|
||||
UnknownDiscoverableServerCategory = 10059,
|
||||
UnknownSticker,
|
||||
|
||||
UnknownInteraction = 10062,
|
||||
UnknownApplicationCommand,
|
||||
|
||||
UnknownApplicationCommandPermissions = 10066,
|
||||
UnknownStageInstance,
|
||||
UnknownGuildMemberVerificationForm,
|
||||
UnknownGuildWelcomeScreen,
|
||||
|
||||
BotsCannotUseThisEndpoint = 20001,
|
||||
OnlyBotsCanUseThisEndpoint,
|
||||
|
||||
ExplicitContentCannotBeSentToTheDesiredRecipient = 20009,
|
||||
|
||||
NotAuthorizedToPerformThisActionOnThisApplication = 20012,
|
||||
|
||||
ActionCannotBePerformedDueToSlowmodeRateLimit = 20016,
|
||||
|
||||
OnlyTheOwnerOfThisAccountCanPerformThisAction = 20018,
|
||||
|
||||
AnnouncementEditLimitExceeded = 20022,
|
||||
|
||||
ChannelSendRateLimit = 20028,
|
||||
|
||||
StageTopicServerNameServerDescriptionOrChannelNamesContainDisallowedWords = 20031,
|
||||
|
||||
GuildPremiumSubscriptionLevelTooLow = 20035,
|
||||
|
||||
MaximumNumberOfGuildsReached = 30001,
|
||||
MaximumNumberOfFriendsReached,
|
||||
MaximumNumberOfPinsReachedForTheChannel,
|
||||
|
||||
MaximumNumberOfGuildRolesReached = 30005,
|
||||
MaximumNumberOfRecipientsReached,
|
||||
MaximumNumberOfGuildRolesReached,
|
||||
|
||||
MaximumNumberOfWebhooksReached = 30007,
|
||||
MaximumNumberOfEmojisReached,
|
||||
|
||||
MaximumNumberOfReactionsReached = 30010,
|
||||
|
||||
@@ -59,20 +84,33 @@ export enum RESTJSONErrorCodes {
|
||||
MaximumNumberOfAttachmentsInAMessageReached = 30015,
|
||||
MaximumNumberOfInvitesReached,
|
||||
|
||||
MaximumNumberOfAnimatedEmojisReached = 30018,
|
||||
MaximumNumberOfServerMembersReached,
|
||||
|
||||
MaximumNumberOfServerCategoriesReached = 30030,
|
||||
|
||||
GuildAlreadyHasTemplate = 30031,
|
||||
|
||||
MaximumThreadParticipants = 30033,
|
||||
|
||||
MaximumNumberOfNonGuildMemberBansHasBeenExceeded = 30035,
|
||||
|
||||
MaximumNumberOfBanFetchesHasBeenReached = 30037,
|
||||
|
||||
MaximumNumberOfStickersReached = 30039,
|
||||
|
||||
Unauthorized = 40001,
|
||||
VerifyYourAccount,
|
||||
OpeningDirectMessagesTooFast,
|
||||
|
||||
RequestEntityTooLarge = 40005,
|
||||
FeatureTemporarilyDisabledServerSide,
|
||||
UserBannedFromThisGuild,
|
||||
|
||||
ThisMessageWasAlreadyCrossposted = 40033,
|
||||
TargetUserIsNotConnectedToVoice = 40032,
|
||||
ThisMessageWasAlreadyCrossposted,
|
||||
|
||||
ApplicationCommandWithThatNameAlreadyExists = 40041,
|
||||
|
||||
MissingAccess = 50001,
|
||||
InvalidAccountType,
|
||||
@@ -99,6 +137,7 @@ export enum RESTJSONErrorCodes {
|
||||
InvalidOAuth2AccessToken,
|
||||
|
||||
InvalidWebhookToken = 50027,
|
||||
InvalidRole,
|
||||
|
||||
InvalidRecipients = 50033,
|
||||
OneOfTheMessagesProvidedWasTooOldForBulkDelete,
|
||||
@@ -110,6 +149,8 @@ export enum RESTJSONErrorCodes {
|
||||
FileUploadedExceedsMaximumSize = 50045,
|
||||
InvalidFileUploaded,
|
||||
|
||||
CannotSelfRedeemThisGift = 50070,
|
||||
|
||||
CannotDeleteChannelRequiredForCommunityGuilds = 50074,
|
||||
|
||||
InvalidStickerSent = 50081,
|
||||
@@ -120,10 +161,14 @@ export enum RESTJSONErrorCodes {
|
||||
|
||||
TwoFactorAuthenticationIsRequired = 60003,
|
||||
|
||||
NoUsersWithDiscordTagExist = 80004,
|
||||
|
||||
ReactionWasBlocked = 90001,
|
||||
|
||||
APIResourceOverloaded = 130000,
|
||||
|
||||
TheStageIsAlreadyOpen = 150006,
|
||||
|
||||
ThreadAlreadyCreatedForMessage = 160004,
|
||||
ThreadLocked,
|
||||
MaximumActiveThreads,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import type { Permissions, Snowflake } from '../../globals.ts';
|
||||
import type {
|
||||
APIActionRowComponent,
|
||||
APIAllowedMentions,
|
||||
APIAttachment,
|
||||
APIChannel,
|
||||
APIEmbed,
|
||||
APIExtendedInvite,
|
||||
@@ -26,7 +28,7 @@ export type RESTGetAPIChannelResult = APIChannel;
|
||||
*/
|
||||
export interface RESTPatchAPIChannelJSONBody {
|
||||
/**
|
||||
* 2-100 character channel name
|
||||
* 1-100 character channel name
|
||||
*
|
||||
* Channel types: all
|
||||
*/
|
||||
@@ -200,6 +202,12 @@ export interface RESTPostAPIChannelMessageJSONBody {
|
||||
* See https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
|
||||
*/
|
||||
message_reference?: APIMessageReferenceSend;
|
||||
/**
|
||||
* The components to include with the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
/**
|
||||
* IDs of up to 3 stickers in the server to send in the message
|
||||
*
|
||||
@@ -295,10 +303,15 @@ export interface RESTPatchAPIChannelMessageJSONBody {
|
||||
content?: string | null;
|
||||
/**
|
||||
* Embedded `rich` content (up to 6000 characters)
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
*/
|
||||
embeds?: APIEmbed[];
|
||||
embeds?: APIEmbed[] | null;
|
||||
/**
|
||||
* Embedded `rich` content
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
* @deprecated Use `embeds` instead
|
||||
*/
|
||||
embed?: APIEmbed | null;
|
||||
/**
|
||||
@@ -306,14 +319,50 @@ export interface RESTPatchAPIChannelMessageJSONBody {
|
||||
*
|
||||
* When specifying flags, ensure to include all previously set flags/bits
|
||||
* in addition to ones that you are modifying
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#message-object-message-flags
|
||||
*/
|
||||
flags?: MessageFlags | null;
|
||||
/**
|
||||
* Allowed mentions for the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#allowed-mentions-object
|
||||
*/
|
||||
allowed_mentions?: APIAllowedMentions | null;
|
||||
/**
|
||||
* Attached files to keep
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#attachment-object
|
||||
*/
|
||||
attachments?: APIAttachment[] | null;
|
||||
/**
|
||||
* The components to include with the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#edit-message
|
||||
*/
|
||||
export type RESTPatchAPIChannelMessageFormDataBody =
|
||||
| {
|
||||
/**
|
||||
* JSON stringified message body
|
||||
*/
|
||||
payload_json?: string;
|
||||
/**
|
||||
* The file contents
|
||||
*/
|
||||
file: unknown;
|
||||
}
|
||||
| (RESTPatchAPIChannelMessageJSONBody & {
|
||||
/**
|
||||
* The file contents
|
||||
*/
|
||||
file: unknown;
|
||||
});
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#edit-message
|
||||
*/
|
||||
|
||||
@@ -20,6 +20,7 @@ import type {
|
||||
GuildVerificationLevel,
|
||||
GuildWidgetStyle,
|
||||
} from '../../payloads/v8/mod.ts';
|
||||
import type { Nullable } from '../../utils/internals.ts';
|
||||
import type { RESTPutAPIChannelPermissionJSONBody } from './channel.ts';
|
||||
|
||||
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody {
|
||||
@@ -774,7 +775,3 @@ export interface RESTPatchAPIGuildWelcomeScreenJSONBody extends Nullable<Partial
|
||||
*/
|
||||
enabled?: boolean | null;
|
||||
}
|
||||
|
||||
type Nullable<T> = {
|
||||
[P in keyof T]: T[P] | null;
|
||||
};
|
||||
|
||||
@@ -5,7 +5,9 @@ import type {
|
||||
APIEmbed,
|
||||
APIMessage,
|
||||
APIWebhook,
|
||||
APIAttachment,
|
||||
} from '../../payloads/v8/mod.ts';
|
||||
import type { Nullable } from '../../utils/internals.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#create-webhook
|
||||
@@ -115,14 +117,22 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
|
||||
tts?: boolean;
|
||||
/**
|
||||
* Embedded `rich` content
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
*/
|
||||
embeds?: APIEmbed[];
|
||||
/**
|
||||
* Allowed mentions for the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#allowed-mentions-object
|
||||
*/
|
||||
allowed_mentions?: APIAllowedMentions;
|
||||
/**
|
||||
* the components to include with the message
|
||||
* The components to include with the message
|
||||
*
|
||||
* Requires an application-owned webhook
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
}
|
||||
@@ -213,9 +223,17 @@ export type RESTPostAPIWebhookWithTokenGitHubWaitResult = APIMessage;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
|
||||
*/
|
||||
export type RESTPatchAPIWebhookWithTokenMessageJSONBody = Nullable<
|
||||
Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions'>
|
||||
>;
|
||||
export interface RESTPatchAPIWebhookWithTokenMessageJSONBody
|
||||
extends Nullable<
|
||||
Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions' | 'components'>
|
||||
> {
|
||||
/**
|
||||
* Attached files to keep
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#attachment-object
|
||||
*/
|
||||
attachments?: APIAttachment[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
|
||||
@@ -252,7 +270,3 @@ export type RESTPatchAPIWebhookWithTokenMessageResult = APIMessage;
|
||||
* https://discord.com/developers/docs/resources/webhook#delete-webhook-message
|
||||
*/
|
||||
export type RESTDeleteAPIWebhookWithTokenMessageResult = never;
|
||||
|
||||
type Nullable<T> = {
|
||||
[P in keyof T]: T[P] | null;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import type { Permissions, Snowflake } from '../../globals.ts';
|
||||
import type {
|
||||
APIActionRowComponent,
|
||||
APIAllowedMentions,
|
||||
APIAttachment,
|
||||
APIChannel,
|
||||
APIEmbed,
|
||||
APIExtendedInvite,
|
||||
@@ -29,7 +31,7 @@ export type RESTGetAPIChannelResult = APIChannel;
|
||||
*/
|
||||
export interface RESTPatchAPIChannelJSONBody {
|
||||
/**
|
||||
* 2-100 character channel name
|
||||
* 1-100 character channel name
|
||||
*
|
||||
* Channel types: all
|
||||
*/
|
||||
@@ -228,6 +230,12 @@ export interface RESTPostAPIChannelMessageJSONBody {
|
||||
* See https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
|
||||
*/
|
||||
message_reference?: APIMessageReferenceSend;
|
||||
/**
|
||||
* The components to include with the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
/**
|
||||
* IDs of up to 3 stickers in the server to send in the message
|
||||
*
|
||||
@@ -323,10 +331,14 @@ export interface RESTPatchAPIChannelMessageJSONBody {
|
||||
content?: string | null;
|
||||
/**
|
||||
* Embedded `rich` content (up to 6000 characters)
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
*/
|
||||
embeds?: APIEmbed[];
|
||||
embeds?: APIEmbed[] | null;
|
||||
/**
|
||||
* Embedded `rich` content
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
* @deprecated Use `embeds` instead
|
||||
*/
|
||||
embed?: APIEmbed | null;
|
||||
@@ -335,14 +347,51 @@ export interface RESTPatchAPIChannelMessageJSONBody {
|
||||
*
|
||||
* When specifying flags, ensure to include all previously set flags/bits
|
||||
* in addition to ones that you are modifying
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#message-object-message-flags
|
||||
*/
|
||||
flags?: MessageFlags | null;
|
||||
/**
|
||||
* Allowed mentions for the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#allowed-mentions-object
|
||||
*/
|
||||
allowed_mentions?: APIAllowedMentions | null;
|
||||
/**
|
||||
* Attached files to keep
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#attachment-object
|
||||
*/
|
||||
attachments?: APIAttachment[] | null;
|
||||
/**
|
||||
* The components to include with the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#edit-message
|
||||
*/
|
||||
export type RESTPatchAPIChannelMessageFormDataBody =
|
||||
| {
|
||||
/**
|
||||
* JSON stringified message body
|
||||
*/
|
||||
payload_json?: string;
|
||||
/**
|
||||
* The file contents
|
||||
*/
|
||||
file: unknown;
|
||||
}
|
||||
| (RESTPatchAPIChannelMessageJSONBody & {
|
||||
/**
|
||||
* The file contents
|
||||
*/
|
||||
file: unknown;
|
||||
});
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#edit-message
|
||||
*/
|
||||
@@ -523,7 +572,7 @@ export type RESTDeleteAPIChannelRecipientResult = unknown;
|
||||
*/
|
||||
export interface RESTPostAPIChannelMessagesThreadsJSONBody {
|
||||
/**
|
||||
* 2-100 character thread name
|
||||
* 1-100 character thread name
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
|
||||
@@ -20,6 +20,7 @@ import type {
|
||||
GuildVerificationLevel,
|
||||
GuildWidgetStyle,
|
||||
} from '../../payloads/v9/mod.ts';
|
||||
import type { Nullable } from '../../utils/internals.ts';
|
||||
import type { RESTPutAPIChannelPermissionJSONBody } from './channel.ts';
|
||||
|
||||
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody {
|
||||
@@ -774,7 +775,3 @@ export interface RESTPatchAPIGuildWelcomeScreenJSONBody extends Nullable<Partial
|
||||
*/
|
||||
enabled?: boolean | null;
|
||||
}
|
||||
|
||||
type Nullable<T> = {
|
||||
[P in keyof T]: T[P] | null;
|
||||
};
|
||||
|
||||
@@ -5,7 +5,9 @@ import type {
|
||||
APIEmbed,
|
||||
APIMessage,
|
||||
APIWebhook,
|
||||
APIAttachment,
|
||||
} from '../../payloads/v9/mod.ts';
|
||||
import type { Nullable } from '../../utils/internals.ts';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#create-webhook
|
||||
@@ -115,18 +117,22 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
|
||||
tts?: boolean;
|
||||
/**
|
||||
* Embedded `rich` content
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
*/
|
||||
embeds?: APIEmbed[];
|
||||
/**
|
||||
* Allowed mentions for the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#allowed-mentions-object
|
||||
*/
|
||||
allowed_mentions?: APIAllowedMentions;
|
||||
/**
|
||||
* The thread to post this message in
|
||||
*/
|
||||
thread_id?: Snowflake;
|
||||
/**
|
||||
* the components to include with the message
|
||||
* The components to include with the message
|
||||
*
|
||||
* Requires an application-owned webhook
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
}
|
||||
@@ -163,6 +169,10 @@ export interface RESTPostAPIWebhookWithTokenQuery {
|
||||
* @default false
|
||||
*/
|
||||
wait?: boolean;
|
||||
/**
|
||||
* Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived.
|
||||
*/
|
||||
thread_id?: Snowflake;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -217,9 +227,17 @@ export type RESTPostAPIWebhookWithTokenGitHubWaitResult = APIMessage;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
|
||||
*/
|
||||
export type RESTPatchAPIWebhookWithTokenMessageJSONBody = Nullable<
|
||||
Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions'>
|
||||
>;
|
||||
export interface RESTPatchAPIWebhookWithTokenMessageJSONBody
|
||||
extends Nullable<
|
||||
Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions' | 'components'>
|
||||
> {
|
||||
/**
|
||||
* Attached files to keep
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#attachment-object
|
||||
*/
|
||||
attachments?: APIAttachment[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
|
||||
@@ -256,7 +274,3 @@ export type RESTPatchAPIWebhookWithTokenMessageResult = APIMessage;
|
||||
* https://discord.com/developers/docs/resources/webhook#delete-webhook-message
|
||||
*/
|
||||
export type RESTDeleteAPIWebhookWithTokenMessageResult = never;
|
||||
|
||||
type Nullable<T> = {
|
||||
[P in keyof T]: T[P] | null;
|
||||
};
|
||||
|
||||
3
deno/utils/internals.ts
Normal file
3
deno/utils/internals.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export type Nullable<T> = {
|
||||
[P in keyof T]: T[P] | null;
|
||||
};
|
||||
@@ -25,6 +25,7 @@ import type {
|
||||
InviteTargetType,
|
||||
PresenceUpdateStatus,
|
||||
} from '../payloads/v8/index';
|
||||
import type { Nullable } from '../utils/internals';
|
||||
|
||||
export * from './common';
|
||||
|
||||
@@ -441,7 +442,7 @@ export interface GatewayReadyDispatchData {
|
||||
/**
|
||||
* Contains `id` and `flags`
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/oauth2#application-object
|
||||
* See https://discord.com/developers/docs/resources/application#application-object
|
||||
*/
|
||||
application: Pick<APIApplication, 'id' | 'flags'>;
|
||||
}
|
||||
@@ -734,9 +735,10 @@ export type GatewayGuildMemberUpdateDispatch = DataPayload<
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#guild-member-update
|
||||
*/
|
||||
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user'> &
|
||||
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user' | 'joined_at'> &
|
||||
Partial<Pick<APIGuildMember, 'deaf' | 'mute'>> &
|
||||
Required<Pick<APIGuildMember, 'user'>> & {
|
||||
Required<Pick<APIGuildMember, 'user'>> &
|
||||
Nullable<Pick<APIGuildMember, 'joined_at'>> & {
|
||||
/**
|
||||
* The id of the guild
|
||||
*/
|
||||
@@ -1375,7 +1377,7 @@ export interface GatewayIdentifyData {
|
||||
/**
|
||||
* Presence structure for initial presence information
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-status
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-presence
|
||||
*/
|
||||
presence?: GatewayPresenceUpdateData;
|
||||
/**
|
||||
@@ -1504,7 +1506,7 @@ export interface GatewayVoiceStateUpdateData {
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#update-status
|
||||
* https://discord.com/developers/docs/topics/gateway#update-presence
|
||||
*/
|
||||
export interface GatewayUpdatePresence {
|
||||
op: GatewayOpcodes.PresenceUpdate;
|
||||
@@ -1512,7 +1514,7 @@ export interface GatewayUpdatePresence {
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#update-status-gateway-status-update-structure
|
||||
* https://discord.com/developers/docs/topics/gateway#update-presence-gateway-presence-update-structure
|
||||
*/
|
||||
export interface GatewayPresenceUpdateData {
|
||||
/**
|
||||
@@ -1528,7 +1530,7 @@ export interface GatewayPresenceUpdateData {
|
||||
/**
|
||||
* The user's new status
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-status-status-types
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-presence-status-types
|
||||
*/
|
||||
status: PresenceUpdateStatus;
|
||||
/**
|
||||
|
||||
@@ -28,6 +28,7 @@ import type {
|
||||
InviteTargetType,
|
||||
PresenceUpdateStatus,
|
||||
} from '../payloads/v9/index';
|
||||
import type { Nullable } from '../utils/internals';
|
||||
|
||||
export * from './common';
|
||||
|
||||
@@ -451,7 +452,7 @@ export interface GatewayReadyDispatchData {
|
||||
/**
|
||||
* Contains `id` and `flags`
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/oauth2#application-object
|
||||
* See https://discord.com/developers/docs/resources/application#application-object
|
||||
*/
|
||||
application: Pick<APIApplication, 'id' | 'flags'>;
|
||||
}
|
||||
@@ -744,9 +745,10 @@ export type GatewayGuildMemberUpdateDispatch = DataPayload<
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#guild-member-update
|
||||
*/
|
||||
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user'> &
|
||||
export type GatewayGuildMemberUpdateDispatchData = Omit<APIGuildMember, 'deaf' | 'mute' | 'user' | 'joined_at'> &
|
||||
Partial<Pick<APIGuildMember, 'deaf' | 'mute'>> &
|
||||
Required<Pick<APIGuildMember, 'user'>> & {
|
||||
Required<Pick<APIGuildMember, 'user'>> &
|
||||
Nullable<Pick<APIGuildMember, 'joined_at'>> & {
|
||||
/**
|
||||
* The id of the guild
|
||||
*/
|
||||
@@ -1464,7 +1466,7 @@ export interface GatewayIdentifyData {
|
||||
/**
|
||||
* Presence structure for initial presence information
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-status
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-presence
|
||||
*/
|
||||
presence?: GatewayPresenceUpdateData;
|
||||
/**
|
||||
@@ -1601,7 +1603,7 @@ export interface GatewayUpdatePresence {
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/gateway#update-status-gateway-status-update-structure
|
||||
* https://discord.com/developers/docs/topics/gateway#update-presence-gateway-presence-update-structure
|
||||
*/
|
||||
export interface GatewayPresenceUpdateData {
|
||||
/**
|
||||
@@ -1617,7 +1619,7 @@ export interface GatewayPresenceUpdateData {
|
||||
/**
|
||||
* The user's new status
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-status-status-types
|
||||
* See https://discord.com/developers/docs/topics/gateway#update-presence-status-types
|
||||
*/
|
||||
status: PresenceUpdateStatus;
|
||||
/**
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Permissions, Snowflake } from '../../../globals';
|
||||
import { InteractionType } from '../../v8';
|
||||
import { APIMessage } from '../channel';
|
||||
import { APIGuildMember } from '../guild';
|
||||
import { APIUser } from '../user';
|
||||
import type { Permissions, Snowflake } from '../../../globals';
|
||||
import type { InteractionType } from '../../v8';
|
||||
import type { APIMessage } from '../channel';
|
||||
import type { APIGuildMember } from '../guild';
|
||||
import type { APIUser } from '../user';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/slash-commands#message-interaction-object-message-interaction-structure
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ComponentType } from '../channel';
|
||||
import { APIBaseInteraction, InteractionType } from '../interactions';
|
||||
import { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base';
|
||||
import type { ComponentType } from '../channel';
|
||||
import type { APIBaseInteraction, InteractionType } from '../interactions';
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base';
|
||||
|
||||
export type APIMessageComponentInteraction = APIBaseInteraction<
|
||||
InteractionType.MessageComponent,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MessageFlags } from '../index';
|
||||
import { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8';
|
||||
import type { MessageFlags } from '../index';
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v8';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-request-type
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { APIRole, APIUser } from '../index';
|
||||
import { Permissions, Snowflake } from '../../../globals';
|
||||
import { APIPartialChannel } from '../channel';
|
||||
import { APIGuildMember } from '../guild';
|
||||
import { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base';
|
||||
import { InteractionType } from './responses';
|
||||
import type { APIRole, APIUser } from '../index';
|
||||
import type { Permissions, Snowflake } from '../../../globals';
|
||||
import type { APIPartialChannel } from '../channel';
|
||||
import type { APIGuildMember } from '../guild';
|
||||
import type { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base';
|
||||
import type { InteractionType } from './responses';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object
|
||||
|
||||
109
payloads/v8/application.ts
Normal file
109
payloads/v8/application.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Types extracted from https://discord.com/developers/docs/resources/application
|
||||
*/
|
||||
|
||||
import type { Snowflake } from '../../globals';
|
||||
import type { APITeam } from './teams';
|
||||
import type { APIUser } from './user';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/application#application-object
|
||||
*/
|
||||
export interface APIApplication {
|
||||
/**
|
||||
* The id of the app
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* The name of the app
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The icon hash of the app
|
||||
*/
|
||||
icon: string | null;
|
||||
/**
|
||||
* The description of the app
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* An array of rpc origin urls, if rpc is enabled
|
||||
*/
|
||||
rpc_origins?: string[];
|
||||
/**
|
||||
* When `false` only app owner can join the app's bot to guilds
|
||||
*/
|
||||
bot_public: boolean;
|
||||
/**
|
||||
* When `true` the app's bot will only join upon completion of the full oauth2 code grant flow
|
||||
*/
|
||||
bot_require_code_grant: boolean;
|
||||
/**
|
||||
* The url of the application's terms of service
|
||||
*/
|
||||
terms_of_service_url?: string;
|
||||
/**
|
||||
* The url of the application's privacy policy
|
||||
*/
|
||||
privacy_policy_url?: string;
|
||||
/**
|
||||
* Partial user object containing info on the owner of the application
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
owner?: APIUser;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the summary field for the store page
|
||||
* of its primary sku
|
||||
*/
|
||||
summary: string;
|
||||
/**
|
||||
* The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function
|
||||
*
|
||||
* See https://discord.com/developers/docs/game-sdk/applications#get-ticket
|
||||
*/
|
||||
verify_key: string;
|
||||
/**
|
||||
* The team this application belongs to
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/teams#data-models-team-object
|
||||
*/
|
||||
team: APITeam | null;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
|
||||
*/
|
||||
guild_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
|
||||
*/
|
||||
primary_sku_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
|
||||
*/
|
||||
slug?: string;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the hash of the image on store embeds
|
||||
*/
|
||||
cover_image?: string;
|
||||
/**
|
||||
* The application's public flags
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
*/
|
||||
flags: ApplicationFlags;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
*/
|
||||
export const enum ApplicationFlags {
|
||||
ManagedEmoji = 1 << 2,
|
||||
GroupDMCreate = 1 << 4,
|
||||
RPCHasConnected = 1 << 11,
|
||||
GatewayPresence = 1 << 12,
|
||||
GatewayPresenceLimited = 1 << 13,
|
||||
GatewayGuildMembers = 1 << 14,
|
||||
GatewayGuildMembersLimited = 1 << 15,
|
||||
VerificationPendingGuildLimit = 1 << 16,
|
||||
Embedded = 1 << 17,
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import type { Permissions, Snowflake } from '../../globals';
|
||||
import type { APIPartialEmoji } from './emoji';
|
||||
import type { APIGuildMember } from './guild';
|
||||
import type { APIMessageInteraction } from './interactions';
|
||||
import type { APIApplication } from './oauth2';
|
||||
import type { APIApplication } from './application';
|
||||
import type { APIRole } from './permissions';
|
||||
import type { APISticker, APIStickerItem } from './sticker';
|
||||
import type { APIUser } from './user';
|
||||
@@ -560,7 +560,7 @@ export interface APIEmbed {
|
||||
/**
|
||||
* Description of embed
|
||||
*
|
||||
* Length limit: 2048 characters
|
||||
* Length limit: 4096 characters
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
|
||||
@@ -246,7 +246,7 @@ export interface APIGuild extends APIPartialGuild {
|
||||
*/
|
||||
presences?: GatewayPresenceUpdate[];
|
||||
/**
|
||||
* The maximum number of presences for the guild (the default value, currently 25000, is in effect when `null` is returned)
|
||||
* The maximum number of presences for the guild (`null` is always returned, apart from the largest of guilds)
|
||||
*/
|
||||
max_presences?: number | null;
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './application';
|
||||
export * from './auditLog';
|
||||
export * from './channel';
|
||||
export * from './emoji';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
import type {
|
||||
APIMessageComponentDMInteraction,
|
||||
APIMessageComponentGuildInteraction,
|
||||
APIMessageComponentInteraction,
|
||||
} from './_interactions/messageComponents';
|
||||
import {
|
||||
import type {
|
||||
APIApplicationCommandDMInteraction,
|
||||
APIApplicationCommandGuildInteraction,
|
||||
APIApplicationCommandInteraction,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import type { APIPartialChannel } from './channel';
|
||||
import type { APIPartialGuild } from './guild';
|
||||
import type { APIApplication } from './oauth2';
|
||||
import type { APIApplication } from './application';
|
||||
import type { APIInviteStageInstance } from './stageInstance';
|
||||
import type { APIUser } from './user';
|
||||
|
||||
|
||||
@@ -2,107 +2,6 @@
|
||||
* Types extracted from https://discord.com/developers/docs/topics/oauth2
|
||||
*/
|
||||
|
||||
import type { Snowflake } from '../../globals';
|
||||
import type { APITeam } from './teams';
|
||||
import type { APIUser } from './user';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/oauth2#get-current-application-information-response-structure
|
||||
*/
|
||||
export interface APIApplication {
|
||||
/**
|
||||
* The id of the app
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* The name of the app
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The icon hash of the app
|
||||
*/
|
||||
icon: string | null;
|
||||
/**
|
||||
* The description of the app
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* An array of rpc origin urls, if rpc is enabled
|
||||
*/
|
||||
rpc_origins?: string[];
|
||||
/**
|
||||
* When `false` only app owner can join the app's bot to guilds
|
||||
*/
|
||||
bot_public: boolean;
|
||||
/**
|
||||
* When `true` the app's bot will only join upon completion of the full oauth2 code grant flow
|
||||
*/
|
||||
bot_require_code_grant: boolean;
|
||||
/**
|
||||
* The url of the application's terms of service
|
||||
*/
|
||||
terms_of_service_url?: string;
|
||||
/**
|
||||
* The url of the application's privacy policy
|
||||
*/
|
||||
privacy_policy_url?: string;
|
||||
/**
|
||||
* Partial user object containing info on the owner of the application
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
owner?: APIUser;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the summary field for the store page
|
||||
* of its primary sku
|
||||
*/
|
||||
summary: string;
|
||||
/**
|
||||
* The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function
|
||||
*
|
||||
* See https://discord.com/developers/docs/game-sdk/applications#get-ticket
|
||||
*/
|
||||
verify_key: string;
|
||||
/**
|
||||
* The team this application belongs to
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/teams#data-models-team-object
|
||||
*/
|
||||
team: APITeam | null;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
|
||||
*/
|
||||
guild_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
|
||||
*/
|
||||
primary_sku_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
|
||||
*/
|
||||
slug?: string;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the hash of the image on store embeds
|
||||
*/
|
||||
cover_image?: string;
|
||||
/**
|
||||
* The application's public flags
|
||||
*/
|
||||
flags: ApplicationFlags;
|
||||
}
|
||||
|
||||
export const enum ApplicationFlags {
|
||||
ManagedEmoji = 1 << 2,
|
||||
GroupDMCreate = 1 << 4,
|
||||
RPCHasConnected = 1 << 11,
|
||||
GatewayPresence = 1 << 12,
|
||||
GatewayPresenceLimited = 1 << 13,
|
||||
GatewayGuildMembers = 1 << 14,
|
||||
GatewayGuildMembersLimited = 1 << 15,
|
||||
VerificationPendingGuildLimit = 1 << 16,
|
||||
Embedded = 1 << 17,
|
||||
}
|
||||
|
||||
export const enum OAuth2Scopes {
|
||||
/**
|
||||
* For oauth2 bots, this puts the bot in the user's selected guild by default
|
||||
|
||||
@@ -21,6 +21,10 @@ export interface APITeam {
|
||||
* The members of the team
|
||||
*/
|
||||
members: APITeamMember[];
|
||||
/**
|
||||
* The name of the team
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The user id of the current team owner
|
||||
*/
|
||||
|
||||
@@ -72,4 +72,8 @@ export const enum WebhookType {
|
||||
* Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels
|
||||
*/
|
||||
ChannelFollower,
|
||||
/**
|
||||
* Application webhooks are webhooks used with Interactions
|
||||
*/
|
||||
Application,
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Permissions, Snowflake } from '../../../globals';
|
||||
import { InteractionType } from '../../v9';
|
||||
import { APIMessage } from '../channel';
|
||||
import { APIGuildMember } from '../guild';
|
||||
import { APIUser } from '../user';
|
||||
import type { Permissions, Snowflake } from '../../../globals';
|
||||
import type { InteractionType } from '../../v9';
|
||||
import type { APIMessage } from '../channel';
|
||||
import type { APIGuildMember } from '../guild';
|
||||
import type { APIUser } from '../user';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/slash-commands#message-interaction-object-message-interaction-structure
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ComponentType } from '../channel';
|
||||
import { APIBaseInteraction, InteractionType } from '../interactions';
|
||||
import { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base';
|
||||
import type { ComponentType } from '../channel';
|
||||
import type { APIBaseInteraction, InteractionType } from '../interactions';
|
||||
import type { APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base';
|
||||
|
||||
export type APIMessageComponentInteraction = APIBaseInteraction<
|
||||
InteractionType.MessageComponent,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { MessageFlags } from '../index';
|
||||
import { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9';
|
||||
import type { MessageFlags } from '../index';
|
||||
import type { RESTPostAPIWebhookWithTokenJSONBody } from '../../../v9';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/slash-commands#interaction-object-interaction-request-type
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { APIRole, APIUser } from '../index';
|
||||
import { Permissions, Snowflake } from '../../../globals';
|
||||
import { APIPartialChannel } from '../channel';
|
||||
import { APIGuildMember } from '../guild';
|
||||
import { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base';
|
||||
import { InteractionType } from './responses';
|
||||
import type { APIRole, APIUser } from '../index';
|
||||
import type { Permissions, Snowflake } from '../../../globals';
|
||||
import type { APIPartialChannel } from '../channel';
|
||||
import type { APIGuildMember } from '../guild';
|
||||
import type { APIBaseInteraction, APIDMInteractionWrapper, APIGuildInteractionWrapper } from './base';
|
||||
import type { InteractionType } from './responses';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/interactions/slash-commands#application-command-object
|
||||
|
||||
109
payloads/v9/application.ts
Normal file
109
payloads/v9/application.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Types extracted from https://discord.com/developers/docs/resources/application
|
||||
*/
|
||||
|
||||
import type { Snowflake } from '../../globals';
|
||||
import type { APITeam } from './teams';
|
||||
import type { APIUser } from './user';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/application#application-object
|
||||
*/
|
||||
export interface APIApplication {
|
||||
/**
|
||||
* The id of the app
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* The name of the app
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The icon hash of the app
|
||||
*/
|
||||
icon: string | null;
|
||||
/**
|
||||
* The description of the app
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* An array of rpc origin urls, if rpc is enabled
|
||||
*/
|
||||
rpc_origins?: string[];
|
||||
/**
|
||||
* When `false` only app owner can join the app's bot to guilds
|
||||
*/
|
||||
bot_public: boolean;
|
||||
/**
|
||||
* When `true` the app's bot will only join upon completion of the full oauth2 code grant flow
|
||||
*/
|
||||
bot_require_code_grant: boolean;
|
||||
/**
|
||||
* The url of the application's terms of service
|
||||
*/
|
||||
terms_of_service_url?: string;
|
||||
/**
|
||||
* The url of the application's privacy policy
|
||||
*/
|
||||
privacy_policy_url?: string;
|
||||
/**
|
||||
* Partial user object containing info on the owner of the application
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
owner?: APIUser;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the summary field for the store page
|
||||
* of its primary sku
|
||||
*/
|
||||
summary: string;
|
||||
/**
|
||||
* The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function
|
||||
*
|
||||
* See https://discord.com/developers/docs/game-sdk/applications#get-ticket
|
||||
*/
|
||||
verify_key: string;
|
||||
/**
|
||||
* The team this application belongs to
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/teams#data-models-team-object
|
||||
*/
|
||||
team: APITeam | null;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
|
||||
*/
|
||||
guild_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
|
||||
*/
|
||||
primary_sku_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
|
||||
*/
|
||||
slug?: string;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the hash of the image on store embeds
|
||||
*/
|
||||
cover_image?: string;
|
||||
/**
|
||||
* The application's public flags
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
*/
|
||||
flags: ApplicationFlags;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/application#application-object-application-flags
|
||||
*/
|
||||
export const enum ApplicationFlags {
|
||||
ManagedEmoji = 1 << 2,
|
||||
GroupDMCreate = 1 << 4,
|
||||
RPCHasConnected = 1 << 11,
|
||||
GatewayPresence = 1 << 12,
|
||||
GatewayPresenceLimited = 1 << 13,
|
||||
GatewayGuildMembers = 1 << 14,
|
||||
GatewayGuildMembersLimited = 1 << 15,
|
||||
VerificationPendingGuildLimit = 1 << 16,
|
||||
Embedded = 1 << 17,
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import type { Permissions, Snowflake } from '../../globals';
|
||||
import type { APIPartialEmoji } from './emoji';
|
||||
import type { APIGuildMember } from './guild';
|
||||
import type { APIMessageInteraction } from './interactions';
|
||||
import type { APIApplication } from './oauth2';
|
||||
import type { APIApplication } from './application';
|
||||
import type { APIRole } from './permissions';
|
||||
import type { APISticker, APIStickerItem } from './sticker';
|
||||
import type { APIUser } from './user';
|
||||
@@ -680,7 +680,7 @@ export interface APIEmbed {
|
||||
/**
|
||||
* Description of embed
|
||||
*
|
||||
* Length limit: 2048 characters
|
||||
* Length limit: 4096 characters
|
||||
*/
|
||||
description?: string;
|
||||
/**
|
||||
|
||||
@@ -254,7 +254,7 @@ export interface APIGuild extends APIPartialGuild {
|
||||
*/
|
||||
presences?: GatewayPresenceUpdate[];
|
||||
/**
|
||||
* The maximum number of presences for the guild (the default value, currently 25000, is in effect when `null` is returned)
|
||||
* The maximum number of presences for the guild (`null` is always returned, apart from the largest of guilds)
|
||||
*/
|
||||
max_presences?: number | null;
|
||||
/**
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export * from './application';
|
||||
export * from './auditLog';
|
||||
export * from './channel';
|
||||
export * from './emoji';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
import type {
|
||||
APIMessageComponentDMInteraction,
|
||||
APIMessageComponentGuildInteraction,
|
||||
APIMessageComponentInteraction,
|
||||
} from './_interactions/messageComponents';
|
||||
import {
|
||||
import type {
|
||||
APIApplicationCommandDMInteraction,
|
||||
APIApplicationCommandGuildInteraction,
|
||||
APIApplicationCommandInteraction,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import type { APIPartialChannel } from './channel';
|
||||
import type { APIPartialGuild } from './guild';
|
||||
import type { APIApplication } from './oauth2';
|
||||
import type { APIApplication } from './application';
|
||||
import type { APIInviteStageInstance } from './stageInstance';
|
||||
import type { APIUser } from './user';
|
||||
|
||||
|
||||
@@ -2,107 +2,6 @@
|
||||
* Types extracted from https://discord.com/developers/docs/topics/oauth2
|
||||
*/
|
||||
|
||||
import type { Snowflake } from '../../globals';
|
||||
import type { APITeam } from './teams';
|
||||
import type { APIUser } from './user';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/topics/oauth2#get-current-application-information-response-structure
|
||||
*/
|
||||
export interface APIApplication {
|
||||
/**
|
||||
* The id of the app
|
||||
*/
|
||||
id: Snowflake;
|
||||
/**
|
||||
* The name of the app
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The icon hash of the app
|
||||
*/
|
||||
icon: string | null;
|
||||
/**
|
||||
* The description of the app
|
||||
*/
|
||||
description: string;
|
||||
/**
|
||||
* An array of rpc origin urls, if rpc is enabled
|
||||
*/
|
||||
rpc_origins?: string[];
|
||||
/**
|
||||
* When `false` only app owner can join the app's bot to guilds
|
||||
*/
|
||||
bot_public: boolean;
|
||||
/**
|
||||
* When `true` the app's bot will only join upon completion of the full oauth2 code grant flow
|
||||
*/
|
||||
bot_require_code_grant: boolean;
|
||||
/**
|
||||
* The url of the application's terms of service
|
||||
*/
|
||||
terms_of_service_url?: string;
|
||||
/**
|
||||
* The url of the application's privacy policy
|
||||
*/
|
||||
privacy_policy_url?: string;
|
||||
/**
|
||||
* Partial user object containing info on the owner of the application
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/user#user-object
|
||||
*/
|
||||
owner?: APIUser;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the summary field for the store page
|
||||
* of its primary sku
|
||||
*/
|
||||
summary: string;
|
||||
/**
|
||||
* The hexadecimal encoded key for verification in interactions and the GameSDK's GetTicket function
|
||||
*
|
||||
* See https://discord.com/developers/docs/game-sdk/applications#get-ticket
|
||||
*/
|
||||
verify_key: string;
|
||||
/**
|
||||
* The team this application belongs to
|
||||
*
|
||||
* See https://discord.com/developers/docs/topics/teams#data-models-team-object
|
||||
*/
|
||||
team: APITeam | null;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the guild to which it has been linked
|
||||
*/
|
||||
guild_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the id of the "Game SKU" that is created, if exists
|
||||
*/
|
||||
primary_sku_id?: Snowflake;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the URL slug that links to the store page
|
||||
*/
|
||||
slug?: string;
|
||||
/**
|
||||
* If this application is a game sold on Discord, this field will be the hash of the image on store embeds
|
||||
*/
|
||||
cover_image?: string;
|
||||
/**
|
||||
* The application's public flags
|
||||
*/
|
||||
flags: ApplicationFlags;
|
||||
}
|
||||
|
||||
export const enum ApplicationFlags {
|
||||
ManagedEmoji = 1 << 2,
|
||||
GroupDMCreate = 1 << 4,
|
||||
RPCHasConnected = 1 << 11,
|
||||
GatewayPresence = 1 << 12,
|
||||
GatewayPresenceLimited = 1 << 13,
|
||||
GatewayGuildMembers = 1 << 14,
|
||||
GatewayGuildMembersLimited = 1 << 15,
|
||||
VerificationPendingGuildLimit = 1 << 16,
|
||||
Embedded = 1 << 17,
|
||||
}
|
||||
|
||||
export const enum OAuth2Scopes {
|
||||
/**
|
||||
* For oauth2 bots, this puts the bot in the user's selected guild by default
|
||||
|
||||
@@ -21,6 +21,10 @@ export interface APITeam {
|
||||
* The members of the team
|
||||
*/
|
||||
members: APITeamMember[];
|
||||
/**
|
||||
* The name of the team
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* The user id of the current team owner
|
||||
*/
|
||||
|
||||
@@ -72,4 +72,8 @@ export const enum WebhookType {
|
||||
* Channel Follower Webhooks are internal webhooks used with Channel Following to post new messages into channels
|
||||
*/
|
||||
ChannelFollower,
|
||||
/**
|
||||
* Application webhooks are webhooks used with Interactions
|
||||
*/
|
||||
Application,
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ export const enum RESTJSONErrorCodes {
|
||||
UnknownUser,
|
||||
UnknownEmoji,
|
||||
UnknownWebhook,
|
||||
UnknownWebhookService,
|
||||
|
||||
UnknownSession = 10020,
|
||||
|
||||
UnknownBan = 10026,
|
||||
UnknownSKU,
|
||||
@@ -27,30 +30,52 @@ export const enum RESTJSONErrorCodes {
|
||||
UnknownBuild,
|
||||
UnknownLobby,
|
||||
UnknownBranch,
|
||||
UnknownStoreDirectoryLayout,
|
||||
|
||||
UnknownRedistributable = 10036,
|
||||
|
||||
UnknownGiftCode = 10038,
|
||||
|
||||
UnknownGuildTemplate = 10057,
|
||||
|
||||
UnknownSticker = 10060,
|
||||
UnknownDiscoverableServerCategory = 10059,
|
||||
UnknownSticker,
|
||||
|
||||
UnknownInteraction = 10062,
|
||||
UnknownApplicationCommand,
|
||||
|
||||
UnknownApplicationCommandPermissions = 10066,
|
||||
UnknownStageInstance,
|
||||
UnknownGuildMemberVerificationForm,
|
||||
UnknownGuildWelcomeScreen,
|
||||
|
||||
BotsCannotUseThisEndpoint = 20001,
|
||||
OnlyBotsCanUseThisEndpoint,
|
||||
|
||||
ExplicitContentCannotBeSentToTheDesiredRecipient = 20009,
|
||||
|
||||
NotAuthorizedToPerformThisActionOnThisApplication = 20012,
|
||||
|
||||
ActionCannotBePerformedDueToSlowmodeRateLimit = 20016,
|
||||
|
||||
OnlyTheOwnerOfThisAccountCanPerformThisAction = 20018,
|
||||
|
||||
AnnouncementEditLimitExceeded = 20022,
|
||||
|
||||
ChannelSendRateLimit = 20028,
|
||||
|
||||
StageTopicServerNameServerDescriptionOrChannelNamesContainDisallowedWords = 20031,
|
||||
|
||||
GuildPremiumSubscriptionLevelTooLow = 20035,
|
||||
|
||||
MaximumNumberOfGuildsReached = 30001,
|
||||
MaximumNumberOfFriendsReached,
|
||||
MaximumNumberOfPinsReachedForTheChannel,
|
||||
|
||||
MaximumNumberOfGuildRolesReached = 30005,
|
||||
MaximumNumberOfRecipientsReached,
|
||||
MaximumNumberOfGuildRolesReached,
|
||||
|
||||
MaximumNumberOfWebhooksReached = 30007,
|
||||
MaximumNumberOfEmojisReached,
|
||||
|
||||
MaximumNumberOfReactionsReached = 30010,
|
||||
|
||||
@@ -59,20 +84,33 @@ export const enum RESTJSONErrorCodes {
|
||||
MaximumNumberOfAttachmentsInAMessageReached = 30015,
|
||||
MaximumNumberOfInvitesReached,
|
||||
|
||||
MaximumNumberOfAnimatedEmojisReached = 30018,
|
||||
MaximumNumberOfServerMembersReached,
|
||||
|
||||
MaximumNumberOfServerCategoriesReached = 30030,
|
||||
|
||||
GuildAlreadyHasTemplate = 30031,
|
||||
|
||||
MaximumThreadParticipants = 30033,
|
||||
|
||||
MaximumNumberOfNonGuildMemberBansHasBeenExceeded = 30035,
|
||||
|
||||
MaximumNumberOfBanFetchesHasBeenReached = 30037,
|
||||
|
||||
MaximumNumberOfStickersReached = 30039,
|
||||
|
||||
Unauthorized = 40001,
|
||||
VerifyYourAccount,
|
||||
OpeningDirectMessagesTooFast,
|
||||
|
||||
RequestEntityTooLarge = 40005,
|
||||
FeatureTemporarilyDisabledServerSide,
|
||||
UserBannedFromThisGuild,
|
||||
|
||||
ThisMessageWasAlreadyCrossposted = 40033,
|
||||
TargetUserIsNotConnectedToVoice = 40032,
|
||||
ThisMessageWasAlreadyCrossposted,
|
||||
|
||||
ApplicationCommandWithThatNameAlreadyExists = 40041,
|
||||
|
||||
MissingAccess = 50001,
|
||||
InvalidAccountType,
|
||||
@@ -99,6 +137,7 @@ export const enum RESTJSONErrorCodes {
|
||||
InvalidOAuth2AccessToken,
|
||||
|
||||
InvalidWebhookToken = 50027,
|
||||
InvalidRole,
|
||||
|
||||
InvalidRecipients = 50033,
|
||||
OneOfTheMessagesProvidedWasTooOldForBulkDelete,
|
||||
@@ -110,6 +149,8 @@ export const enum RESTJSONErrorCodes {
|
||||
FileUploadedExceedsMaximumSize = 50045,
|
||||
InvalidFileUploaded,
|
||||
|
||||
CannotSelfRedeemThisGift = 50070,
|
||||
|
||||
CannotDeleteChannelRequiredForCommunityGuilds = 50074,
|
||||
|
||||
InvalidStickerSent = 50081,
|
||||
@@ -120,10 +161,14 @@ export const enum RESTJSONErrorCodes {
|
||||
|
||||
TwoFactorAuthenticationIsRequired = 60003,
|
||||
|
||||
NoUsersWithDiscordTagExist = 80004,
|
||||
|
||||
ReactionWasBlocked = 90001,
|
||||
|
||||
APIResourceOverloaded = 130000,
|
||||
|
||||
TheStageIsAlreadyOpen = 150006,
|
||||
|
||||
ThreadAlreadyCreatedForMessage = 160004,
|
||||
ThreadLocked,
|
||||
MaximumActiveThreads,
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import type { Permissions, Snowflake } from '../../globals';
|
||||
import type {
|
||||
APIActionRowComponent,
|
||||
APIAllowedMentions,
|
||||
APIAttachment,
|
||||
APIChannel,
|
||||
APIEmbed,
|
||||
APIExtendedInvite,
|
||||
@@ -26,7 +28,7 @@ export type RESTGetAPIChannelResult = APIChannel;
|
||||
*/
|
||||
export interface RESTPatchAPIChannelJSONBody {
|
||||
/**
|
||||
* 2-100 character channel name
|
||||
* 1-100 character channel name
|
||||
*
|
||||
* Channel types: all
|
||||
*/
|
||||
@@ -200,6 +202,12 @@ export interface RESTPostAPIChannelMessageJSONBody {
|
||||
* See https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
|
||||
*/
|
||||
message_reference?: APIMessageReferenceSend;
|
||||
/**
|
||||
* The components to include with the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
/**
|
||||
* IDs of up to 3 stickers in the server to send in the message
|
||||
*
|
||||
@@ -295,10 +303,15 @@ export interface RESTPatchAPIChannelMessageJSONBody {
|
||||
content?: string | null;
|
||||
/**
|
||||
* Embedded `rich` content (up to 6000 characters)
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
*/
|
||||
embeds?: APIEmbed[];
|
||||
embeds?: APIEmbed[] | null;
|
||||
/**
|
||||
* Embedded `rich` content
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
* @deprecated Use `embeds` instead
|
||||
*/
|
||||
embed?: APIEmbed | null;
|
||||
/**
|
||||
@@ -306,14 +319,50 @@ export interface RESTPatchAPIChannelMessageJSONBody {
|
||||
*
|
||||
* When specifying flags, ensure to include all previously set flags/bits
|
||||
* in addition to ones that you are modifying
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#message-object-message-flags
|
||||
*/
|
||||
flags?: MessageFlags | null;
|
||||
/**
|
||||
* Allowed mentions for the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#allowed-mentions-object
|
||||
*/
|
||||
allowed_mentions?: APIAllowedMentions | null;
|
||||
/**
|
||||
* Attached files to keep
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#attachment-object
|
||||
*/
|
||||
attachments?: APIAttachment[] | null;
|
||||
/**
|
||||
* The components to include with the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#edit-message
|
||||
*/
|
||||
export type RESTPatchAPIChannelMessageFormDataBody =
|
||||
| {
|
||||
/**
|
||||
* JSON stringified message body
|
||||
*/
|
||||
payload_json?: string;
|
||||
/**
|
||||
* The file contents
|
||||
*/
|
||||
file: unknown;
|
||||
}
|
||||
| (RESTPatchAPIChannelMessageJSONBody & {
|
||||
/**
|
||||
* The file contents
|
||||
*/
|
||||
file: unknown;
|
||||
});
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#edit-message
|
||||
*/
|
||||
|
||||
@@ -20,6 +20,7 @@ import type {
|
||||
GuildVerificationLevel,
|
||||
GuildWidgetStyle,
|
||||
} from '../../payloads/v8/index';
|
||||
import type { Nullable } from '../../utils/internals';
|
||||
import type { RESTPutAPIChannelPermissionJSONBody } from './channel';
|
||||
|
||||
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody {
|
||||
@@ -774,7 +775,3 @@ export interface RESTPatchAPIGuildWelcomeScreenJSONBody extends Nullable<Partial
|
||||
*/
|
||||
enabled?: boolean | null;
|
||||
}
|
||||
|
||||
type Nullable<T> = {
|
||||
[P in keyof T]: T[P] | null;
|
||||
};
|
||||
|
||||
@@ -5,7 +5,9 @@ import type {
|
||||
APIEmbed,
|
||||
APIMessage,
|
||||
APIWebhook,
|
||||
APIAttachment,
|
||||
} from '../../payloads/v8/index';
|
||||
import type { Nullable } from '../../utils/internals';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#create-webhook
|
||||
@@ -115,14 +117,22 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
|
||||
tts?: boolean;
|
||||
/**
|
||||
* Embedded `rich` content
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
*/
|
||||
embeds?: APIEmbed[];
|
||||
/**
|
||||
* Allowed mentions for the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#allowed-mentions-object
|
||||
*/
|
||||
allowed_mentions?: APIAllowedMentions;
|
||||
/**
|
||||
* the components to include with the message
|
||||
* The components to include with the message
|
||||
*
|
||||
* Requires an application-owned webhook
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
}
|
||||
@@ -213,9 +223,17 @@ export type RESTPostAPIWebhookWithTokenGitHubWaitResult = APIMessage;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
|
||||
*/
|
||||
export type RESTPatchAPIWebhookWithTokenMessageJSONBody = Nullable<
|
||||
Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions'>
|
||||
>;
|
||||
export interface RESTPatchAPIWebhookWithTokenMessageJSONBody
|
||||
extends Nullable<
|
||||
Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions' | 'components'>
|
||||
> {
|
||||
/**
|
||||
* Attached files to keep
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#attachment-object
|
||||
*/
|
||||
attachments?: APIAttachment[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
|
||||
@@ -252,7 +270,3 @@ export type RESTPatchAPIWebhookWithTokenMessageResult = APIMessage;
|
||||
* https://discord.com/developers/docs/resources/webhook#delete-webhook-message
|
||||
*/
|
||||
export type RESTDeleteAPIWebhookWithTokenMessageResult = never;
|
||||
|
||||
type Nullable<T> = {
|
||||
[P in keyof T]: T[P] | null;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import type { Permissions, Snowflake } from '../../globals';
|
||||
import type {
|
||||
APIActionRowComponent,
|
||||
APIAllowedMentions,
|
||||
APIAttachment,
|
||||
APIChannel,
|
||||
APIEmbed,
|
||||
APIExtendedInvite,
|
||||
@@ -29,7 +31,7 @@ export type RESTGetAPIChannelResult = APIChannel;
|
||||
*/
|
||||
export interface RESTPatchAPIChannelJSONBody {
|
||||
/**
|
||||
* 2-100 character channel name
|
||||
* 1-100 character channel name
|
||||
*
|
||||
* Channel types: all
|
||||
*/
|
||||
@@ -228,6 +230,12 @@ export interface RESTPostAPIChannelMessageJSONBody {
|
||||
* See https://discord.com/developers/docs/resources/channel#message-object-message-reference-structure
|
||||
*/
|
||||
message_reference?: APIMessageReferenceSend;
|
||||
/**
|
||||
* The components to include with the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
/**
|
||||
* IDs of up to 3 stickers in the server to send in the message
|
||||
*
|
||||
@@ -323,10 +331,14 @@ export interface RESTPatchAPIChannelMessageJSONBody {
|
||||
content?: string | null;
|
||||
/**
|
||||
* Embedded `rich` content (up to 6000 characters)
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
*/
|
||||
embeds?: APIEmbed[];
|
||||
embeds?: APIEmbed[] | null;
|
||||
/**
|
||||
* Embedded `rich` content
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
* @deprecated Use `embeds` instead
|
||||
*/
|
||||
embed?: APIEmbed | null;
|
||||
@@ -335,14 +347,51 @@ export interface RESTPatchAPIChannelMessageJSONBody {
|
||||
*
|
||||
* When specifying flags, ensure to include all previously set flags/bits
|
||||
* in addition to ones that you are modifying
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#message-object-message-flags
|
||||
*/
|
||||
flags?: MessageFlags | null;
|
||||
/**
|
||||
* Allowed mentions for the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#allowed-mentions-object
|
||||
*/
|
||||
allowed_mentions?: APIAllowedMentions | null;
|
||||
/**
|
||||
* Attached files to keep
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#attachment-object
|
||||
*/
|
||||
attachments?: APIAttachment[] | null;
|
||||
/**
|
||||
* The components to include with the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#edit-message
|
||||
*/
|
||||
export type RESTPatchAPIChannelMessageFormDataBody =
|
||||
| {
|
||||
/**
|
||||
* JSON stringified message body
|
||||
*/
|
||||
payload_json?: string;
|
||||
/**
|
||||
* The file contents
|
||||
*/
|
||||
file: unknown;
|
||||
}
|
||||
| (RESTPatchAPIChannelMessageJSONBody & {
|
||||
/**
|
||||
* The file contents
|
||||
*/
|
||||
file: unknown;
|
||||
});
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/channel#edit-message
|
||||
*/
|
||||
@@ -523,7 +572,7 @@ export type RESTDeleteAPIChannelRecipientResult = unknown;
|
||||
*/
|
||||
export interface RESTPostAPIChannelMessagesThreadsJSONBody {
|
||||
/**
|
||||
* 2-100 character thread name
|
||||
* 1-100 character thread name
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
|
||||
@@ -20,6 +20,7 @@ import type {
|
||||
GuildVerificationLevel,
|
||||
GuildWidgetStyle,
|
||||
} from '../../payloads/v9/index';
|
||||
import type { Nullable } from '../../utils/internals';
|
||||
import type { RESTPutAPIChannelPermissionJSONBody } from './channel';
|
||||
|
||||
export interface APIGuildCreateOverwrite extends RESTPutAPIChannelPermissionJSONBody {
|
||||
@@ -774,7 +775,3 @@ export interface RESTPatchAPIGuildWelcomeScreenJSONBody extends Nullable<Partial
|
||||
*/
|
||||
enabled?: boolean | null;
|
||||
}
|
||||
|
||||
type Nullable<T> = {
|
||||
[P in keyof T]: T[P] | null;
|
||||
};
|
||||
|
||||
@@ -5,7 +5,9 @@ import type {
|
||||
APIEmbed,
|
||||
APIMessage,
|
||||
APIWebhook,
|
||||
APIAttachment,
|
||||
} from '../../payloads/v9/index';
|
||||
import type { Nullable } from '../../utils/internals';
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#create-webhook
|
||||
@@ -115,18 +117,22 @@ export interface RESTPostAPIWebhookWithTokenJSONBody {
|
||||
tts?: boolean;
|
||||
/**
|
||||
* Embedded `rich` content
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#embed-object
|
||||
*/
|
||||
embeds?: APIEmbed[];
|
||||
/**
|
||||
* Allowed mentions for the message
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#allowed-mentions-object
|
||||
*/
|
||||
allowed_mentions?: APIAllowedMentions;
|
||||
/**
|
||||
* The thread to post this message in
|
||||
*/
|
||||
thread_id?: Snowflake;
|
||||
/**
|
||||
* the components to include with the message
|
||||
* The components to include with the message
|
||||
*
|
||||
* Requires an application-owned webhook
|
||||
*
|
||||
* See https://discord.com/developers/docs/interactions/message-components#component-object
|
||||
*/
|
||||
components?: APIActionRowComponent[];
|
||||
}
|
||||
@@ -163,6 +169,10 @@ export interface RESTPostAPIWebhookWithTokenQuery {
|
||||
* @default false
|
||||
*/
|
||||
wait?: boolean;
|
||||
/**
|
||||
* Send a message to the specified thread within a webhook's channel. The thread will automatically be unarchived.
|
||||
*/
|
||||
thread_id?: Snowflake;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -217,9 +227,17 @@ export type RESTPostAPIWebhookWithTokenGitHubWaitResult = APIMessage;
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
|
||||
*/
|
||||
export type RESTPatchAPIWebhookWithTokenMessageJSONBody = Nullable<
|
||||
Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions'>
|
||||
>;
|
||||
export interface RESTPatchAPIWebhookWithTokenMessageJSONBody
|
||||
extends Nullable<
|
||||
Pick<RESTPostAPIWebhookWithTokenJSONBody, 'content' | 'embeds' | 'allowed_mentions' | 'components'>
|
||||
> {
|
||||
/**
|
||||
* Attached files to keep
|
||||
*
|
||||
* See https://discord.com/developers/docs/resources/channel#attachment-object
|
||||
*/
|
||||
attachments?: APIAttachment[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* https://discord.com/developers/docs/resources/webhook#edit-webhook-message
|
||||
@@ -256,7 +274,3 @@ export type RESTPatchAPIWebhookWithTokenMessageResult = APIMessage;
|
||||
* https://discord.com/developers/docs/resources/webhook#delete-webhook-message
|
||||
*/
|
||||
export type RESTDeleteAPIWebhookWithTokenMessageResult = never;
|
||||
|
||||
type Nullable<T> = {
|
||||
[P in keyof T]: T[P] | null;
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"noUnusedLocals": true,
|
||||
"removeComments": false,
|
||||
"target": "ES2020",
|
||||
"importsNotUsedAsValues": "remove",
|
||||
"importsNotUsedAsValues": "error",
|
||||
"strictNullChecks": true,
|
||||
"preserveConstEnums": true
|
||||
},
|
||||
|
||||
3
utils/internals.ts
Normal file
3
utils/internals.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export type Nullable<T> = {
|
||||
[P in keyof T]: T[P] | null;
|
||||
};
|
||||
Reference in New Issue
Block a user