Compare commits

...

10 Commits

Author SHA1 Message Date
Vlad Frangu
ab1951b7b9 chore(release): 0.20.2 🎉 (#165) 2021-07-21 12:57:08 +03:00
Vlad Frangu
ff75eb3f5d fix(APIInteraction): bring back Ping type (#164)
* fix(APIInteraction): bring back Ping type

* fix(APIPingInteraction): there be no data here!
2021-07-21 12:52:28 +03:00
Vlad Frangu
f0f44e6db4 chore(release): 0.20.1 🎉 (#163) 2021-07-20 14:52:22 +03:00
Advaith
f99f07f72e feat(Interactions): add interaction response and followup route (#162) 2021-07-20 14:04:09 +03:00
Vlad Frangu
b9d61aed90 chore(release): 0.20.0 🎉 (#161) 2021-07-20 10:33:35 +03:00
Advaith
d009554cae 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`
2021-07-20 10:25:51 +03:00
Advaith
8dbeca0fc9 feat(RESTJSONErrorCodes): add sticker errors (#155)
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2021-07-20 01:46:12 +03:00
Advaith
5dccc6b2a3 feat(PermissionFlagsBits): add UseExternalStickers (1n << 37n) (#154) 2021-07-20 01:29:03 +03:00
Antonio Román
323e531a77 refactor: change xID to xId (#159)
BREAKING CHANGE: All types that contained the `ID` word in them have had it renamed to `Id` (ex: `APIButtonComponentWithCustomID` is now `APIButtonComponentWithCustomId`)
2021-07-20 01:17:39 +03:00
Advaith
634f64d4ce refactor: rename isStyledButton to isInteractionButton (#158)
BREAKING CHANGE: The `isStyledButton` util has been renamed to `isInteractionButton`
2021-07-20 00:43:48 +03:00
105 changed files with 2142 additions and 1268 deletions

View File

@@ -1,3 +1,38 @@
## [0.20.2](https://github.com/discordjs/discord-api-types/compare/0.21.0...0.20.2) (2021-07-21)
### Bug Fixes
- **APIInteraction:** bring back Ping type ([#164](https://github.com/discordjs/discord-api-types/issues/164)) ([ff75eb3](https://github.com/discordjs/discord-api-types/commit/ff75eb3f5dfd7597968c26133d125cfe40ee5838))
## [0.20.1](https://github.com/discordjs/discord-api-types/compare/0.20.0...0.20.1) (2021-07-20)
### Features
- **Interactions:** add interaction response and followup route ([#162](https://github.com/discordjs/discord-api-types/issues/162)) ([f99f07f](https://github.com/discordjs/discord-api-types/commit/f99f07f72e95a9537a955eb942b52e345c1067d6))
# [0.20.0](https://github.com/discordjs/discord-api-types/compare/0.19.0...0.20.0) (2021-07-20)
### chore
- Add more missing stuff ([#160](https://github.com/discordjs/discord-api-types/issues/160)) ([d009554](https://github.com/discordjs/discord-api-types/commit/d009554caed6c738c4a801f00806ab7cc4ac7e16))
### Code Refactoring
- change `xID` to `xId` ([#159](https://github.com/discordjs/discord-api-types/issues/159)) ([323e531](https://github.com/discordjs/discord-api-types/commit/323e531a77aa75397ee1ce59f0db35b08b80b606))
- rename `isStyledButton` to `isInteractionButton` ([#158](https://github.com/discordjs/discord-api-types/issues/158)) ([634f64d](https://github.com/discordjs/discord-api-types/commit/634f64d4ce143bd0a6b9ccf0ffb1241c21550958))
### Features
- **PermissionFlagsBits:** add `UseExternalStickers` (1n << 37n) ([#154](https://github.com/discordjs/discord-api-types/issues/154)) ([5dccc6b](https://github.com/discordjs/discord-api-types/commit/5dccc6b2a3711e14d499ee9a2122403a80da99fe))
- **RESTJSONErrorCodes:** add sticker errors ([#155](https://github.com/discordjs/discord-api-types/issues/155)) ([8dbeca0](https://github.com/discordjs/discord-api-types/commit/8dbeca0fc91cafef59eb8ee30bcfee9ab14a422c))
### BREAKING CHANGES
- `GatewayGuildMemberUpdateDispatchData#joined_at` is properly marked as nullable now
- In v9, `thread_id` was incorrectly placed in `RESTPostAPIWebhookWithTokenJSONBody` and has been moved to `RESTPostAPIWebhookWithTokenQuery`
- All types that contained the `ID` word in them have had it renamed to `Id` (ex: `APIButtonComponentWithCustomID` is now `APIButtonComponentWithCustomId`)
- The `isStyledButton` util has been renamed to `isInteractionButton`
# [0.19.0](https://github.com/discordjs/discord-api-types/compare/0.18.1...0.19.0) (2021-07-19)
### Bug Fixes

View File

@@ -1,3 +1,38 @@
## [0.20.2](https://github.com/discordjs/discord-api-types/compare/0.21.0...0.20.2) (2021-07-21)
### Bug Fixes
- **APIInteraction:** bring back Ping type ([#164](https://github.com/discordjs/discord-api-types/issues/164)) ([ff75eb3](https://github.com/discordjs/discord-api-types/commit/ff75eb3f5dfd7597968c26133d125cfe40ee5838))
## [0.20.1](https://github.com/discordjs/discord-api-types/compare/0.20.0...0.20.1) (2021-07-20)
### Features
- **Interactions:** add interaction response and followup route ([#162](https://github.com/discordjs/discord-api-types/issues/162)) ([f99f07f](https://github.com/discordjs/discord-api-types/commit/f99f07f72e95a9537a955eb942b52e345c1067d6))
# [0.20.0](https://github.com/discordjs/discord-api-types/compare/0.19.0...0.20.0) (2021-07-20)
### chore
- Add more missing stuff ([#160](https://github.com/discordjs/discord-api-types/issues/160)) ([d009554](https://github.com/discordjs/discord-api-types/commit/d009554caed6c738c4a801f00806ab7cc4ac7e16))
### Code Refactoring
- change `xID` to `xId` ([#159](https://github.com/discordjs/discord-api-types/issues/159)) ([323e531](https://github.com/discordjs/discord-api-types/commit/323e531a77aa75397ee1ce59f0db35b08b80b606))
- rename `isStyledButton` to `isInteractionButton` ([#158](https://github.com/discordjs/discord-api-types/issues/158)) ([634f64d](https://github.com/discordjs/discord-api-types/commit/634f64d4ce143bd0a6b9ccf0ffb1241c21550958))
### Features
- **PermissionFlagsBits:** add `UseExternalStickers` (1n << 37n) ([#154](https://github.com/discordjs/discord-api-types/issues/154)) ([5dccc6b](https://github.com/discordjs/discord-api-types/commit/5dccc6b2a3711e14d499ee9a2122403a80da99fe))
- **RESTJSONErrorCodes:** add sticker errors ([#155](https://github.com/discordjs/discord-api-types/issues/155)) ([8dbeca0](https://github.com/discordjs/discord-api-types/commit/8dbeca0fc91cafef59eb8ee30bcfee9ab14a422c))
### BREAKING CHANGES
- `GatewayGuildMemberUpdateDispatchData#joined_at` is properly marked as nullable now
- In v9, `thread_id` was incorrectly placed in `RESTPostAPIWebhookWithTokenJSONBody` and has been moved to `RESTPostAPIWebhookWithTokenQuery`
- All types that contained the `ID` word in them have had it renamed to `Id` (ex: `APIButtonComponentWithCustomID` is now `APIButtonComponentWithCustomId`)
- The `isStyledButton` util has been renamed to `isInteractionButton`
# [0.19.0](https://github.com/discordjs/discord-api-types/compare/0.18.1...0.19.0) (2021-07-19)
### Bug Fixes

View File

@@ -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;
/**

View File

@@ -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;
/**

View File

@@ -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

View File

@@ -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,

View File

@@ -0,0 +1,4 @@
import type { APIBaseInteraction } from './base.ts';
import type { InteractionType } from './responses.ts';
export type APIPingInteraction = APIBaseInteraction<InteractionType.Ping, never>;

View File

@@ -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

View File

@@ -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

View 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,
}

View File

@@ -249,13 +249,13 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeySplashHash
| APIAuditLogChangeKeyDiscoverySplashHash
| APIAuditLogChangeKeyBannerHash
| APIAuditLogChangeKeyOwnerID
| APIAuditLogChangeKeyOwnerId
| APIAuditLogChangeKeyRegion
| APIAuditLogChangeKeyPreferredLocale
| APIAuditLogChangeKeyAFKChannelID
| APIAuditLogChangeKeyAFKChannelId
| APIAuditLogChangeKeyAFKTimeout
| APIAuditLogChangeKeyRulesChannelID
| APIAuditLogChangeKeyPublicUpdatesChannelID
| APIAuditLogChangeKeyRulesChannelId
| APIAuditLogChangeKeyPublicUpdatesChannelId
| APIAuditLogChangeKeyMFALevel
| APIAuditLogChangeKeyVerificationLevel
| APIAuditLogChangeKeyExplicitContentFilter
@@ -265,14 +265,14 @@ export type APIAuditLogChange =
| APIAuditLogChangeKey$Remove
| APIAuditLogChangeKeyPruneDeleteDays
| APIAuditLogChangeKeyWidgetEnabled
| APIAuditLogChangeKeyWidgetChannelID
| APIAuditLogChangeKeySystemChannelID
| APIAuditLogChangeKeyWidgetChannelId
| APIAuditLogChangeKeySystemChannelId
| APIAuditLogChangeKeyPosition
| APIAuditLogChangeKeyTopic
| APIAuditLogChangeKeyBitrate
| APIAuditLogChangeKeyPermissionOverwrites
| APIAuditLogChangeKeyNSFW
| APIAuditLogChangeKeyApplicationID
| APIAuditLogChangeKeyApplicationId
| APIAuditLogChangeKeyRateLimitPerUser
| APIAuditLogChangeKeyPermissions
| APIAuditLogChangeKeyColor
@@ -281,8 +281,8 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyAllow
| APIAuditLogChangeKeyDeny
| APIAuditLogChangeKeyCode
| APIAuditLogChangeKeyChannelID
| APIAuditLogChangeKeyInviterID
| APIAuditLogChangeKeyChannelId
| APIAuditLogChangeKeyInviterId
| APIAuditLogChangeKeyMaxUses
| APIAuditLogChangeKeyUses
| APIAuditLogChangeKeyMaxAge
@@ -291,7 +291,7 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyMute
| APIAuditLogChangeKeyNick
| APIAuditLogChangeKeyAvatarHash
| APIAuditLogChangeKeyID
| APIAuditLogChangeKeyId
| APIAuditLogChangeKeyType
| APIAuditLogChangeKeyEnableEmoticons
| APIAuditLogChangeKeyExpireBehavior
@@ -302,7 +302,7 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyFormatType
| APIAuditLogChangeKeyAsset
| APIAuditLogChangeKeyAvailable
| APIAuditLogChangeKeyGuildID;
| APIAuditLogChangeKeyGuildId;
/**
* Returned when an entity's name is changed
@@ -337,7 +337,7 @@ export type APIAuditLogChangeKeyBannerHash = AuditLogChangeData<'banner_hash', s
/**
* Returned when a guild's owner_id is changed
*/
export type APIAuditLogChangeKeyOwnerID = AuditLogChangeData<'owner_id', Snowflake>;
export type APIAuditLogChangeKeyOwnerId = AuditLogChangeData<'owner_id', Snowflake>;
/**
* Returned when a guild's region is changed
@@ -352,7 +352,7 @@ export type APIAuditLogChangeKeyPreferredLocale = AuditLogChangeData<'preferred_
/**
* Returned when a guild's afk_channel_id is changed
*/
export type APIAuditLogChangeKeyAFKChannelID = AuditLogChangeData<'afk_channel_id', Snowflake>;
export type APIAuditLogChangeKeyAFKChannelId = AuditLogChangeData<'afk_channel_id', Snowflake>;
/**
* Returned when a guild's afk_timeout is changed
@@ -362,12 +362,12 @@ export type APIAuditLogChangeKeyAFKTimeout = AuditLogChangeData<'afk_timeout', n
/**
* Returned when a guild's rules_channel_id is changed
*/
export type APIAuditLogChangeKeyRulesChannelID = AuditLogChangeData<'rules_channel_id', string>;
export type APIAuditLogChangeKeyRulesChannelId = AuditLogChangeData<'rules_channel_id', string>;
/**
* Returned when a guild's public_updates_channel_id is changed
*/
export type APIAuditLogChangeKeyPublicUpdatesChannelID = AuditLogChangeData<'public_updates_channel_id', string>;
export type APIAuditLogChangeKeyPublicUpdatesChannelId = AuditLogChangeData<'public_updates_channel_id', string>;
/**
* Returned when a guild's mfa_level is changed
@@ -423,12 +423,12 @@ export type APIAuditLogChangeKeyWidgetEnabled = AuditLogChangeData<'widget_enabl
/**
* Returned when a guild's widget_channel_id is changed
*/
export type APIAuditLogChangeKeyWidgetChannelID = AuditLogChangeData<'widget_channel_id', Snowflake>;
export type APIAuditLogChangeKeyWidgetChannelId = AuditLogChangeData<'widget_channel_id', Snowflake>;
/**
* Returned when a guild's system_channel_id is changed
*/
export type APIAuditLogChangeKeySystemChannelID = AuditLogChangeData<'system_channel_id', Snowflake>;
export type APIAuditLogChangeKeySystemChannelId = AuditLogChangeData<'system_channel_id', Snowflake>;
/**
* Returned when a channel's position is changed
@@ -458,7 +458,7 @@ export type APIAuditLogChangeKeyNSFW = AuditLogChangeData<'nsfw', boolean>;
/**
* The application ID of the added or removed Webhook or Bot
*/
export type APIAuditLogChangeKeyApplicationID = AuditLogChangeData<'application_id', Snowflake>;
export type APIAuditLogChangeKeyApplicationId = AuditLogChangeData<'application_id', Snowflake>;
/**
* Returned when a channel's amount of seconds a user has to wait before sending another message
@@ -504,12 +504,12 @@ export type APIAuditLogChangeKeyCode = AuditLogChangeData<'code', string>;
/**
* Returned when an invite's channel_id is changed
*/
export type APIAuditLogChangeKeyChannelID = AuditLogChangeData<'channel_id', Snowflake>;
export type APIAuditLogChangeKeyChannelId = AuditLogChangeData<'channel_id', Snowflake>;
/**
* Returned when an invite's inviter_id is changed
*/
export type APIAuditLogChangeKeyInviterID = AuditLogChangeData<'inviter_id', Snowflake>;
export type APIAuditLogChangeKeyInviterId = AuditLogChangeData<'inviter_id', Snowflake>;
/**
* Returned when an invite's max_uses is changed
@@ -554,7 +554,7 @@ export type APIAuditLogChangeKeyAvatarHash = AuditLogChangeData<'avatar_hash', s
/**
* The ID of the changed entity - sometimes used in conjunction with other keys
*/
export type APIAuditLogChangeKeyID = AuditLogChangeData<'id', Snowflake>;
export type APIAuditLogChangeKeyId = AuditLogChangeData<'id', Snowflake>;
/**
* The type of entity created
@@ -609,7 +609,7 @@ export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', bool
/**
* Returned when a sticker's guild_id is changed
*/
export type APIAuditLogChangeKeyGuildID = AuditLogChangeData<'guild_id', Snowflake>;
export type APIAuditLogChangeKeyGuildId = AuditLogChangeData<'guild_id', Snowflake>;
interface AuditLogChangeData<K extends string, D extends unknown> {
key: K;

View File

@@ -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;
/**
@@ -962,7 +962,7 @@ interface APIButtonComponentBase<Style extends ButtonStyle> extends APIBaseMessa
disabled?: boolean;
}
export interface APIButtonComponentWithCustomID
export interface APIButtonComponentWithCustomId
extends APIButtonComponentBase<
ButtonStyle.Primary | ButtonStyle.Secondary | ButtonStyle.Success | ButtonStyle.Danger
> {
@@ -979,7 +979,7 @@ export interface APIButtonComponentWithURL extends APIButtonComponentBase<Button
url: string;
}
export type APIButtonComponent = APIButtonComponentWithCustomID | APIButtonComponentWithURL;
export type APIButtonComponent = APIButtonComponentWithCustomId | APIButtonComponentWithURL;
/**
* https://discord.com/developers/docs/interactions/message-components#button-object-button-styles

View File

@@ -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;
/**

View File

@@ -1,9 +1,10 @@
import {
import type {
APIMessageComponentDMInteraction,
APIMessageComponentGuildInteraction,
APIMessageComponentInteraction,
} from './_interactions/messageComponents.ts';
import {
import type { APIPingInteraction } from './_interactions/ping.ts';
import type {
APIApplicationCommandDMInteraction,
APIApplicationCommandGuildInteraction,
APIApplicationCommandInteraction,
@@ -14,7 +15,7 @@ export * from './_interactions/messageComponents.ts';
export * from './_interactions/responses.ts';
export * from './_interactions/slashCommands.ts';
export type APIInteraction = APIApplicationCommandInteraction | APIMessageComponentInteraction;
export type APIInteraction = APIPingInteraction | APIApplicationCommandInteraction | APIMessageComponentInteraction;
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;

View File

@@ -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';

View File

@@ -1,3 +1,4 @@
export * from './application.ts';
export * from './auditLog.ts';
export * from './channel.ts';
export * from './emoji.ts';

View File

@@ -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

View File

@@ -45,6 +45,7 @@ export const PermissionFlagsBits = {
ManageEmojisAndStickers: 1n << 30n,
UseSlashCommands: 1n << 31n,
RequestToSpeak: 1n << 32n,
UseExternalStickers: 1n << 37n,
} as const;
/**

View File

@@ -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
*/

View File

@@ -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,
}

View File

@@ -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

View File

@@ -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,

View File

@@ -0,0 +1,4 @@
import type { APIBaseInteraction } from './base.ts';
import type { InteractionType } from './responses.ts';
export type APIPingInteraction = APIBaseInteraction<InteractionType.Ping, never>;

View File

@@ -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

View File

@@ -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

View 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,
}

View File

@@ -249,13 +249,13 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeySplashHash
| APIAuditLogChangeKeyDiscoverySplashHash
| APIAuditLogChangeKeyBannerHash
| APIAuditLogChangeKeyOwnerID
| APIAuditLogChangeKeyOwnerId
| APIAuditLogChangeKeyRegion
| APIAuditLogChangeKeyPreferredLocale
| APIAuditLogChangeKeyAFKChannelID
| APIAuditLogChangeKeyAFKChannelId
| APIAuditLogChangeKeyAFKTimeout
| APIAuditLogChangeKeyRulesChannelID
| APIAuditLogChangeKeyPublicUpdatesChannelID
| APIAuditLogChangeKeyRulesChannelId
| APIAuditLogChangeKeyPublicUpdatesChannelId
| APIAuditLogChangeKeyMFALevel
| APIAuditLogChangeKeyVerificationLevel
| APIAuditLogChangeKeyExplicitContentFilter
@@ -265,14 +265,14 @@ export type APIAuditLogChange =
| APIAuditLogChangeKey$Remove
| APIAuditLogChangeKeyPruneDeleteDays
| APIAuditLogChangeKeyWidgetEnabled
| APIAuditLogChangeKeyWidgetChannelID
| APIAuditLogChangeKeySystemChannelID
| APIAuditLogChangeKeyWidgetChannelId
| APIAuditLogChangeKeySystemChannelId
| APIAuditLogChangeKeyPosition
| APIAuditLogChangeKeyTopic
| APIAuditLogChangeKeyBitrate
| APIAuditLogChangeKeyPermissionOverwrites
| APIAuditLogChangeKeyNSFW
| APIAuditLogChangeKeyApplicationID
| APIAuditLogChangeKeyApplicationId
| APIAuditLogChangeKeyRateLimitPerUser
| APIAuditLogChangeKeyPermissions
| APIAuditLogChangeKeyColor
@@ -281,8 +281,8 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyAllow
| APIAuditLogChangeKeyDeny
| APIAuditLogChangeKeyCode
| APIAuditLogChangeKeyChannelID
| APIAuditLogChangeKeyInviterID
| APIAuditLogChangeKeyChannelId
| APIAuditLogChangeKeyInviterId
| APIAuditLogChangeKeyMaxUses
| APIAuditLogChangeKeyUses
| APIAuditLogChangeKeyMaxAge
@@ -291,7 +291,7 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyMute
| APIAuditLogChangeKeyNick
| APIAuditLogChangeKeyAvatarHash
| APIAuditLogChangeKeyID
| APIAuditLogChangeKeyId
| APIAuditLogChangeKeyType
| APIAuditLogChangeKeyEnableEmoticons
| APIAuditLogChangeKeyExpireBehavior
@@ -302,7 +302,7 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyFormatType
| APIAuditLogChangeKeyAsset
| APIAuditLogChangeKeyAvailable
| APIAuditLogChangeKeyGuildID;
| APIAuditLogChangeKeyGuildId;
/**
* Returned when an entity's name is changed
@@ -337,7 +337,7 @@ export type APIAuditLogChangeKeyBannerHash = AuditLogChangeData<'banner_hash', s
/**
* Returned when a guild's owner_id is changed
*/
export type APIAuditLogChangeKeyOwnerID = AuditLogChangeData<'owner_id', Snowflake>;
export type APIAuditLogChangeKeyOwnerId = AuditLogChangeData<'owner_id', Snowflake>;
/**
* Returned when a guild's region is changed
@@ -352,7 +352,7 @@ export type APIAuditLogChangeKeyPreferredLocale = AuditLogChangeData<'preferred_
/**
* Returned when a guild's afk_channel_id is changed
*/
export type APIAuditLogChangeKeyAFKChannelID = AuditLogChangeData<'afk_channel_id', Snowflake>;
export type APIAuditLogChangeKeyAFKChannelId = AuditLogChangeData<'afk_channel_id', Snowflake>;
/**
* Returned when a guild's afk_timeout is changed
@@ -362,12 +362,12 @@ export type APIAuditLogChangeKeyAFKTimeout = AuditLogChangeData<'afk_timeout', n
/**
* Returned when a guild's rules_channel_id is changed
*/
export type APIAuditLogChangeKeyRulesChannelID = AuditLogChangeData<'rules_channel_id', string>;
export type APIAuditLogChangeKeyRulesChannelId = AuditLogChangeData<'rules_channel_id', string>;
/**
* Returned when a guild's public_updates_channel_id is changed
*/
export type APIAuditLogChangeKeyPublicUpdatesChannelID = AuditLogChangeData<'public_updates_channel_id', string>;
export type APIAuditLogChangeKeyPublicUpdatesChannelId = AuditLogChangeData<'public_updates_channel_id', string>;
/**
* Returned when a guild's mfa_level is changed
@@ -423,12 +423,12 @@ export type APIAuditLogChangeKeyWidgetEnabled = AuditLogChangeData<'widget_enabl
/**
* Returned when a guild's widget_channel_id is changed
*/
export type APIAuditLogChangeKeyWidgetChannelID = AuditLogChangeData<'widget_channel_id', Snowflake>;
export type APIAuditLogChangeKeyWidgetChannelId = AuditLogChangeData<'widget_channel_id', Snowflake>;
/**
* Returned when a guild's system_channel_id is changed
*/
export type APIAuditLogChangeKeySystemChannelID = AuditLogChangeData<'system_channel_id', Snowflake>;
export type APIAuditLogChangeKeySystemChannelId = AuditLogChangeData<'system_channel_id', Snowflake>;
/**
* Returned when a channel's position is changed
@@ -458,7 +458,7 @@ export type APIAuditLogChangeKeyNSFW = AuditLogChangeData<'nsfw', boolean>;
/**
* The application ID of the added or removed Webhook or Bot
*/
export type APIAuditLogChangeKeyApplicationID = AuditLogChangeData<'application_id', Snowflake>;
export type APIAuditLogChangeKeyApplicationId = AuditLogChangeData<'application_id', Snowflake>;
/**
* Returned when a channel's amount of seconds a user has to wait before sending another message
@@ -504,12 +504,12 @@ export type APIAuditLogChangeKeyCode = AuditLogChangeData<'code', string>;
/**
* Returned when an invite's channel_id is changed
*/
export type APIAuditLogChangeKeyChannelID = AuditLogChangeData<'channel_id', Snowflake>;
export type APIAuditLogChangeKeyChannelId = AuditLogChangeData<'channel_id', Snowflake>;
/**
* Returned when an invite's inviter_id is changed
*/
export type APIAuditLogChangeKeyInviterID = AuditLogChangeData<'inviter_id', Snowflake>;
export type APIAuditLogChangeKeyInviterId = AuditLogChangeData<'inviter_id', Snowflake>;
/**
* Returned when an invite's max_uses is changed
@@ -554,7 +554,7 @@ export type APIAuditLogChangeKeyAvatarHash = AuditLogChangeData<'avatar_hash', s
/**
* The ID of the changed entity - sometimes used in conjunction with other keys
*/
export type APIAuditLogChangeKeyID = AuditLogChangeData<'id', Snowflake>;
export type APIAuditLogChangeKeyId = AuditLogChangeData<'id', Snowflake>;
/**
* The type of entity created
@@ -609,7 +609,7 @@ export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', bool
/**
* Returned when a sticker's guild_id is changed
*/
export type APIAuditLogChangeKeyGuildID = AuditLogChangeData<'guild_id', Snowflake>;
export type APIAuditLogChangeKeyGuildId = AuditLogChangeData<'guild_id', Snowflake>;
interface AuditLogChangeData<K extends string, D extends unknown> {
key: K;

View File

@@ -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;
/**
@@ -1082,7 +1082,7 @@ interface APIButtonComponentBase<Style extends ButtonStyle> extends APIBaseMessa
disabled?: boolean;
}
export interface APIButtonComponentWithCustomID
export interface APIButtonComponentWithCustomId
extends APIButtonComponentBase<
ButtonStyle.Primary | ButtonStyle.Secondary | ButtonStyle.Success | ButtonStyle.Danger
> {
@@ -1099,7 +1099,7 @@ export interface APIButtonComponentWithURL extends APIButtonComponentBase<Button
url: string;
}
export type APIButtonComponent = APIButtonComponentWithCustomID | APIButtonComponentWithURL;
export type APIButtonComponent = APIButtonComponentWithCustomId | APIButtonComponentWithURL;
/**
* https://discord.com/developers/docs/interactions/message-components#button-object-button-styles

View File

@@ -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;
/**

View File

@@ -1,9 +1,10 @@
import {
import type {
APIMessageComponentDMInteraction,
APIMessageComponentGuildInteraction,
APIMessageComponentInteraction,
} from './_interactions/messageComponents.ts';
import {
import type { APIPingInteraction } from './_interactions/ping.ts';
import type {
APIApplicationCommandDMInteraction,
APIApplicationCommandGuildInteraction,
APIApplicationCommandInteraction,
@@ -14,7 +15,7 @@ export * from './_interactions/messageComponents.ts';
export * from './_interactions/responses.ts';
export * from './_interactions/slashCommands.ts';
export type APIInteraction = APIApplicationCommandInteraction | APIMessageComponentInteraction;
export type APIInteraction = APIPingInteraction | APIApplicationCommandInteraction | APIMessageComponentInteraction;
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;

View File

@@ -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';

View File

@@ -1,3 +1,4 @@
export * from './application.ts';
export * from './auditLog.ts';
export * from './channel.ts';
export * from './emoji.ts';

View File

@@ -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

View File

@@ -48,6 +48,7 @@ export const PermissionFlagsBits = {
ManageThreads: 1n << 34n,
UsePublicThreads: 1n << 35n,
UsePrivateThreads: 1n << 36n,
UseExternalStickers: 1n << 37n,
} as const;
/**

View File

@@ -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
*/

View File

@@ -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,
}

View File

@@ -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,16 +161,24 @@ export enum RESTJSONErrorCodes {
TwoFactorAuthenticationIsRequired = 60003,
NoUsersWithDiscordTagExist = 80004,
ReactionWasBlocked = 90001,
APIResourceOverloaded = 130000,
TheStageIsAlreadyOpen = 150006,
ThreadAlreadyCreatedForMessage = 160004,
ThreadLocked,
MaximumActiveThreads,
MaximumActiveAnnouncementThreads,
InvalidJSONForUploadedLottieFile = 170001,
LottieAnimationMaximumDimensionsExceeded = 170005,
UploadedLottiesCannotContainRasterizedImages,
StickerMaximumFramerateExceeded,
StickerFrameCountExceedsMaximumOf1000Frames,
LottieAnimationMaximumDimensionsExceeded,
StickerFramerateIsTooSmallOrTooLarge,
StickerAnimationDurationExceedsMaximumOf5Seconds,
}

View File

@@ -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
*/

View File

@@ -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;
};

View File

@@ -3,7 +3,16 @@ import type {
APIApplicationCommandPermission,
APIGuildApplicationCommandPermissions,
APIInteractionResponse,
APIInteractionResponseCallbackData,
} from '../../payloads/v8/mod.ts';
import type {
RESTDeleteAPIWebhookWithTokenMessageResult,
RESTGetAPIWebhookWithTokenMessageResult,
RESTPatchAPIWebhookWithTokenMessageFormDataBody,
RESTPatchAPIWebhookWithTokenMessageJSONBody,
RESTPatchAPIWebhookWithTokenMessageResult,
RESTPostAPIWebhookWithTokenWaitResult,
} from './webhook.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-global-application-commands
@@ -111,6 +120,87 @@ export type RESTPostAPIInteractionCallbackFormDataBody =
file: unknown;
});
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-original-interaction-response
*/
export type RESTGetAPIInteractionOriginalResponseResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-original-interaction-response
*/
export type RESTDeleteAPIInteractionOriginalResponseResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
*/
export type RESTPostAPIInteractionFollowupJSONBody = APIInteractionResponseCallbackData;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
*/
export type RESTPostAPIInteractionFollowupFormDataBody =
| {
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| (RESTPostAPIInteractionFollowupJSONBody & {
/**
* The file contents
*/
file: unknown;
});
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
*/
export type RESTPostAPIInteractionFollowupResult = RESTPostAPIWebhookWithTokenWaitResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-followup-message
*/
export type RESTGetAPIInteractionFollowupResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-followup-message
*/
export type RESTDeleteAPIInteractionFollowupResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command-permissions
*/

View File

@@ -24,8 +24,8 @@ export const Routes = {
* Route for:
* - GET `/guilds/{guild.id}/audit-logs`
*/
guildAuditLog(guildID: Snowflake) {
return `/guilds/${guildID}/audit-logs` as const;
guildAuditLog(guildId: Snowflake) {
return `/guilds/${guildId}/audit-logs` as const;
},
/**
@@ -34,8 +34,8 @@ export const Routes = {
* - PATCH `/channels/{channel.id}`
* - DELETE `/channels/{channel.id}`
*/
channel(channelID: Snowflake) {
return `/channels/${channelID}` as const;
channel(channelId: Snowflake) {
return `/channels/${channelId}` as const;
},
/**
@@ -43,8 +43,8 @@ export const Routes = {
* - GET `/channels/{channel.id}/messages`
* - POST `/channels/{channel.id}/messages`
*/
channelMessages(channelID: Snowflake) {
return `/channels/${channelID}/messages` as const;
channelMessages(channelId: Snowflake) {
return `/channels/${channelId}/messages` as const;
},
/**
@@ -53,16 +53,16 @@ export const Routes = {
* - PATCH `/channels/{channel.id}/messages/{message.id}`
* - DELETE `/channels/{channel.id}/messages/{message.id}`
*/
channelMessage(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}` as const;
channelMessage(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/messages/${messageId}` as const;
},
/**
* Route for:
* - POST `/channels/{channel.id}/messages/{message.id}/crosspost`
*/
channelMessageCrosspost(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}/crosspost` as const;
channelMessageCrosspost(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/messages/${messageId}/crosspost` as const;
},
/**
@@ -72,8 +72,8 @@ export const Routes = {
*
* **Note**: You need to URL encode the emoji yourself
*/
channelMessageOwnReaction(channelID: Snowflake, messageID: Snowflake, emoji: string) {
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/@me` as const;
channelMessageOwnReaction(channelId: Snowflake, messageId: Snowflake, emoji: string) {
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}/@me` as const;
},
/**
@@ -82,8 +82,8 @@ export const Routes = {
*
* **Note**: You need to URL encode the emoji yourself
*/
channelMessageUserReaction(channelID: Snowflake, messageID: Snowflake, emoji: string, userID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/${userID}` as const;
channelMessageUserReaction(channelId: Snowflake, messageId: Snowflake, emoji: string, userId: Snowflake) {
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}/${userId}` as const;
},
/**
@@ -93,24 +93,24 @@ export const Routes = {
*
* **Note**: You need to URL encode the emoji yourself
*/
channelMessageReaction(channelID: Snowflake, messageID: Snowflake, emoji: string) {
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}` as const;
channelMessageReaction(channelId: Snowflake, messageId: Snowflake, emoji: string) {
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}` as const;
},
/**
* Route for:
* - DELETE `/channels/{channel.id}/messages/{message.id}/reactions`
*/
channelMessageAllReactions(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}/reactions` as const;
channelMessageAllReactions(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/messages/${messageId}/reactions` as const;
},
/**
* Route for:
* - POST `/channels/{channel.id}/messages/bulk-delete`
*/
channelBulkDelete(channelID: Snowflake) {
return `/channels/${channelID}/messages/bulk-delete` as const;
channelBulkDelete(channelId: Snowflake) {
return `/channels/${channelId}/messages/bulk-delete` as const;
},
/**
@@ -118,8 +118,8 @@ export const Routes = {
* - PUT `/channels/{channel.id}/permissions/{overwrite.id}`
* - DELETE `/channels/{channel.id}/permissions/{overwrite.id}`
*/
channelPermission(channelID: Snowflake, overwriteID: Snowflake) {
return `/channels/${channelID}/permissions/${overwriteID}` as const;
channelPermission(channelId: Snowflake, overwriteId: Snowflake) {
return `/channels/${channelId}/permissions/${overwriteId}` as const;
},
/**
@@ -127,32 +127,32 @@ export const Routes = {
* - GET `/channels/{channel.id}/invites`
* - POST `/channels/{channel.id}/invites`
*/
channelInvites(channelID: Snowflake) {
return `/channels/${channelID}/invites` as const;
channelInvites(channelId: Snowflake) {
return `/channels/${channelId}/invites` as const;
},
/**
* Route for:
* - POST `/channels/{channel.id}/followers`
*/
channelFollowers(channelID: Snowflake) {
return `/channels/${channelID}/followers` as const;
channelFollowers(channelId: Snowflake) {
return `/channels/${channelId}/followers` as const;
},
/**
* Route for:
* - POST `/channels/{channel.id}/typing`
*/
channelTyping(channelID: Snowflake) {
return `/channels/${channelID}/typing` as const;
channelTyping(channelId: Snowflake) {
return `/channels/${channelId}/typing` as const;
},
/**
* Route for:
* - GET `/channels/{channel.id}/pins`
*/
channelPins(channelID: Snowflake) {
return `/channels/${channelID}/pins` as const;
channelPins(channelId: Snowflake) {
return `/channels/${channelId}/pins` as const;
},
/**
@@ -160,8 +160,8 @@ export const Routes = {
* - PUT `/channels/{channel.id}/pins/{message.id}`
* - DELETE `/channels/{channel.id}/pins/{message.id}`
*/
channelPin(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/pins/${messageID}` as const;
channelPin(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/pins/${messageId}` as const;
},
/**
@@ -169,8 +169,8 @@ export const Routes = {
* - PUT `/channels/{channel.id}/recipients/{user.id}`
* - DELETE `/channels/{channel.id}/recipients/{user.id}`
*/
channelRecipient(channelID: Snowflake, userID: Snowflake) {
return `/channels/${channelID}/recipients/${userID}` as const;
channelRecipient(channelId: Snowflake, userId: Snowflake) {
return `/channels/${channelId}/recipients/${userId}` as const;
},
/**
@@ -178,8 +178,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/emojis`
* - POST `/guilds/{guild.id}/emojis`
*/
guildEmojis(guildID: Snowflake) {
return `/guilds/${guildID}/emojis` as const;
guildEmojis(guildId: Snowflake) {
return `/guilds/${guildId}/emojis` as const;
},
/**
@@ -188,8 +188,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/emojis/{emoji.id}`
* - DELETE `/guilds/{guild.id}/emojis/{emoji.id}`
*/
guildEmoji(guildID: Snowflake, emojiID: Snowflake) {
return `/guilds/${guildID}/emojis/${emojiID}` as const;
guildEmoji(guildId: Snowflake, emojiId: Snowflake) {
return `/guilds/${guildId}/emojis/${emojiId}` as const;
},
/**
@@ -206,16 +206,16 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}`
* - DELETE `/guilds/{guild.id}`
*/
guild(guildID: Snowflake) {
return `/guilds/${guildID}` as const;
guild(guildId: Snowflake) {
return `/guilds/${guildId}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/preview`
*/
guildPreview(guildID: Snowflake) {
return `/guilds/${guildID}/preview` as const;
guildPreview(guildId: Snowflake) {
return `/guilds/${guildId}/preview` as const;
},
/**
@@ -224,8 +224,8 @@ export const Routes = {
* - POST `/guilds/{guild.id}/channels`
* - PATCH `/guilds/{guild.id}/channels`
*/
guildChannels(guildID: Snowflake) {
return `/guilds/${guildID}/channels` as const;
guildChannels(guildId: Snowflake) {
return `/guilds/${guildId}/channels` as const;
},
/**
@@ -235,32 +235,32 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/members/{user.id}`
* - DELETE `/guilds/{guild.id}/members/{user.id}`
*/
guildMember(guildID: Snowflake, userID: Snowflake) {
return `/guilds/${guildID}/members/${userID}` as const;
guildMember(guildId: Snowflake, userId: Snowflake) {
return `/guilds/${guildId}/members/${userId}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/members`
*/
guildMembers(guildID: Snowflake) {
return `/guilds/${guildID}/members` as const;
guildMembers(guildId: Snowflake) {
return `/guilds/${guildId}/members` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/members/search`
*/
guildMembersSearch(guildID: Snowflake) {
return `/guilds/${guildID}/members/search` as const;
guildMembersSearch(guildId: Snowflake) {
return `/guilds/${guildId}/members/search` as const;
},
/**
* Route for:
* - PATCH `/guilds/{guild.id}/members/@me/nick`
*/
guildCurrentMemberNickname(guildID: Snowflake) {
return `/guilds/${guildID}/members/@me/nick` as const;
guildCurrentMemberNickname(guildId: Snowflake) {
return `/guilds/${guildId}/members/@me/nick` as const;
},
/**
@@ -268,16 +268,16 @@ export const Routes = {
* - PUT `/guilds/{guild.id}/members/{user.id}/roles/{role.id}`
* - DELETE `/guilds/{guild.id}/members/{user.id}/roles/{role.id}`
*/
guildMemberRole(guildID: Snowflake, memberID: Snowflake, roleID: Snowflake) {
return `/guilds/${guildID}/members/${memberID}/roles/${roleID}` as const;
guildMemberRole(guildId: Snowflake, memberId: Snowflake, roleId: Snowflake) {
return `/guilds/${guildId}/members/${memberId}/roles/${roleId}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/bans`
*/
guildBans(guildID: Snowflake) {
return `/guilds/${guildID}/bans` as const;
guildBans(guildId: Snowflake) {
return `/guilds/${guildId}/bans` as const;
},
/**
@@ -286,8 +286,8 @@ export const Routes = {
* - PUT `/guilds/{guild.id}/bans/{user.id}`
* - DELETE `/guilds/{guild.id}/bans/{user.id}`
*/
guildBan(guildID: Snowflake, userID: Snowflake) {
return `/guilds/${guildID}/bans/${userID}` as const;
guildBan(guildId: Snowflake, userId: Snowflake) {
return `/guilds/${guildId}/bans/${userId}` as const;
},
/**
@@ -296,8 +296,8 @@ export const Routes = {
* - POST `/guilds/{guild.id}/roles`
* - PATCH `/guilds/{guild.id}/roles`
*/
guildRoles(guildID: Snowflake) {
return `/guilds/${guildID}/roles` as const;
guildRoles(guildId: Snowflake) {
return `/guilds/${guildId}/roles` as const;
},
/**
@@ -305,8 +305,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/roles/{role.id}`
* - DELETE `/guilds/{guild.id}/roles/{role.id}`
*/
guildRole(guildID: Snowflake, roleID: Snowflake) {
return `/guilds/${guildID}/roles/${roleID}` as const;
guildRole(guildId: Snowflake, roleId: Snowflake) {
return `/guilds/${guildId}/roles/${roleId}` as const;
},
/**
@@ -314,40 +314,40 @@ export const Routes = {
* - GET `/guilds/{guild.id}/prune`
* - POST `/guilds/{guild.id}/prune`
*/
guildPrune(guildID: Snowflake) {
return `/guilds/${guildID}/prune` as const;
guildPrune(guildId: Snowflake) {
return `/guilds/${guildId}/prune` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/regions`
*/
guildVoiceRegions(guildID: Snowflake) {
return `/guilds/${guildID}/regions` as const;
guildVoiceRegions(guildId: Snowflake) {
return `/guilds/${guildId}/regions` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/invites`
*/
guildInvites(guildID: Snowflake) {
return `/guilds/${guildID}/invites` as const;
guildInvites(guildId: Snowflake) {
return `/guilds/${guildId}/invites` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/integrations`
*/
guildIntegrations(guildID: Snowflake) {
return `/guilds/${guildID}/integrations` as const;
guildIntegrations(guildId: Snowflake) {
return `/guilds/${guildId}/integrations` as const;
},
/**
* Route for:
* - DELETE `/guilds/{guild.id}/integrations/{integration.id}`
*/
guildIntegration(guildID: Snowflake, integrationID: Snowflake) {
return `/guilds/${guildID}/integrations/${integrationID}` as const;
guildIntegration(guildId: Snowflake, integrationId: Snowflake) {
return `/guilds/${guildId}/integrations/${integrationId}` as const;
},
/**
@@ -355,32 +355,32 @@ export const Routes = {
* - GET `/guilds/{guild.id}/widget`
* - PATCH `/guilds/{guild.id}/widget`
*/
guildWidgetSettings(guildID: Snowflake) {
return `/guilds/${guildID}/widget` as const;
guildWidgetSettings(guildId: Snowflake) {
return `/guilds/${guildId}/widget` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/widget.json`
*/
guildWidgetJSON(guildID: Snowflake) {
return `/guilds/${guildID}/widget.json` as const;
guildWidgetJSON(guildId: Snowflake) {
return `/guilds/${guildId}/widget.json` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/vanity-url`
*/
guildVanityUrl(guildID: Snowflake) {
return `/guilds/${guildID}/vanity-url` as const;
guildVanityUrl(guildId: Snowflake) {
return `/guilds/${guildId}/vanity-url` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/widget.png`
*/
guildWidgetImage(guildID: Snowflake) {
return `/guilds/${guildID}/widget.png` as const;
guildWidgetImage(guildId: Snowflake) {
return `/guilds/${guildId}/widget.png` as const;
},
/**
@@ -406,8 +406,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/templates`
* - POST `/guilds/{guild.id}/templates`
*/
guildTemplates(guildID: Snowflake) {
return `/guilds/${guildID}/templates` as const;
guildTemplates(guildId: Snowflake) {
return `/guilds/${guildId}/templates` as const;
},
/**
@@ -416,8 +416,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/templates/{template.code}`
* - DELETE `/guilds/{guild.id}/templates/{template.code}`
*/
guildTemplate(guildID: Snowflake, code: string) {
return `/guilds/${guildID}/templates/${code}` as const;
guildTemplate(guildId: Snowflake, code: string) {
return `/guilds/${guildId}/templates/${code}` as const;
},
/**
@@ -426,10 +426,10 @@ export const Routes = {
* - GET `/users/{user.id}`
* - PATCH `/users/@me`
*
* @param [userID='@me'] The user ID, defaulted to `@me`
* @param [userId='@me'] The user ID, defaulted to `@me`
*/
user(userID: Snowflake | '@me' = '@me') {
return `/users/${userID}` as const;
user(userId: Snowflake | '@me' = '@me') {
return `/users/${userId}` as const;
},
/**
@@ -444,8 +444,8 @@ export const Routes = {
* Route for:
* - DELETE `/users/@me/guilds/{guild.id}`
*/
userGuild(guildID: Snowflake) {
return `/users/@me/guilds/${guildID}` as const;
userGuild(guildId: Snowflake) {
return `/users/@me/guilds/${guildId}` as const;
},
/**
@@ -477,16 +477,16 @@ export const Routes = {
* - GET `/channels/{channel.id}/webhooks`
* - POST `/channels/{channel.id}/webhooks`
*/
channelWebhooks(channelID: Snowflake) {
return `/channels/${channelID}/webhooks` as const;
channelWebhooks(channelId: Snowflake) {
return `/channels/${channelId}/webhooks` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/webhooks`
*/
guildWebhooks(guildID: Snowflake) {
return `/guilds/${guildID}/webhooks` as const;
guildWebhooks(guildId: Snowflake) {
return `/guilds/${guildId}/webhooks` as const;
},
/**
@@ -501,8 +501,8 @@ export const Routes = {
*
* - POST `/webhooks/{application.id}/{interaction.token}`
*/
webhook(webhookID: Snowflake, webhookToken?: string) {
const parts = ['', 'webhooks', webhookID];
webhook(webhookId: Snowflake, webhookToken?: string) {
const parts = ['', 'webhooks', webhookId];
if (webhookToken) parts.push(webhookToken);
@@ -522,10 +522,10 @@ export const Routes = {
* - PATCH `/webhooks/{application.id}/{interaction.token}/messages/{message.id}`
* - DELETE `/webhooks/{application.id}/{interaction.token}/messages/{message.id}`
*
* @param [messageID='@original'] The message ID to change, defaulted to `@original`
* @param [messageId='@original'] The message ID to change, defaulted to `@original`
*/
webhookMessage(webhookID: Snowflake, webhookToken: string, messageID: Snowflake | '@original' = '@original') {
return `/webhooks/${webhookID}/${webhookToken}/messages/${messageID}` as const;
webhookMessage(webhookId: Snowflake, webhookToken: string, messageId: Snowflake | '@original' = '@original') {
return `/webhooks/${webhookId}/${webhookToken}/messages/${messageId}` as const;
},
/**
@@ -533,8 +533,8 @@ export const Routes = {
* - POST `/webhooks/{webhook.id}/{webhook.token}/github`
* - POST `/webhooks/{webhook.id}/{webhook.token}/slack`
*/
webhookPlatform(webhookID: Snowflake, webhookToken: string, platform: 'github' | 'slack') {
return `/webhooks/${webhookID}/${webhookToken}/${platform}` as const;
webhookPlatform(webhookId: Snowflake, webhookToken: string, platform: 'github' | 'slack') {
return `/webhooks/${webhookId}/${webhookToken}/${platform}` as const;
},
/**
@@ -575,8 +575,8 @@ export const Routes = {
* - PUT `/applications/{application.id}/commands`
* - POST `/applications/{application.id}/commands`
*/
applicationCommands(applicationID: Snowflake) {
return `/applications/${applicationID}/commands` as const;
applicationCommands(applicationId: Snowflake) {
return `/applications/${applicationId}/commands` as const;
},
/**
@@ -585,8 +585,8 @@ export const Routes = {
* - PATCH `/applications/{application.id}/commands/{command.id}`
* - DELETE `/applications/{application.id}/commands/{command.id}`
*/
applicationCommand(applicationID: Snowflake, commandID: Snowflake) {
return `/applications/${applicationID}/commands/${commandID}` as const;
applicationCommand(applicationId: Snowflake, commandId: Snowflake) {
return `/applications/${applicationId}/commands/${commandId}` as const;
},
/**
@@ -595,8 +595,8 @@ export const Routes = {
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands`
* - POST `/applications/{application.id}/guilds/{guild.id}/commands`
*/
applicationGuildCommands(applicationID: Snowflake, guildID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands` as const;
applicationGuildCommands(applicationId: Snowflake, guildId: Snowflake) {
return `/applications/${applicationId}/guilds/${guildId}/commands` as const;
},
/**
@@ -605,16 +605,16 @@ export const Routes = {
* - PATCH `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}`
* - DELETE `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}`
*/
applicationGuildCommand(applicationID: Snowflake, guildID: Snowflake, commandID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}` as const;
applicationGuildCommand(applicationId: Snowflake, guildId: Snowflake, commandId: Snowflake) {
return `/applications/${applicationId}/guilds/${guildId}/commands/${commandId}` as const;
},
/**
* Route for:
* - POST `/interactions/{interaction.id}/{interaction.token}/callback`
*/
interactionCallback(interactionID: Snowflake, interactionToken: string) {
return `/interactions/${interactionID}/${interactionToken}/callback` as const;
interactionCallback(interactionId: Snowflake, interactionToken: string) {
return `/interactions/${interactionId}/${interactionToken}/callback` as const;
},
/**
@@ -622,8 +622,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/member-verification`
* - PATCH `/guilds/{guild.id}/member-verification`
*/
guildMemberVerification(guildID: Snowflake) {
return `/guilds/${guildID}/member-verification` as const;
guildMemberVerification(guildId: Snowflake) {
return `/guilds/${guildId}/member-verification` as const;
},
/**
@@ -631,8 +631,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/voice-states/@me`
* - PATCH `/guilds/{guild.id}/voice-states/{user.id}`
*/
guildVoiceState(guildID: Snowflake, userID: Snowflake | '@me' = '@me') {
return `/guilds/${guildID}/voice-states/${userID}` as const;
guildVoiceState(guildId: Snowflake, userId: Snowflake | '@me' = '@me') {
return `/guilds/${guildId}/voice-states/${userId}` as const;
},
/**
@@ -640,8 +640,8 @@ export const Routes = {
* - GET `/applications/{application.id}/guilds/{guild.id}/commands/permissions`
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands/permissions`
*/
guildApplicationCommandsPermissions(applicationID: Snowflake, guildID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands/permissions` as const;
guildApplicationCommandsPermissions(applicationId: Snowflake, guildId: Snowflake) {
return `/applications/${applicationId}/guilds/${guildId}/commands/permissions` as const;
},
/**
@@ -649,8 +649,8 @@ export const Routes = {
* - GET `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`
*/
applicationCommandPermissions(applicationID: Snowflake, guildID: Snowflake, commandID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}/permissions` as const;
applicationCommandPermissions(applicationId: Snowflake, guildId: Snowflake, commandId: Snowflake) {
return `/applications/${applicationId}/guilds/${guildId}/commands/${commandId}/permissions` as const;
},
/**
@@ -658,8 +658,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/welcome-screen`
* - PATCH `/guilds/{guild.id}/welcome-screen`
*/
guildWelcomeScreen(guildID: Snowflake) {
return `/guilds/${guildID}/welcome-screen` as const;
guildWelcomeScreen(guildId: Snowflake) {
return `/guilds/${guildId}/welcome-screen` as const;
},
/**
@@ -676,16 +676,16 @@ export const Routes = {
* - PATCH `/stage-instances/{channel.id}`
* - DELETE `/stage-instances/{channel.id}`
*/
stageInstance(channelID: Snowflake) {
return `/stage-instances/${channelID}` as const;
stageInstance(channelId: Snowflake) {
return `/stage-instances/${channelId}` as const;
},
/**
* Route for:
* - GET `/stickers/{sticker.id}`
*/
sticker(stickerID: Snowflake) {
return `/stickers/${stickerID}` as const;
sticker(stickerId: Snowflake) {
return `/stickers/${stickerId}` as const;
},
/**
@@ -701,8 +701,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/stickers`
* - POST `/guilds/{guild.id}/stickers`
*/
guildStickers(guildID: Snowflake) {
return `/guilds/${guildID}/stickers` as const;
guildStickers(guildId: Snowflake) {
return `/guilds/${guildId}/stickers` as const;
},
/**
@@ -711,8 +711,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/stickers/{sticker.id}`
* - DELETE `/guilds/{guild.id}/stickers/{sticker.id}`
*/
guildSticker(guildID: Snowflake, stickerID: Snowflake) {
return `/guilds/${guildID}/stickers/${stickerID}` as const;
guildSticker(guildId: Snowflake, stickerId: Snowflake) {
return `/guilds/${guildId}/stickers/${stickerId}` as const;
},
};

View File

@@ -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[];
}
@@ -210,12 +220,25 @@ export type RESTPostAPIWebhookWithTokenGitHubResult = never;
*/
export type RESTPostAPIWebhookWithTokenGitHubWaitResult = APIMessage;
/**
* https://discord.com/developers/docs/resources/webhook#get-webhook-message
*/
export type RESTGetAPIWebhookWithTokenMessageResult = 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
@@ -238,11 +261,6 @@ export type RESTPatchAPIWebhookWithTokenMessageFormDataBody =
file: unknown;
});
/**
* https://discord.com/developers/docs/resources/webhook#get-webhook-message
*/
export type RESTGetAPIWebhookWithTokenMessageResult = APIMessage;
/**
* 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;
};

View File

@@ -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;
/**

View File

@@ -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;
};

View File

@@ -3,7 +3,16 @@ import type {
APIApplicationCommandPermission,
APIGuildApplicationCommandPermissions,
APIInteractionResponse,
APIInteractionResponseCallbackData,
} from '../../payloads/v9/mod.ts';
import type {
RESTDeleteAPIWebhookWithTokenMessageResult,
RESTGetAPIWebhookWithTokenMessageResult,
RESTPatchAPIWebhookWithTokenMessageFormDataBody,
RESTPatchAPIWebhookWithTokenMessageJSONBody,
RESTPatchAPIWebhookWithTokenMessageResult,
RESTPostAPIWebhookWithTokenWaitResult,
} from './webhook.ts';
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-global-application-commands
@@ -111,6 +120,87 @@ export type RESTPostAPIInteractionCallbackFormDataBody =
file: unknown;
});
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-original-interaction-response
*/
export type RESTGetAPIInteractionOriginalResponseResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-original-interaction-response
*/
export type RESTDeleteAPIInteractionOriginalResponseResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
*/
export type RESTPostAPIInteractionFollowupJSONBody = APIInteractionResponseCallbackData;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
*/
export type RESTPostAPIInteractionFollowupFormDataBody =
| {
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| (RESTPostAPIInteractionFollowupJSONBody & {
/**
* The file contents
*/
file: unknown;
});
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
*/
export type RESTPostAPIInteractionFollowupResult = RESTPostAPIWebhookWithTokenWaitResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-followup-message
*/
export type RESTGetAPIInteractionFollowupResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-followup-message
*/
export type RESTDeleteAPIInteractionFollowupResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command-permissions
*/

View File

@@ -24,8 +24,8 @@ export const Routes = {
* Route for:
* - GET `/guilds/{guild.id}/audit-logs`
*/
guildAuditLog(guildID: Snowflake) {
return `/guilds/${guildID}/audit-logs` as const;
guildAuditLog(guildId: Snowflake) {
return `/guilds/${guildId}/audit-logs` as const;
},
/**
@@ -34,8 +34,8 @@ export const Routes = {
* - PATCH `/channels/{channel.id}`
* - DELETE `/channels/{channel.id}`
*/
channel(channelID: Snowflake) {
return `/channels/${channelID}` as const;
channel(channelId: Snowflake) {
return `/channels/${channelId}` as const;
},
/**
@@ -43,8 +43,8 @@ export const Routes = {
* - GET `/channels/{channel.id}/messages`
* - POST `/channels/{channel.id}/messages`
*/
channelMessages(channelID: Snowflake) {
return `/channels/${channelID}/messages` as const;
channelMessages(channelId: Snowflake) {
return `/channels/${channelId}/messages` as const;
},
/**
@@ -53,16 +53,16 @@ export const Routes = {
* - PATCH `/channels/{channel.id}/messages/{message.id}`
* - DELETE `/channels/{channel.id}/messages/{message.id}`
*/
channelMessage(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}` as const;
channelMessage(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/messages/${messageId}` as const;
},
/**
* Route for:
* - POST `/channels/{channel.id}/messages/{message.id}/crosspost`
*/
channelMessageCrosspost(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}/crosspost` as const;
channelMessageCrosspost(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/messages/${messageId}/crosspost` as const;
},
/**
@@ -72,8 +72,8 @@ export const Routes = {
*
* **Note**: You need to URL encode the emoji yourself
*/
channelMessageOwnReaction(channelID: Snowflake, messageID: Snowflake, emoji: string) {
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/@me` as const;
channelMessageOwnReaction(channelId: Snowflake, messageId: Snowflake, emoji: string) {
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}/@me` as const;
},
/**
@@ -82,8 +82,8 @@ export const Routes = {
*
* **Note**: You need to URL encode the emoji yourself
*/
channelMessageUserReaction(channelID: Snowflake, messageID: Snowflake, emoji: string, userID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/${userID}` as const;
channelMessageUserReaction(channelId: Snowflake, messageId: Snowflake, emoji: string, userId: Snowflake) {
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}/${userId}` as const;
},
/**
@@ -93,24 +93,24 @@ export const Routes = {
*
* **Note**: You need to URL encode the emoji yourself
*/
channelMessageReaction(channelID: Snowflake, messageID: Snowflake, emoji: string) {
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}` as const;
channelMessageReaction(channelId: Snowflake, messageId: Snowflake, emoji: string) {
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}` as const;
},
/**
* Route for:
* - DELETE `/channels/{channel.id}/messages/{message.id}/reactions`
*/
channelMessageAllReactions(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}/reactions` as const;
channelMessageAllReactions(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/messages/${messageId}/reactions` as const;
},
/**
* Route for:
* - POST `/channels/{channel.id}/messages/bulk-delete`
*/
channelBulkDelete(channelID: Snowflake) {
return `/channels/${channelID}/messages/bulk-delete` as const;
channelBulkDelete(channelId: Snowflake) {
return `/channels/${channelId}/messages/bulk-delete` as const;
},
/**
@@ -118,8 +118,8 @@ export const Routes = {
* - PUT `/channels/{channel.id}/permissions/{overwrite.id}`
* - DELETE `/channels/{channel.id}/permissions/{overwrite.id}`
*/
channelPermission(channelID: Snowflake, overwriteID: Snowflake) {
return `/channels/${channelID}/permissions/${overwriteID}` as const;
channelPermission(channelId: Snowflake, overwriteId: Snowflake) {
return `/channels/${channelId}/permissions/${overwriteId}` as const;
},
/**
@@ -127,32 +127,32 @@ export const Routes = {
* - GET `/channels/{channel.id}/invites`
* - POST `/channels/{channel.id}/invites`
*/
channelInvites(channelID: Snowflake) {
return `/channels/${channelID}/invites` as const;
channelInvites(channelId: Snowflake) {
return `/channels/${channelId}/invites` as const;
},
/**
* Route for:
* - POST `/channels/{channel.id}/followers`
*/
channelFollowers(channelID: Snowflake) {
return `/channels/${channelID}/followers` as const;
channelFollowers(channelId: Snowflake) {
return `/channels/${channelId}/followers` as const;
},
/**
* Route for:
* - POST `/channels/{channel.id}/typing`
*/
channelTyping(channelID: Snowflake) {
return `/channels/${channelID}/typing` as const;
channelTyping(channelId: Snowflake) {
return `/channels/${channelId}/typing` as const;
},
/**
* Route for:
* - GET `/channels/{channel.id}/pins`
*/
channelPins(channelID: Snowflake) {
return `/channels/${channelID}/pins` as const;
channelPins(channelId: Snowflake) {
return `/channels/${channelId}/pins` as const;
},
/**
@@ -160,8 +160,8 @@ export const Routes = {
* - PUT `/channels/{channel.id}/pins/{message.id}`
* - DELETE `/channels/{channel.id}/pins/{message.id}`
*/
channelPin(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/pins/${messageID}` as const;
channelPin(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/pins/${messageId}` as const;
},
/**
@@ -169,8 +169,8 @@ export const Routes = {
* - PUT `/channels/{channel.id}/recipients/{user.id}`
* - DELETE `/channels/{channel.id}/recipients/{user.id}`
*/
channelRecipient(channelID: Snowflake, userID: Snowflake) {
return `/channels/${channelID}/recipients/${userID}` as const;
channelRecipient(channelId: Snowflake, userId: Snowflake) {
return `/channels/${channelId}/recipients/${userId}` as const;
},
/**
@@ -178,8 +178,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/emojis`
* - POST `/guilds/{guild.id}/emojis`
*/
guildEmojis(guildID: Snowflake) {
return `/guilds/${guildID}/emojis` as const;
guildEmojis(guildId: Snowflake) {
return `/guilds/${guildId}/emojis` as const;
},
/**
@@ -188,8 +188,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/emojis/{emoji.id}`
* - DELETE `/guilds/{guild.id}/emojis/{emoji.id}`
*/
guildEmoji(guildID: Snowflake, emojiID: Snowflake) {
return `/guilds/${guildID}/emojis/${emojiID}` as const;
guildEmoji(guildId: Snowflake, emojiId: Snowflake) {
return `/guilds/${guildId}/emojis/${emojiId}` as const;
},
/**
@@ -206,16 +206,16 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}`
* - DELETE `/guilds/{guild.id}`
*/
guild(guildID: Snowflake) {
return `/guilds/${guildID}` as const;
guild(guildId: Snowflake) {
return `/guilds/${guildId}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/preview`
*/
guildPreview(guildID: Snowflake) {
return `/guilds/${guildID}/preview` as const;
guildPreview(guildId: Snowflake) {
return `/guilds/${guildId}/preview` as const;
},
/**
@@ -224,8 +224,8 @@ export const Routes = {
* - POST `/guilds/{guild.id}/channels`
* - PATCH `/guilds/{guild.id}/channels`
*/
guildChannels(guildID: Snowflake) {
return `/guilds/${guildID}/channels` as const;
guildChannels(guildId: Snowflake) {
return `/guilds/${guildId}/channels` as const;
},
/**
@@ -235,32 +235,32 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/members/{user.id}`
* - DELETE `/guilds/{guild.id}/members/{user.id}`
*/
guildMember(guildID: Snowflake, userID: Snowflake) {
return `/guilds/${guildID}/members/${userID}` as const;
guildMember(guildId: Snowflake, userId: Snowflake) {
return `/guilds/${guildId}/members/${userId}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/members`
*/
guildMembers(guildID: Snowflake) {
return `/guilds/${guildID}/members` as const;
guildMembers(guildId: Snowflake) {
return `/guilds/${guildId}/members` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/members/search`
*/
guildMembersSearch(guildID: Snowflake) {
return `/guilds/${guildID}/members/search` as const;
guildMembersSearch(guildId: Snowflake) {
return `/guilds/${guildId}/members/search` as const;
},
/**
* Route for:
* - PATCH `/guilds/{guild.id}/members/@me/nick`
*/
guildCurrentMemberNickname(guildID: Snowflake) {
return `/guilds/${guildID}/members/@me/nick` as const;
guildCurrentMemberNickname(guildId: Snowflake) {
return `/guilds/${guildId}/members/@me/nick` as const;
},
/**
@@ -268,16 +268,16 @@ export const Routes = {
* - PUT `/guilds/{guild.id}/members/{user.id}/roles/{role.id}`
* - DELETE `/guilds/{guild.id}/members/{user.id}/roles/{role.id}`
*/
guildMemberRole(guildID: Snowflake, memberID: Snowflake, roleID: Snowflake) {
return `/guilds/${guildID}/members/${memberID}/roles/${roleID}` as const;
guildMemberRole(guildId: Snowflake, memberId: Snowflake, roleId: Snowflake) {
return `/guilds/${guildId}/members/${memberId}/roles/${roleId}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/bans`
*/
guildBans(guildID: Snowflake) {
return `/guilds/${guildID}/bans` as const;
guildBans(guildId: Snowflake) {
return `/guilds/${guildId}/bans` as const;
},
/**
@@ -286,8 +286,8 @@ export const Routes = {
* - PUT `/guilds/{guild.id}/bans/{user.id}`
* - DELETE `/guilds/{guild.id}/bans/{user.id}`
*/
guildBan(guildID: Snowflake, userID: Snowflake) {
return `/guilds/${guildID}/bans/${userID}` as const;
guildBan(guildId: Snowflake, userId: Snowflake) {
return `/guilds/${guildId}/bans/${userId}` as const;
},
/**
@@ -296,8 +296,8 @@ export const Routes = {
* - POST `/guilds/{guild.id}/roles`
* - PATCH `/guilds/{guild.id}/roles`
*/
guildRoles(guildID: Snowflake) {
return `/guilds/${guildID}/roles` as const;
guildRoles(guildId: Snowflake) {
return `/guilds/${guildId}/roles` as const;
},
/**
@@ -305,8 +305,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/roles/{role.id}`
* - DELETE `/guilds/{guild.id}/roles/{role.id}`
*/
guildRole(guildID: Snowflake, roleID: Snowflake) {
return `/guilds/${guildID}/roles/${roleID}` as const;
guildRole(guildId: Snowflake, roleId: Snowflake) {
return `/guilds/${guildId}/roles/${roleId}` as const;
},
/**
@@ -314,40 +314,40 @@ export const Routes = {
* - GET `/guilds/{guild.id}/prune`
* - POST `/guilds/{guild.id}/prune`
*/
guildPrune(guildID: Snowflake) {
return `/guilds/${guildID}/prune` as const;
guildPrune(guildId: Snowflake) {
return `/guilds/${guildId}/prune` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/regions`
*/
guildVoiceRegions(guildID: Snowflake) {
return `/guilds/${guildID}/regions` as const;
guildVoiceRegions(guildId: Snowflake) {
return `/guilds/${guildId}/regions` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/invites`
*/
guildInvites(guildID: Snowflake) {
return `/guilds/${guildID}/invites` as const;
guildInvites(guildId: Snowflake) {
return `/guilds/${guildId}/invites` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/integrations`
*/
guildIntegrations(guildID: Snowflake) {
return `/guilds/${guildID}/integrations` as const;
guildIntegrations(guildId: Snowflake) {
return `/guilds/${guildId}/integrations` as const;
},
/**
* Route for:
* - DELETE `/guilds/{guild.id}/integrations/{integration.id}`
*/
guildIntegration(guildID: Snowflake, integrationID: Snowflake) {
return `/guilds/${guildID}/integrations/${integrationID}` as const;
guildIntegration(guildId: Snowflake, integrationId: Snowflake) {
return `/guilds/${guildId}/integrations/${integrationId}` as const;
},
/**
@@ -355,32 +355,32 @@ export const Routes = {
* - GET `/guilds/{guild.id}/widget`
* - PATCH `/guilds/{guild.id}/widget`
*/
guildWidgetSettings(guildID: Snowflake) {
return `/guilds/${guildID}/widget` as const;
guildWidgetSettings(guildId: Snowflake) {
return `/guilds/${guildId}/widget` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/widget.json`
*/
guildWidgetJSON(guildID: Snowflake) {
return `/guilds/${guildID}/widget.json` as const;
guildWidgetJSON(guildId: Snowflake) {
return `/guilds/${guildId}/widget.json` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/vanity-url`
*/
guildVanityUrl(guildID: Snowflake) {
return `/guilds/${guildID}/vanity-url` as const;
guildVanityUrl(guildId: Snowflake) {
return `/guilds/${guildId}/vanity-url` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/widget.png`
*/
guildWidgetImage(guildID: Snowflake) {
return `/guilds/${guildID}/widget.png` as const;
guildWidgetImage(guildId: Snowflake) {
return `/guilds/${guildId}/widget.png` as const;
},
/**
@@ -406,8 +406,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/templates`
* - POST `/guilds/{guild.id}/templates`
*/
guildTemplates(guildID: Snowflake) {
return `/guilds/${guildID}/templates` as const;
guildTemplates(guildId: Snowflake) {
return `/guilds/${guildId}/templates` as const;
},
/**
@@ -416,8 +416,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/templates/{template.code}`
* - DELETE `/guilds/{guild.id}/templates/{template.code}`
*/
guildTemplate(guildID: Snowflake, code: string) {
return `/guilds/${guildID}/templates/${code}` as const;
guildTemplate(guildId: Snowflake, code: string) {
return `/guilds/${guildId}/templates/${code}` as const;
},
/**
@@ -425,10 +425,10 @@ export const Routes = {
* - POST `/channels/{channel.id}/threads`
* - POST `/channels/{channel.id}/messages/{message.id}/threads`
*/
threads(parentID: Snowflake, messageID?: Snowflake) {
const parts = ['', 'channels', parentID];
threads(parentId: Snowflake, messageId?: Snowflake) {
const parts = ['', 'channels', parentId];
if (messageID) parts.push('messages', messageID);
if (messageId) parts.push('messages', messageId);
parts.push('threads');
@@ -441,8 +441,8 @@ export const Routes = {
* - GET `/channels/{channel.id}/threads/archived/public`
* - GET `/channels/{channel.id}/threads/archived/private`
*/
channelThreads(channelID: Snowflake, archived?: 'public' | 'private') {
const parts = ['', 'channels', channelID, 'threads'];
channelThreads(channelId: Snowflake, archived?: 'public' | 'private') {
const parts = ['', 'channels', channelId, 'threads'];
if (archived) parts.push('archived', archived);
else parts.push('active');
@@ -456,8 +456,8 @@ export const Routes = {
* Route for:
* - GET `/channels/{channel.id}/users/@me/threads/archived/prviate`
*/
channelJoinedArhivedThreads(channelID: Snowflake) {
return `/channels/${channelID}/users/@me/threads/archived/private` as const;
channelJoinedArhivedThreads(channelId: Snowflake) {
return `/channels/${channelId}/users/@me/threads/archived/private` as const;
},
/**
@@ -468,10 +468,10 @@ export const Routes = {
* - DELETE `/channels/{thread.id}/thread-members/@me`
* - DELETE `/channels/{thread.id}/thread-members/{user.id}`
*/
threadMembers(threadID: Snowflake, userID?: Snowflake | '@me') {
const parts = ['', 'channels', threadID, 'thread-members'];
threadMembers(threadId: Snowflake, userId?: Snowflake | '@me') {
const parts = ['', 'channels', threadId, 'thread-members'];
if (userID) parts.push(userID);
if (userId) parts.push(userId);
return parts.join('/') as
| `/channels/${Snowflake}/thread-members`
@@ -484,10 +484,10 @@ export const Routes = {
* - GET `/users/{user.id}`
* - PATCH `/users/@me`
*
* @param [userID='@me'] The user ID, defaulted to `@me`
* @param [userId='@me'] The user ID, defaulted to `@me`
*/
user(userID: Snowflake | '@me' = '@me') {
return `/users/${userID}` as const;
user(userId: Snowflake | '@me' = '@me') {
return `/users/${userId}` as const;
},
/**
@@ -502,8 +502,8 @@ export const Routes = {
* Route for:
* - DELETE `/users/@me/guilds/{guild.id}`
*/
userGuild(guildID: Snowflake) {
return `/users/@me/guilds/${guildID}` as const;
userGuild(guildId: Snowflake) {
return `/users/@me/guilds/${guildId}` as const;
},
/**
@@ -535,16 +535,16 @@ export const Routes = {
* - GET `/channels/{channel.id}/webhooks`
* - POST `/channels/{channel.id}/webhooks`
*/
channelWebhooks(channelID: Snowflake) {
return `/channels/${channelID}/webhooks` as const;
channelWebhooks(channelId: Snowflake) {
return `/channels/${channelId}/webhooks` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/webhooks`
*/
guildWebhooks(guildID: Snowflake) {
return `/guilds/${guildID}/webhooks` as const;
guildWebhooks(guildId: Snowflake) {
return `/guilds/${guildId}/webhooks` as const;
},
/**
@@ -559,8 +559,8 @@ export const Routes = {
*
* - POST `/webhooks/{application.id}/{interaction.token}`
*/
webhook(webhookID: Snowflake, webhookToken?: string) {
const parts = ['', 'webhooks', webhookID];
webhook(webhookId: Snowflake, webhookToken?: string) {
const parts = ['', 'webhooks', webhookId];
if (webhookToken) parts.push(webhookToken);
@@ -580,10 +580,10 @@ export const Routes = {
* - PATCH `/webhooks/{application.id}/{interaction.token}/messages/{message.id}`
* - DELETE `/webhooks/{application.id}/{interaction.token}/messages/{message.id}`
*
* @param [messageID='@original'] The message ID to change, defaulted to `@original`
* @param [messageId='@original'] The message ID to change, defaulted to `@original`
*/
webhookMessage(webhookID: Snowflake, webhookToken: string, messageID: Snowflake | '@original' = '@original') {
return `/webhooks/${webhookID}/${webhookToken}/messages/${messageID}` as const;
webhookMessage(webhookId: Snowflake, webhookToken: string, messageId: Snowflake | '@original' = '@original') {
return `/webhooks/${webhookId}/${webhookToken}/messages/${messageId}` as const;
},
/**
@@ -591,8 +591,8 @@ export const Routes = {
* - POST `/webhooks/{webhook.id}/{webhook.token}/github`
* - POST `/webhooks/{webhook.id}/{webhook.token}/slack`
*/
webhookPlatform(webhookID: Snowflake, webhookToken: string, platform: 'github' | 'slack') {
return `/webhooks/${webhookID}/${webhookToken}/${platform}` as const;
webhookPlatform(webhookId: Snowflake, webhookToken: string, platform: 'github' | 'slack') {
return `/webhooks/${webhookId}/${webhookToken}/${platform}` as const;
},
/**
@@ -633,8 +633,8 @@ export const Routes = {
* - PUT `/applications/{application.id}/commands`
* - POST `/applications/{application.id}/commands`
*/
applicationCommands(applicationID: Snowflake) {
return `/applications/${applicationID}/commands` as const;
applicationCommands(applicationId: Snowflake) {
return `/applications/${applicationId}/commands` as const;
},
/**
@@ -643,8 +643,8 @@ export const Routes = {
* - PATCH `/applications/{application.id}/commands/{command.id}`
* - DELETE `/applications/{application.id}/commands/{command.id}`
*/
applicationCommand(applicationID: Snowflake, commandID: Snowflake) {
return `/applications/${applicationID}/commands/${commandID}` as const;
applicationCommand(applicationId: Snowflake, commandId: Snowflake) {
return `/applications/${applicationId}/commands/${commandId}` as const;
},
/**
@@ -653,8 +653,8 @@ export const Routes = {
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands`
* - POST `/applications/{application.id}/guilds/{guild.id}/commands`
*/
applicationGuildCommands(applicationID: Snowflake, guildID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands` as const;
applicationGuildCommands(applicationId: Snowflake, guildId: Snowflake) {
return `/applications/${applicationId}/guilds/${guildId}/commands` as const;
},
/**
@@ -663,16 +663,16 @@ export const Routes = {
* - PATCH `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}`
* - DELETE `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}`
*/
applicationGuildCommand(applicationID: Snowflake, guildID: Snowflake, commandID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}` as const;
applicationGuildCommand(applicationId: Snowflake, guildId: Snowflake, commandId: Snowflake) {
return `/applications/${applicationId}/guilds/${guildId}/commands/${commandId}` as const;
},
/**
* Route for:
* - POST `/interactions/{interaction.id}/{interaction.token}/callback`
*/
interactionCallback(interactionID: Snowflake, interactionToken: string) {
return `/interactions/${interactionID}/${interactionToken}/callback` as const;
interactionCallback(interactionId: Snowflake, interactionToken: string) {
return `/interactions/${interactionId}/${interactionToken}/callback` as const;
},
/**
@@ -680,8 +680,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/member-verification`
* - PATCH `/guilds/{guild.id}/member-verification`
*/
guildMemberVerification(guildID: Snowflake) {
return `/guilds/${guildID}/member-verification` as const;
guildMemberVerification(guildId: Snowflake) {
return `/guilds/${guildId}/member-verification` as const;
},
/**
@@ -689,8 +689,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/voice-states/@me`
* - PATCH `/guilds/{guild.id}/voice-states/{user.id}`
*/
guildVoiceState(guildID: Snowflake, userID: Snowflake | '@me' = '@me') {
return `/guilds/${guildID}/voice-states/${userID}` as const;
guildVoiceState(guildId: Snowflake, userId: Snowflake | '@me' = '@me') {
return `/guilds/${guildId}/voice-states/${userId}` as const;
},
/**
@@ -698,8 +698,8 @@ export const Routes = {
* - GET `/applications/{application.id}/guilds/{guild.id}/commands/permissions`
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands/permissions`
*/
guildApplicationCommandsPermissions(applicationID: Snowflake, guildID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands/permissions` as const;
guildApplicationCommandsPermissions(applicationId: Snowflake, guildId: Snowflake) {
return `/applications/${applicationId}/guilds/${guildId}/commands/permissions` as const;
},
/**
@@ -707,8 +707,8 @@ export const Routes = {
* - GET `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`
*/
applicationCommandPermissions(applicationID: Snowflake, guildID: Snowflake, commandID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}/permissions` as const;
applicationCommandPermissions(applicationId: Snowflake, guildId: Snowflake, commandId: Snowflake) {
return `/applications/${applicationId}/guilds/${guildId}/commands/${commandId}/permissions` as const;
},
/**
@@ -716,8 +716,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/welcome-screen`
* - PATCH `/guilds/{guild.id}/welcome-screen`
*/
guildWelcomeScreen(guildID: Snowflake) {
return `/guilds/${guildID}/welcome-screen` as const;
guildWelcomeScreen(guildId: Snowflake) {
return `/guilds/${guildId}/welcome-screen` as const;
},
/**
@@ -734,16 +734,16 @@ export const Routes = {
* - PATCH `/stage-instances/{channel.id}`
* - DELETE `/stage-instances/{channel.id}`
*/
stageInstance(channelID: Snowflake) {
return `/stage-instances/${channelID}` as const;
stageInstance(channelId: Snowflake) {
return `/stage-instances/${channelId}` as const;
},
/**
* Route for:
* - GET `/stickers/{sticker.id}`
*/
sticker(stickerID: Snowflake) {
return `/stickers/${stickerID}` as const;
sticker(stickerId: Snowflake) {
return `/stickers/${stickerId}` as const;
},
/**
@@ -759,8 +759,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/stickers`
* - POST `/guilds/{guild.id}/stickers`
*/
guildStickers(guildID: Snowflake) {
return `/guilds/${guildID}/stickers` as const;
guildStickers(guildId: Snowflake) {
return `/guilds/${guildId}/stickers` as const;
},
/**
@@ -769,8 +769,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/stickers/{sticker.id}`
* - DELETE `/guilds/{guild.id}/stickers/{sticker.id}`
*/
guildSticker(guildID: Snowflake, stickerID: Snowflake) {
return `/guilds/${guildID}/stickers/${stickerID}` as const;
guildSticker(guildId: Snowflake, stickerId: Snowflake) {
return `/guilds/${guildId}/stickers/${stickerId}` as const;
},
};

View File

@@ -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;
}
/**
@@ -214,12 +224,25 @@ export type RESTPostAPIWebhookWithTokenGitHubResult = never;
*/
export type RESTPostAPIWebhookWithTokenGitHubWaitResult = APIMessage;
/**
* https://discord.com/developers/docs/resources/webhook#get-webhook-message
*/
export type RESTGetAPIWebhookWithTokenMessageResult = 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
@@ -242,11 +265,6 @@ export type RESTPatchAPIWebhookWithTokenMessageFormDataBody =
file: unknown;
});
/**
* https://discord.com/developers/docs/resources/webhook#get-webhook-message
*/
export type RESTGetAPIWebhookWithTokenMessageResult = APIMessage;
/**
* 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;
};

View File

@@ -9,7 +9,7 @@ export enum RPCErrorCodes {
InvalidEvent,
InvalidChannel,
InvalidPermissions,
InvalidClientID,
InvalidClientId,
InvalidOrigin,
InvalidToken,
InvalidUser,
@@ -24,7 +24,7 @@ export enum RPCErrorCodes {
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-close-event-codes
*/
export enum RPCCloseEventCodes {
InvalidClientID = 4000,
InvalidClientId = 4000,
InvalidOrigin,
RateLimited,
TokenRevoked,

View File

@@ -9,7 +9,7 @@ export enum RPCErrorCodes {
InvalidEvent,
InvalidChannel,
InvalidPermissions,
InvalidClientID,
InvalidClientId,
InvalidOrigin,
InvalidToken,
InvalidUser,
@@ -24,7 +24,7 @@ export enum RPCErrorCodes {
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-close-event-codes
*/
export enum RPCCloseEventCodes {
InvalidClientID = 4000,
InvalidClientId = 4000,
InvalidOrigin,
RateLimited,
TokenRevoked,

3
deno/utils/internals.ts Normal file
View File

@@ -0,0 +1,3 @@
export type Nullable<T> = {
[P in keyof T]: T[P] | null;
};

View File

@@ -3,7 +3,7 @@ import {
APIApplicationCommandGuildInteraction,
APIApplicationCommandInteraction,
APIButtonComponent,
APIButtonComponentWithCustomID,
APIButtonComponentWithCustomId,
APIButtonComponentWithURL,
APIDMInteraction,
APIGuildInteraction,
@@ -98,6 +98,6 @@ export function isLinkButton(component: APIButtonComponent): component is APIBut
* @param button The button to check against
* @returns A boolean that indicates if the button has a `custom_id` attached to it
*/
export function isStyledButton(component: APIButtonComponent): component is APIButtonComponentWithCustomID {
export function isInteractionButton(component: APIButtonComponent): component is APIButtonComponentWithCustomId {
return component.style !== ButtonStyle.Link;
}

View File

@@ -3,7 +3,7 @@ import {
APIApplicationCommandGuildInteraction,
APIApplicationCommandInteraction,
APIButtonComponent,
APIButtonComponentWithCustomID,
APIButtonComponentWithCustomId,
APIButtonComponentWithURL,
APIDMInteraction,
APIGuildInteraction,
@@ -98,6 +98,6 @@ export function isLinkButton(component: APIButtonComponent): component is APIBut
* @param button The button to check against
* @returns A boolean that indicates if the button has a `custom_id` attached to it
*/
export function isStyledButton(component: APIButtonComponent): component is APIButtonComponentWithCustomID {
export function isInteractionButton(component: APIButtonComponent): component is APIButtonComponentWithCustomId {
return component.style !== ButtonStyle.Link;
}

View File

@@ -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;
/**

View File

@@ -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;
/**

4
package-lock.json generated
View File

@@ -1,11 +1,11 @@
{
"name": "discord-api-types",
"version": "0.19.0",
"version": "0.20.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "0.19.0",
"version": "0.20.2",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.14.6",

View File

@@ -1,6 +1,6 @@
{
"name": "discord-api-types",
"version": "0.19.0",
"version": "0.20.2",
"description": "Discord API typings that are kept up to date for use in bot library creation.",
"main": "./v9.js",
"module": "./v9.mjs",

View File

@@ -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

View File

@@ -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,

View File

@@ -0,0 +1,4 @@
import type { APIBaseInteraction } from './base';
import type { InteractionType } from './responses';
export type APIPingInteraction = APIBaseInteraction<InteractionType.Ping, never>;

View File

@@ -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

View File

@@ -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
View 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,
}

View File

@@ -249,13 +249,13 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeySplashHash
| APIAuditLogChangeKeyDiscoverySplashHash
| APIAuditLogChangeKeyBannerHash
| APIAuditLogChangeKeyOwnerID
| APIAuditLogChangeKeyOwnerId
| APIAuditLogChangeKeyRegion
| APIAuditLogChangeKeyPreferredLocale
| APIAuditLogChangeKeyAFKChannelID
| APIAuditLogChangeKeyAFKChannelId
| APIAuditLogChangeKeyAFKTimeout
| APIAuditLogChangeKeyRulesChannelID
| APIAuditLogChangeKeyPublicUpdatesChannelID
| APIAuditLogChangeKeyRulesChannelId
| APIAuditLogChangeKeyPublicUpdatesChannelId
| APIAuditLogChangeKeyMFALevel
| APIAuditLogChangeKeyVerificationLevel
| APIAuditLogChangeKeyExplicitContentFilter
@@ -265,14 +265,14 @@ export type APIAuditLogChange =
| APIAuditLogChangeKey$Remove
| APIAuditLogChangeKeyPruneDeleteDays
| APIAuditLogChangeKeyWidgetEnabled
| APIAuditLogChangeKeyWidgetChannelID
| APIAuditLogChangeKeySystemChannelID
| APIAuditLogChangeKeyWidgetChannelId
| APIAuditLogChangeKeySystemChannelId
| APIAuditLogChangeKeyPosition
| APIAuditLogChangeKeyTopic
| APIAuditLogChangeKeyBitrate
| APIAuditLogChangeKeyPermissionOverwrites
| APIAuditLogChangeKeyNSFW
| APIAuditLogChangeKeyApplicationID
| APIAuditLogChangeKeyApplicationId
| APIAuditLogChangeKeyRateLimitPerUser
| APIAuditLogChangeKeyPermissions
| APIAuditLogChangeKeyColor
@@ -281,8 +281,8 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyAllow
| APIAuditLogChangeKeyDeny
| APIAuditLogChangeKeyCode
| APIAuditLogChangeKeyChannelID
| APIAuditLogChangeKeyInviterID
| APIAuditLogChangeKeyChannelId
| APIAuditLogChangeKeyInviterId
| APIAuditLogChangeKeyMaxUses
| APIAuditLogChangeKeyUses
| APIAuditLogChangeKeyMaxAge
@@ -291,7 +291,7 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyMute
| APIAuditLogChangeKeyNick
| APIAuditLogChangeKeyAvatarHash
| APIAuditLogChangeKeyID
| APIAuditLogChangeKeyId
| APIAuditLogChangeKeyType
| APIAuditLogChangeKeyEnableEmoticons
| APIAuditLogChangeKeyExpireBehavior
@@ -302,7 +302,7 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyFormatType
| APIAuditLogChangeKeyAsset
| APIAuditLogChangeKeyAvailable
| APIAuditLogChangeKeyGuildID;
| APIAuditLogChangeKeyGuildId;
/**
* Returned when an entity's name is changed
@@ -337,7 +337,7 @@ export type APIAuditLogChangeKeyBannerHash = AuditLogChangeData<'banner_hash', s
/**
* Returned when a guild's owner_id is changed
*/
export type APIAuditLogChangeKeyOwnerID = AuditLogChangeData<'owner_id', Snowflake>;
export type APIAuditLogChangeKeyOwnerId = AuditLogChangeData<'owner_id', Snowflake>;
/**
* Returned when a guild's region is changed
@@ -352,7 +352,7 @@ export type APIAuditLogChangeKeyPreferredLocale = AuditLogChangeData<'preferred_
/**
* Returned when a guild's afk_channel_id is changed
*/
export type APIAuditLogChangeKeyAFKChannelID = AuditLogChangeData<'afk_channel_id', Snowflake>;
export type APIAuditLogChangeKeyAFKChannelId = AuditLogChangeData<'afk_channel_id', Snowflake>;
/**
* Returned when a guild's afk_timeout is changed
@@ -362,12 +362,12 @@ export type APIAuditLogChangeKeyAFKTimeout = AuditLogChangeData<'afk_timeout', n
/**
* Returned when a guild's rules_channel_id is changed
*/
export type APIAuditLogChangeKeyRulesChannelID = AuditLogChangeData<'rules_channel_id', string>;
export type APIAuditLogChangeKeyRulesChannelId = AuditLogChangeData<'rules_channel_id', string>;
/**
* Returned when a guild's public_updates_channel_id is changed
*/
export type APIAuditLogChangeKeyPublicUpdatesChannelID = AuditLogChangeData<'public_updates_channel_id', string>;
export type APIAuditLogChangeKeyPublicUpdatesChannelId = AuditLogChangeData<'public_updates_channel_id', string>;
/**
* Returned when a guild's mfa_level is changed
@@ -423,12 +423,12 @@ export type APIAuditLogChangeKeyWidgetEnabled = AuditLogChangeData<'widget_enabl
/**
* Returned when a guild's widget_channel_id is changed
*/
export type APIAuditLogChangeKeyWidgetChannelID = AuditLogChangeData<'widget_channel_id', Snowflake>;
export type APIAuditLogChangeKeyWidgetChannelId = AuditLogChangeData<'widget_channel_id', Snowflake>;
/**
* Returned when a guild's system_channel_id is changed
*/
export type APIAuditLogChangeKeySystemChannelID = AuditLogChangeData<'system_channel_id', Snowflake>;
export type APIAuditLogChangeKeySystemChannelId = AuditLogChangeData<'system_channel_id', Snowflake>;
/**
* Returned when a channel's position is changed
@@ -458,7 +458,7 @@ export type APIAuditLogChangeKeyNSFW = AuditLogChangeData<'nsfw', boolean>;
/**
* The application ID of the added or removed Webhook or Bot
*/
export type APIAuditLogChangeKeyApplicationID = AuditLogChangeData<'application_id', Snowflake>;
export type APIAuditLogChangeKeyApplicationId = AuditLogChangeData<'application_id', Snowflake>;
/**
* Returned when a channel's amount of seconds a user has to wait before sending another message
@@ -504,12 +504,12 @@ export type APIAuditLogChangeKeyCode = AuditLogChangeData<'code', string>;
/**
* Returned when an invite's channel_id is changed
*/
export type APIAuditLogChangeKeyChannelID = AuditLogChangeData<'channel_id', Snowflake>;
export type APIAuditLogChangeKeyChannelId = AuditLogChangeData<'channel_id', Snowflake>;
/**
* Returned when an invite's inviter_id is changed
*/
export type APIAuditLogChangeKeyInviterID = AuditLogChangeData<'inviter_id', Snowflake>;
export type APIAuditLogChangeKeyInviterId = AuditLogChangeData<'inviter_id', Snowflake>;
/**
* Returned when an invite's max_uses is changed
@@ -554,7 +554,7 @@ export type APIAuditLogChangeKeyAvatarHash = AuditLogChangeData<'avatar_hash', s
/**
* The ID of the changed entity - sometimes used in conjunction with other keys
*/
export type APIAuditLogChangeKeyID = AuditLogChangeData<'id', Snowflake>;
export type APIAuditLogChangeKeyId = AuditLogChangeData<'id', Snowflake>;
/**
* The type of entity created
@@ -609,7 +609,7 @@ export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', bool
/**
* Returned when a sticker's guild_id is changed
*/
export type APIAuditLogChangeKeyGuildID = AuditLogChangeData<'guild_id', Snowflake>;
export type APIAuditLogChangeKeyGuildId = AuditLogChangeData<'guild_id', Snowflake>;
interface AuditLogChangeData<K extends string, D extends unknown> {
key: K;

View File

@@ -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;
/**
@@ -962,7 +962,7 @@ interface APIButtonComponentBase<Style extends ButtonStyle> extends APIBaseMessa
disabled?: boolean;
}
export interface APIButtonComponentWithCustomID
export interface APIButtonComponentWithCustomId
extends APIButtonComponentBase<
ButtonStyle.Primary | ButtonStyle.Secondary | ButtonStyle.Success | ButtonStyle.Danger
> {
@@ -979,7 +979,7 @@ export interface APIButtonComponentWithURL extends APIButtonComponentBase<Button
url: string;
}
export type APIButtonComponent = APIButtonComponentWithCustomID | APIButtonComponentWithURL;
export type APIButtonComponent = APIButtonComponentWithCustomId | APIButtonComponentWithURL;
/**
* https://discord.com/developers/docs/interactions/message-components#button-object-button-styles

View File

@@ -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;
/**

View File

@@ -1,3 +1,4 @@
export * from './application';
export * from './auditLog';
export * from './channel';
export * from './emoji';

View File

@@ -1,9 +1,10 @@
import {
import type {
APIMessageComponentDMInteraction,
APIMessageComponentGuildInteraction,
APIMessageComponentInteraction,
} from './_interactions/messageComponents';
import {
import type { APIPingInteraction } from './_interactions/ping';
import type {
APIApplicationCommandDMInteraction,
APIApplicationCommandGuildInteraction,
APIApplicationCommandInteraction,
@@ -14,7 +15,7 @@ export * from './_interactions/messageComponents';
export * from './_interactions/responses';
export * from './_interactions/slashCommands';
export type APIInteraction = APIApplicationCommandInteraction | APIMessageComponentInteraction;
export type APIInteraction = APIPingInteraction | APIApplicationCommandInteraction | APIMessageComponentInteraction;
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;

View File

@@ -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';

View File

@@ -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

View File

@@ -45,6 +45,7 @@ export const PermissionFlagsBits = {
ManageEmojisAndStickers: 1n << 30n,
UseSlashCommands: 1n << 31n,
RequestToSpeak: 1n << 32n,
UseExternalStickers: 1n << 37n,
} as const;
/**

View File

@@ -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
*/

View File

@@ -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,
}

View File

@@ -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

View File

@@ -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,

View File

@@ -0,0 +1,4 @@
import type { APIBaseInteraction } from './base';
import type { InteractionType } from './responses';
export type APIPingInteraction = APIBaseInteraction<InteractionType.Ping, never>;

View File

@@ -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

View File

@@ -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
View 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,
}

View File

@@ -249,13 +249,13 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeySplashHash
| APIAuditLogChangeKeyDiscoverySplashHash
| APIAuditLogChangeKeyBannerHash
| APIAuditLogChangeKeyOwnerID
| APIAuditLogChangeKeyOwnerId
| APIAuditLogChangeKeyRegion
| APIAuditLogChangeKeyPreferredLocale
| APIAuditLogChangeKeyAFKChannelID
| APIAuditLogChangeKeyAFKChannelId
| APIAuditLogChangeKeyAFKTimeout
| APIAuditLogChangeKeyRulesChannelID
| APIAuditLogChangeKeyPublicUpdatesChannelID
| APIAuditLogChangeKeyRulesChannelId
| APIAuditLogChangeKeyPublicUpdatesChannelId
| APIAuditLogChangeKeyMFALevel
| APIAuditLogChangeKeyVerificationLevel
| APIAuditLogChangeKeyExplicitContentFilter
@@ -265,14 +265,14 @@ export type APIAuditLogChange =
| APIAuditLogChangeKey$Remove
| APIAuditLogChangeKeyPruneDeleteDays
| APIAuditLogChangeKeyWidgetEnabled
| APIAuditLogChangeKeyWidgetChannelID
| APIAuditLogChangeKeySystemChannelID
| APIAuditLogChangeKeyWidgetChannelId
| APIAuditLogChangeKeySystemChannelId
| APIAuditLogChangeKeyPosition
| APIAuditLogChangeKeyTopic
| APIAuditLogChangeKeyBitrate
| APIAuditLogChangeKeyPermissionOverwrites
| APIAuditLogChangeKeyNSFW
| APIAuditLogChangeKeyApplicationID
| APIAuditLogChangeKeyApplicationId
| APIAuditLogChangeKeyRateLimitPerUser
| APIAuditLogChangeKeyPermissions
| APIAuditLogChangeKeyColor
@@ -281,8 +281,8 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyAllow
| APIAuditLogChangeKeyDeny
| APIAuditLogChangeKeyCode
| APIAuditLogChangeKeyChannelID
| APIAuditLogChangeKeyInviterID
| APIAuditLogChangeKeyChannelId
| APIAuditLogChangeKeyInviterId
| APIAuditLogChangeKeyMaxUses
| APIAuditLogChangeKeyUses
| APIAuditLogChangeKeyMaxAge
@@ -291,7 +291,7 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyMute
| APIAuditLogChangeKeyNick
| APIAuditLogChangeKeyAvatarHash
| APIAuditLogChangeKeyID
| APIAuditLogChangeKeyId
| APIAuditLogChangeKeyType
| APIAuditLogChangeKeyEnableEmoticons
| APIAuditLogChangeKeyExpireBehavior
@@ -302,7 +302,7 @@ export type APIAuditLogChange =
| APIAuditLogChangeKeyFormatType
| APIAuditLogChangeKeyAsset
| APIAuditLogChangeKeyAvailable
| APIAuditLogChangeKeyGuildID;
| APIAuditLogChangeKeyGuildId;
/**
* Returned when an entity's name is changed
@@ -337,7 +337,7 @@ export type APIAuditLogChangeKeyBannerHash = AuditLogChangeData<'banner_hash', s
/**
* Returned when a guild's owner_id is changed
*/
export type APIAuditLogChangeKeyOwnerID = AuditLogChangeData<'owner_id', Snowflake>;
export type APIAuditLogChangeKeyOwnerId = AuditLogChangeData<'owner_id', Snowflake>;
/**
* Returned when a guild's region is changed
@@ -352,7 +352,7 @@ export type APIAuditLogChangeKeyPreferredLocale = AuditLogChangeData<'preferred_
/**
* Returned when a guild's afk_channel_id is changed
*/
export type APIAuditLogChangeKeyAFKChannelID = AuditLogChangeData<'afk_channel_id', Snowflake>;
export type APIAuditLogChangeKeyAFKChannelId = AuditLogChangeData<'afk_channel_id', Snowflake>;
/**
* Returned when a guild's afk_timeout is changed
@@ -362,12 +362,12 @@ export type APIAuditLogChangeKeyAFKTimeout = AuditLogChangeData<'afk_timeout', n
/**
* Returned when a guild's rules_channel_id is changed
*/
export type APIAuditLogChangeKeyRulesChannelID = AuditLogChangeData<'rules_channel_id', string>;
export type APIAuditLogChangeKeyRulesChannelId = AuditLogChangeData<'rules_channel_id', string>;
/**
* Returned when a guild's public_updates_channel_id is changed
*/
export type APIAuditLogChangeKeyPublicUpdatesChannelID = AuditLogChangeData<'public_updates_channel_id', string>;
export type APIAuditLogChangeKeyPublicUpdatesChannelId = AuditLogChangeData<'public_updates_channel_id', string>;
/**
* Returned when a guild's mfa_level is changed
@@ -423,12 +423,12 @@ export type APIAuditLogChangeKeyWidgetEnabled = AuditLogChangeData<'widget_enabl
/**
* Returned when a guild's widget_channel_id is changed
*/
export type APIAuditLogChangeKeyWidgetChannelID = AuditLogChangeData<'widget_channel_id', Snowflake>;
export type APIAuditLogChangeKeyWidgetChannelId = AuditLogChangeData<'widget_channel_id', Snowflake>;
/**
* Returned when a guild's system_channel_id is changed
*/
export type APIAuditLogChangeKeySystemChannelID = AuditLogChangeData<'system_channel_id', Snowflake>;
export type APIAuditLogChangeKeySystemChannelId = AuditLogChangeData<'system_channel_id', Snowflake>;
/**
* Returned when a channel's position is changed
@@ -458,7 +458,7 @@ export type APIAuditLogChangeKeyNSFW = AuditLogChangeData<'nsfw', boolean>;
/**
* The application ID of the added or removed Webhook or Bot
*/
export type APIAuditLogChangeKeyApplicationID = AuditLogChangeData<'application_id', Snowflake>;
export type APIAuditLogChangeKeyApplicationId = AuditLogChangeData<'application_id', Snowflake>;
/**
* Returned when a channel's amount of seconds a user has to wait before sending another message
@@ -504,12 +504,12 @@ export type APIAuditLogChangeKeyCode = AuditLogChangeData<'code', string>;
/**
* Returned when an invite's channel_id is changed
*/
export type APIAuditLogChangeKeyChannelID = AuditLogChangeData<'channel_id', Snowflake>;
export type APIAuditLogChangeKeyChannelId = AuditLogChangeData<'channel_id', Snowflake>;
/**
* Returned when an invite's inviter_id is changed
*/
export type APIAuditLogChangeKeyInviterID = AuditLogChangeData<'inviter_id', Snowflake>;
export type APIAuditLogChangeKeyInviterId = AuditLogChangeData<'inviter_id', Snowflake>;
/**
* Returned when an invite's max_uses is changed
@@ -554,7 +554,7 @@ export type APIAuditLogChangeKeyAvatarHash = AuditLogChangeData<'avatar_hash', s
/**
* The ID of the changed entity - sometimes used in conjunction with other keys
*/
export type APIAuditLogChangeKeyID = AuditLogChangeData<'id', Snowflake>;
export type APIAuditLogChangeKeyId = AuditLogChangeData<'id', Snowflake>;
/**
* The type of entity created
@@ -609,7 +609,7 @@ export type APIAuditLogChangeKeyAvailable = AuditLogChangeData<'available', bool
/**
* Returned when a sticker's guild_id is changed
*/
export type APIAuditLogChangeKeyGuildID = AuditLogChangeData<'guild_id', Snowflake>;
export type APIAuditLogChangeKeyGuildId = AuditLogChangeData<'guild_id', Snowflake>;
interface AuditLogChangeData<K extends string, D extends unknown> {
key: K;

View File

@@ -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;
/**
@@ -1082,7 +1082,7 @@ interface APIButtonComponentBase<Style extends ButtonStyle> extends APIBaseMessa
disabled?: boolean;
}
export interface APIButtonComponentWithCustomID
export interface APIButtonComponentWithCustomId
extends APIButtonComponentBase<
ButtonStyle.Primary | ButtonStyle.Secondary | ButtonStyle.Success | ButtonStyle.Danger
> {
@@ -1099,7 +1099,7 @@ export interface APIButtonComponentWithURL extends APIButtonComponentBase<Button
url: string;
}
export type APIButtonComponent = APIButtonComponentWithCustomID | APIButtonComponentWithURL;
export type APIButtonComponent = APIButtonComponentWithCustomId | APIButtonComponentWithURL;
/**
* https://discord.com/developers/docs/interactions/message-components#button-object-button-styles

View File

@@ -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;
/**

View File

@@ -1,3 +1,4 @@
export * from './application';
export * from './auditLog';
export * from './channel';
export * from './emoji';

View File

@@ -1,9 +1,10 @@
import {
import type {
APIMessageComponentDMInteraction,
APIMessageComponentGuildInteraction,
APIMessageComponentInteraction,
} from './_interactions/messageComponents';
import {
import type { APIPingInteraction } from './_interactions/ping';
import type {
APIApplicationCommandDMInteraction,
APIApplicationCommandGuildInteraction,
APIApplicationCommandInteraction,
@@ -14,7 +15,7 @@ export * from './_interactions/messageComponents';
export * from './_interactions/responses';
export * from './_interactions/slashCommands';
export type APIInteraction = APIApplicationCommandInteraction | APIMessageComponentInteraction;
export type APIInteraction = APIPingInteraction | APIApplicationCommandInteraction | APIMessageComponentInteraction;
export type APIDMInteraction = APIApplicationCommandDMInteraction | APIMessageComponentDMInteraction;

View File

@@ -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';

View File

@@ -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

View File

@@ -48,6 +48,7 @@ export const PermissionFlagsBits = {
ManageThreads: 1n << 34n,
UsePublicThreads: 1n << 35n,
UsePrivateThreads: 1n << 36n,
UseExternalStickers: 1n << 37n,
} as const;
/**

View File

@@ -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
*/

View File

@@ -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,
}

View File

@@ -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,16 +161,24 @@ export const enum RESTJSONErrorCodes {
TwoFactorAuthenticationIsRequired = 60003,
NoUsersWithDiscordTagExist = 80004,
ReactionWasBlocked = 90001,
APIResourceOverloaded = 130000,
TheStageIsAlreadyOpen = 150006,
ThreadAlreadyCreatedForMessage = 160004,
ThreadLocked,
MaximumActiveThreads,
MaximumActiveAnnouncementThreads,
InvalidJSONForUploadedLottieFile = 170001,
LottieAnimationMaximumDimensionsExceeded = 170005,
UploadedLottiesCannotContainRasterizedImages,
StickerMaximumFramerateExceeded,
StickerFrameCountExceedsMaximumOf1000Frames,
LottieAnimationMaximumDimensionsExceeded,
StickerFramerateIsTooSmallOrTooLarge,
StickerAnimationDurationExceedsMaximumOf5Seconds,
}

View File

@@ -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
*/

View File

@@ -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;
};

View File

@@ -24,8 +24,8 @@ export const Routes = {
* Route for:
* - GET `/guilds/{guild.id}/audit-logs`
*/
guildAuditLog(guildID: Snowflake) {
return `/guilds/${guildID}/audit-logs` as const;
guildAuditLog(guildId: Snowflake) {
return `/guilds/${guildId}/audit-logs` as const;
},
/**
@@ -34,8 +34,8 @@ export const Routes = {
* - PATCH `/channels/{channel.id}`
* - DELETE `/channels/{channel.id}`
*/
channel(channelID: Snowflake) {
return `/channels/${channelID}` as const;
channel(channelId: Snowflake) {
return `/channels/${channelId}` as const;
},
/**
@@ -43,8 +43,8 @@ export const Routes = {
* - GET `/channels/{channel.id}/messages`
* - POST `/channels/{channel.id}/messages`
*/
channelMessages(channelID: Snowflake) {
return `/channels/${channelID}/messages` as const;
channelMessages(channelId: Snowflake) {
return `/channels/${channelId}/messages` as const;
},
/**
@@ -53,16 +53,16 @@ export const Routes = {
* - PATCH `/channels/{channel.id}/messages/{message.id}`
* - DELETE `/channels/{channel.id}/messages/{message.id}`
*/
channelMessage(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}` as const;
channelMessage(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/messages/${messageId}` as const;
},
/**
* Route for:
* - POST `/channels/{channel.id}/messages/{message.id}/crosspost`
*/
channelMessageCrosspost(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}/crosspost` as const;
channelMessageCrosspost(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/messages/${messageId}/crosspost` as const;
},
/**
@@ -72,8 +72,8 @@ export const Routes = {
*
* **Note**: You need to URL encode the emoji yourself
*/
channelMessageOwnReaction(channelID: Snowflake, messageID: Snowflake, emoji: string) {
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/@me` as const;
channelMessageOwnReaction(channelId: Snowflake, messageId: Snowflake, emoji: string) {
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}/@me` as const;
},
/**
@@ -82,8 +82,8 @@ export const Routes = {
*
* **Note**: You need to URL encode the emoji yourself
*/
channelMessageUserReaction(channelID: Snowflake, messageID: Snowflake, emoji: string, userID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/${userID}` as const;
channelMessageUserReaction(channelId: Snowflake, messageId: Snowflake, emoji: string, userId: Snowflake) {
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}/${userId}` as const;
},
/**
@@ -93,24 +93,24 @@ export const Routes = {
*
* **Note**: You need to URL encode the emoji yourself
*/
channelMessageReaction(channelID: Snowflake, messageID: Snowflake, emoji: string) {
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}` as const;
channelMessageReaction(channelId: Snowflake, messageId: Snowflake, emoji: string) {
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}` as const;
},
/**
* Route for:
* - DELETE `/channels/{channel.id}/messages/{message.id}/reactions`
*/
channelMessageAllReactions(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}/reactions` as const;
channelMessageAllReactions(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/messages/${messageId}/reactions` as const;
},
/**
* Route for:
* - POST `/channels/{channel.id}/messages/bulk-delete`
*/
channelBulkDelete(channelID: Snowflake) {
return `/channels/${channelID}/messages/bulk-delete` as const;
channelBulkDelete(channelId: Snowflake) {
return `/channels/${channelId}/messages/bulk-delete` as const;
},
/**
@@ -118,8 +118,8 @@ export const Routes = {
* - PUT `/channels/{channel.id}/permissions/{overwrite.id}`
* - DELETE `/channels/{channel.id}/permissions/{overwrite.id}`
*/
channelPermission(channelID: Snowflake, overwriteID: Snowflake) {
return `/channels/${channelID}/permissions/${overwriteID}` as const;
channelPermission(channelId: Snowflake, overwriteId: Snowflake) {
return `/channels/${channelId}/permissions/${overwriteId}` as const;
},
/**
@@ -127,32 +127,32 @@ export const Routes = {
* - GET `/channels/{channel.id}/invites`
* - POST `/channels/{channel.id}/invites`
*/
channelInvites(channelID: Snowflake) {
return `/channels/${channelID}/invites` as const;
channelInvites(channelId: Snowflake) {
return `/channels/${channelId}/invites` as const;
},
/**
* Route for:
* - POST `/channels/{channel.id}/followers`
*/
channelFollowers(channelID: Snowflake) {
return `/channels/${channelID}/followers` as const;
channelFollowers(channelId: Snowflake) {
return `/channels/${channelId}/followers` as const;
},
/**
* Route for:
* - POST `/channels/{channel.id}/typing`
*/
channelTyping(channelID: Snowflake) {
return `/channels/${channelID}/typing` as const;
channelTyping(channelId: Snowflake) {
return `/channels/${channelId}/typing` as const;
},
/**
* Route for:
* - GET `/channels/{channel.id}/pins`
*/
channelPins(channelID: Snowflake) {
return `/channels/${channelID}/pins` as const;
channelPins(channelId: Snowflake) {
return `/channels/${channelId}/pins` as const;
},
/**
@@ -160,8 +160,8 @@ export const Routes = {
* - PUT `/channels/{channel.id}/pins/{message.id}`
* - DELETE `/channels/{channel.id}/pins/{message.id}`
*/
channelPin(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/pins/${messageID}` as const;
channelPin(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/pins/${messageId}` as const;
},
/**
@@ -169,8 +169,8 @@ export const Routes = {
* - PUT `/channels/{channel.id}/recipients/{user.id}`
* - DELETE `/channels/{channel.id}/recipients/{user.id}`
*/
channelRecipient(channelID: Snowflake, userID: Snowflake) {
return `/channels/${channelID}/recipients/${userID}` as const;
channelRecipient(channelId: Snowflake, userId: Snowflake) {
return `/channels/${channelId}/recipients/${userId}` as const;
},
/**
@@ -178,8 +178,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/emojis`
* - POST `/guilds/{guild.id}/emojis`
*/
guildEmojis(guildID: Snowflake) {
return `/guilds/${guildID}/emojis` as const;
guildEmojis(guildId: Snowflake) {
return `/guilds/${guildId}/emojis` as const;
},
/**
@@ -188,8 +188,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/emojis/{emoji.id}`
* - DELETE `/guilds/{guild.id}/emojis/{emoji.id}`
*/
guildEmoji(guildID: Snowflake, emojiID: Snowflake) {
return `/guilds/${guildID}/emojis/${emojiID}` as const;
guildEmoji(guildId: Snowflake, emojiId: Snowflake) {
return `/guilds/${guildId}/emojis/${emojiId}` as const;
},
/**
@@ -206,16 +206,16 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}`
* - DELETE `/guilds/{guild.id}`
*/
guild(guildID: Snowflake) {
return `/guilds/${guildID}` as const;
guild(guildId: Snowflake) {
return `/guilds/${guildId}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/preview`
*/
guildPreview(guildID: Snowflake) {
return `/guilds/${guildID}/preview` as const;
guildPreview(guildId: Snowflake) {
return `/guilds/${guildId}/preview` as const;
},
/**
@@ -224,8 +224,8 @@ export const Routes = {
* - POST `/guilds/{guild.id}/channels`
* - PATCH `/guilds/{guild.id}/channels`
*/
guildChannels(guildID: Snowflake) {
return `/guilds/${guildID}/channels` as const;
guildChannels(guildId: Snowflake) {
return `/guilds/${guildId}/channels` as const;
},
/**
@@ -235,32 +235,32 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/members/{user.id}`
* - DELETE `/guilds/{guild.id}/members/{user.id}`
*/
guildMember(guildID: Snowflake, userID: Snowflake) {
return `/guilds/${guildID}/members/${userID}` as const;
guildMember(guildId: Snowflake, userId: Snowflake) {
return `/guilds/${guildId}/members/${userId}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/members`
*/
guildMembers(guildID: Snowflake) {
return `/guilds/${guildID}/members` as const;
guildMembers(guildId: Snowflake) {
return `/guilds/${guildId}/members` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/members/search`
*/
guildMembersSearch(guildID: Snowflake) {
return `/guilds/${guildID}/members/search` as const;
guildMembersSearch(guildId: Snowflake) {
return `/guilds/${guildId}/members/search` as const;
},
/**
* Route for:
* - PATCH `/guilds/{guild.id}/members/@me/nick`
*/
guildCurrentMemberNickname(guildID: Snowflake) {
return `/guilds/${guildID}/members/@me/nick` as const;
guildCurrentMemberNickname(guildId: Snowflake) {
return `/guilds/${guildId}/members/@me/nick` as const;
},
/**
@@ -268,16 +268,16 @@ export const Routes = {
* - PUT `/guilds/{guild.id}/members/{user.id}/roles/{role.id}`
* - DELETE `/guilds/{guild.id}/members/{user.id}/roles/{role.id}`
*/
guildMemberRole(guildID: Snowflake, memberID: Snowflake, roleID: Snowflake) {
return `/guilds/${guildID}/members/${memberID}/roles/${roleID}` as const;
guildMemberRole(guildId: Snowflake, memberId: Snowflake, roleId: Snowflake) {
return `/guilds/${guildId}/members/${memberId}/roles/${roleId}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/bans`
*/
guildBans(guildID: Snowflake) {
return `/guilds/${guildID}/bans` as const;
guildBans(guildId: Snowflake) {
return `/guilds/${guildId}/bans` as const;
},
/**
@@ -286,8 +286,8 @@ export const Routes = {
* - PUT `/guilds/{guild.id}/bans/{user.id}`
* - DELETE `/guilds/{guild.id}/bans/{user.id}`
*/
guildBan(guildID: Snowflake, userID: Snowflake) {
return `/guilds/${guildID}/bans/${userID}` as const;
guildBan(guildId: Snowflake, userId: Snowflake) {
return `/guilds/${guildId}/bans/${userId}` as const;
},
/**
@@ -296,8 +296,8 @@ export const Routes = {
* - POST `/guilds/{guild.id}/roles`
* - PATCH `/guilds/{guild.id}/roles`
*/
guildRoles(guildID: Snowflake) {
return `/guilds/${guildID}/roles` as const;
guildRoles(guildId: Snowflake) {
return `/guilds/${guildId}/roles` as const;
},
/**
@@ -305,8 +305,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/roles/{role.id}`
* - DELETE `/guilds/{guild.id}/roles/{role.id}`
*/
guildRole(guildID: Snowflake, roleID: Snowflake) {
return `/guilds/${guildID}/roles/${roleID}` as const;
guildRole(guildId: Snowflake, roleId: Snowflake) {
return `/guilds/${guildId}/roles/${roleId}` as const;
},
/**
@@ -314,40 +314,40 @@ export const Routes = {
* - GET `/guilds/{guild.id}/prune`
* - POST `/guilds/{guild.id}/prune`
*/
guildPrune(guildID: Snowflake) {
return `/guilds/${guildID}/prune` as const;
guildPrune(guildId: Snowflake) {
return `/guilds/${guildId}/prune` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/regions`
*/
guildVoiceRegions(guildID: Snowflake) {
return `/guilds/${guildID}/regions` as const;
guildVoiceRegions(guildId: Snowflake) {
return `/guilds/${guildId}/regions` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/invites`
*/
guildInvites(guildID: Snowflake) {
return `/guilds/${guildID}/invites` as const;
guildInvites(guildId: Snowflake) {
return `/guilds/${guildId}/invites` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/integrations`
*/
guildIntegrations(guildID: Snowflake) {
return `/guilds/${guildID}/integrations` as const;
guildIntegrations(guildId: Snowflake) {
return `/guilds/${guildId}/integrations` as const;
},
/**
* Route for:
* - DELETE `/guilds/{guild.id}/integrations/{integration.id}`
*/
guildIntegration(guildID: Snowflake, integrationID: Snowflake) {
return `/guilds/${guildID}/integrations/${integrationID}` as const;
guildIntegration(guildId: Snowflake, integrationId: Snowflake) {
return `/guilds/${guildId}/integrations/${integrationId}` as const;
},
/**
@@ -355,32 +355,32 @@ export const Routes = {
* - GET `/guilds/{guild.id}/widget`
* - PATCH `/guilds/{guild.id}/widget`
*/
guildWidgetSettings(guildID: Snowflake) {
return `/guilds/${guildID}/widget` as const;
guildWidgetSettings(guildId: Snowflake) {
return `/guilds/${guildId}/widget` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/widget.json`
*/
guildWidgetJSON(guildID: Snowflake) {
return `/guilds/${guildID}/widget.json` as const;
guildWidgetJSON(guildId: Snowflake) {
return `/guilds/${guildId}/widget.json` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/vanity-url`
*/
guildVanityUrl(guildID: Snowflake) {
return `/guilds/${guildID}/vanity-url` as const;
guildVanityUrl(guildId: Snowflake) {
return `/guilds/${guildId}/vanity-url` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/widget.png`
*/
guildWidgetImage(guildID: Snowflake) {
return `/guilds/${guildID}/widget.png` as const;
guildWidgetImage(guildId: Snowflake) {
return `/guilds/${guildId}/widget.png` as const;
},
/**
@@ -406,8 +406,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/templates`
* - POST `/guilds/{guild.id}/templates`
*/
guildTemplates(guildID: Snowflake) {
return `/guilds/${guildID}/templates` as const;
guildTemplates(guildId: Snowflake) {
return `/guilds/${guildId}/templates` as const;
},
/**
@@ -416,8 +416,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/templates/{template.code}`
* - DELETE `/guilds/{guild.id}/templates/{template.code}`
*/
guildTemplate(guildID: Snowflake, code: string) {
return `/guilds/${guildID}/templates/${code}` as const;
guildTemplate(guildId: Snowflake, code: string) {
return `/guilds/${guildId}/templates/${code}` as const;
},
/**
@@ -426,10 +426,10 @@ export const Routes = {
* - GET `/users/{user.id}`
* - PATCH `/users/@me`
*
* @param [userID='@me'] The user ID, defaulted to `@me`
* @param [userId='@me'] The user ID, defaulted to `@me`
*/
user(userID: Snowflake | '@me' = '@me') {
return `/users/${userID}` as const;
user(userId: Snowflake | '@me' = '@me') {
return `/users/${userId}` as const;
},
/**
@@ -444,8 +444,8 @@ export const Routes = {
* Route for:
* - DELETE `/users/@me/guilds/{guild.id}`
*/
userGuild(guildID: Snowflake) {
return `/users/@me/guilds/${guildID}` as const;
userGuild(guildId: Snowflake) {
return `/users/@me/guilds/${guildId}` as const;
},
/**
@@ -477,16 +477,16 @@ export const Routes = {
* - GET `/channels/{channel.id}/webhooks`
* - POST `/channels/{channel.id}/webhooks`
*/
channelWebhooks(channelID: Snowflake) {
return `/channels/${channelID}/webhooks` as const;
channelWebhooks(channelId: Snowflake) {
return `/channels/${channelId}/webhooks` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/webhooks`
*/
guildWebhooks(guildID: Snowflake) {
return `/guilds/${guildID}/webhooks` as const;
guildWebhooks(guildId: Snowflake) {
return `/guilds/${guildId}/webhooks` as const;
},
/**
@@ -501,8 +501,8 @@ export const Routes = {
*
* - POST `/webhooks/{application.id}/{interaction.token}`
*/
webhook(webhookID: Snowflake, webhookToken?: string) {
const parts = ['', 'webhooks', webhookID];
webhook(webhookId: Snowflake, webhookToken?: string) {
const parts = ['', 'webhooks', webhookId];
if (webhookToken) parts.push(webhookToken);
@@ -522,10 +522,10 @@ export const Routes = {
* - PATCH `/webhooks/{application.id}/{interaction.token}/messages/{message.id}`
* - DELETE `/webhooks/{application.id}/{interaction.token}/messages/{message.id}`
*
* @param [messageID='@original'] The message ID to change, defaulted to `@original`
* @param [messageId='@original'] The message ID to change, defaulted to `@original`
*/
webhookMessage(webhookID: Snowflake, webhookToken: string, messageID: Snowflake | '@original' = '@original') {
return `/webhooks/${webhookID}/${webhookToken}/messages/${messageID}` as const;
webhookMessage(webhookId: Snowflake, webhookToken: string, messageId: Snowflake | '@original' = '@original') {
return `/webhooks/${webhookId}/${webhookToken}/messages/${messageId}` as const;
},
/**
@@ -533,8 +533,8 @@ export const Routes = {
* - POST `/webhooks/{webhook.id}/{webhook.token}/github`
* - POST `/webhooks/{webhook.id}/{webhook.token}/slack`
*/
webhookPlatform(webhookID: Snowflake, webhookToken: string, platform: 'github' | 'slack') {
return `/webhooks/${webhookID}/${webhookToken}/${platform}` as const;
webhookPlatform(webhookId: Snowflake, webhookToken: string, platform: 'github' | 'slack') {
return `/webhooks/${webhookId}/${webhookToken}/${platform}` as const;
},
/**
@@ -575,8 +575,8 @@ export const Routes = {
* - PUT `/applications/{application.id}/commands`
* - POST `/applications/{application.id}/commands`
*/
applicationCommands(applicationID: Snowflake) {
return `/applications/${applicationID}/commands` as const;
applicationCommands(applicationId: Snowflake) {
return `/applications/${applicationId}/commands` as const;
},
/**
@@ -585,8 +585,8 @@ export const Routes = {
* - PATCH `/applications/{application.id}/commands/{command.id}`
* - DELETE `/applications/{application.id}/commands/{command.id}`
*/
applicationCommand(applicationID: Snowflake, commandID: Snowflake) {
return `/applications/${applicationID}/commands/${commandID}` as const;
applicationCommand(applicationId: Snowflake, commandId: Snowflake) {
return `/applications/${applicationId}/commands/${commandId}` as const;
},
/**
@@ -595,8 +595,8 @@ export const Routes = {
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands`
* - POST `/applications/{application.id}/guilds/{guild.id}/commands`
*/
applicationGuildCommands(applicationID: Snowflake, guildID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands` as const;
applicationGuildCommands(applicationId: Snowflake, guildId: Snowflake) {
return `/applications/${applicationId}/guilds/${guildId}/commands` as const;
},
/**
@@ -605,16 +605,16 @@ export const Routes = {
* - PATCH `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}`
* - DELETE `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}`
*/
applicationGuildCommand(applicationID: Snowflake, guildID: Snowflake, commandID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}` as const;
applicationGuildCommand(applicationId: Snowflake, guildId: Snowflake, commandId: Snowflake) {
return `/applications/${applicationId}/guilds/${guildId}/commands/${commandId}` as const;
},
/**
* Route for:
* - POST `/interactions/{interaction.id}/{interaction.token}/callback`
*/
interactionCallback(interactionID: Snowflake, interactionToken: string) {
return `/interactions/${interactionID}/${interactionToken}/callback` as const;
interactionCallback(interactionId: Snowflake, interactionToken: string) {
return `/interactions/${interactionId}/${interactionToken}/callback` as const;
},
/**
@@ -622,8 +622,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/member-verification`
* - PATCH `/guilds/{guild.id}/member-verification`
*/
guildMemberVerification(guildID: Snowflake) {
return `/guilds/${guildID}/member-verification` as const;
guildMemberVerification(guildId: Snowflake) {
return `/guilds/${guildId}/member-verification` as const;
},
/**
@@ -631,8 +631,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/voice-states/@me`
* - PATCH `/guilds/{guild.id}/voice-states/{user.id}`
*/
guildVoiceState(guildID: Snowflake, userID: Snowflake | '@me' = '@me') {
return `/guilds/${guildID}/voice-states/${userID}` as const;
guildVoiceState(guildId: Snowflake, userId: Snowflake | '@me' = '@me') {
return `/guilds/${guildId}/voice-states/${userId}` as const;
},
/**
@@ -640,8 +640,8 @@ export const Routes = {
* - GET `/applications/{application.id}/guilds/{guild.id}/commands/permissions`
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands/permissions`
*/
guildApplicationCommandsPermissions(applicationID: Snowflake, guildID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands/permissions` as const;
guildApplicationCommandsPermissions(applicationId: Snowflake, guildId: Snowflake) {
return `/applications/${applicationId}/guilds/${guildId}/commands/permissions` as const;
},
/**
@@ -649,8 +649,8 @@ export const Routes = {
* - GET `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`
*/
applicationCommandPermissions(applicationID: Snowflake, guildID: Snowflake, commandID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}/permissions` as const;
applicationCommandPermissions(applicationId: Snowflake, guildId: Snowflake, commandId: Snowflake) {
return `/applications/${applicationId}/guilds/${guildId}/commands/${commandId}/permissions` as const;
},
/**
@@ -658,8 +658,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/welcome-screen`
* - PATCH `/guilds/{guild.id}/welcome-screen`
*/
guildWelcomeScreen(guildID: Snowflake) {
return `/guilds/${guildID}/welcome-screen` as const;
guildWelcomeScreen(guildId: Snowflake) {
return `/guilds/${guildId}/welcome-screen` as const;
},
/**
@@ -676,16 +676,16 @@ export const Routes = {
* - PATCH `/stage-instances/{channel.id}`
* - DELETE `/stage-instances/{channel.id}`
*/
stageInstance(channelID: Snowflake) {
return `/stage-instances/${channelID}` as const;
stageInstance(channelId: Snowflake) {
return `/stage-instances/${channelId}` as const;
},
/**
* Route for:
* - GET `/stickers/{sticker.id}`
*/
sticker(stickerID: Snowflake) {
return `/stickers/${stickerID}` as const;
sticker(stickerId: Snowflake) {
return `/stickers/${stickerId}` as const;
},
/**
@@ -701,8 +701,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/stickers`
* - POST `/guilds/{guild.id}/stickers`
*/
guildStickers(guildID: Snowflake) {
return `/guilds/${guildID}/stickers` as const;
guildStickers(guildId: Snowflake) {
return `/guilds/${guildId}/stickers` as const;
},
/**
@@ -711,8 +711,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/stickers/{sticker.id}`
* - DELETE `/guilds/{guild.id}/stickers/{sticker.id}`
*/
guildSticker(guildID: Snowflake, stickerID: Snowflake) {
return `/guilds/${guildID}/stickers/${stickerID}` as const;
guildSticker(guildId: Snowflake, stickerId: Snowflake) {
return `/guilds/${guildId}/stickers/${stickerId}` as const;
},
};

View File

@@ -3,7 +3,16 @@ import type {
APIApplicationCommandPermission,
APIGuildApplicationCommandPermissions,
APIInteractionResponse,
APIInteractionResponseCallbackData,
} from '../../payloads/v8/index';
import type {
RESTDeleteAPIWebhookWithTokenMessageResult,
RESTGetAPIWebhookWithTokenMessageResult,
RESTPatchAPIWebhookWithTokenMessageFormDataBody,
RESTPatchAPIWebhookWithTokenMessageJSONBody,
RESTPatchAPIWebhookWithTokenMessageResult,
RESTPostAPIWebhookWithTokenWaitResult,
} from './webhook';
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-global-application-commands
@@ -111,6 +120,87 @@ export type RESTPostAPIInteractionCallbackFormDataBody =
file: unknown;
});
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-original-interaction-response
*/
export type RESTGetAPIInteractionOriginalResponseResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-original-interaction-response
*/
export type RESTDeleteAPIInteractionOriginalResponseResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
*/
export type RESTPostAPIInteractionFollowupJSONBody = APIInteractionResponseCallbackData;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
*/
export type RESTPostAPIInteractionFollowupFormDataBody =
| {
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| (RESTPostAPIInteractionFollowupJSONBody & {
/**
* The file contents
*/
file: unknown;
});
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
*/
export type RESTPostAPIInteractionFollowupResult = RESTPostAPIWebhookWithTokenWaitResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-followup-message
*/
export type RESTGetAPIInteractionFollowupResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-followup-message
*/
export type RESTDeleteAPIInteractionFollowupResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command-permissions
*/

View File

@@ -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[];
}
@@ -210,12 +220,25 @@ export type RESTPostAPIWebhookWithTokenGitHubResult = never;
*/
export type RESTPostAPIWebhookWithTokenGitHubWaitResult = APIMessage;
/**
* https://discord.com/developers/docs/resources/webhook#get-webhook-message
*/
export type RESTGetAPIWebhookWithTokenMessageResult = 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
@@ -238,11 +261,6 @@ export type RESTPatchAPIWebhookWithTokenMessageFormDataBody =
file: unknown;
});
/**
* https://discord.com/developers/docs/resources/webhook#get-webhook-message
*/
export type RESTGetAPIWebhookWithTokenMessageResult = APIMessage;
/**
* 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;
};

View File

@@ -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;
/**

View File

@@ -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;
};

View File

@@ -24,8 +24,8 @@ export const Routes = {
* Route for:
* - GET `/guilds/{guild.id}/audit-logs`
*/
guildAuditLog(guildID: Snowflake) {
return `/guilds/${guildID}/audit-logs` as const;
guildAuditLog(guildId: Snowflake) {
return `/guilds/${guildId}/audit-logs` as const;
},
/**
@@ -34,8 +34,8 @@ export const Routes = {
* - PATCH `/channels/{channel.id}`
* - DELETE `/channels/{channel.id}`
*/
channel(channelID: Snowflake) {
return `/channels/${channelID}` as const;
channel(channelId: Snowflake) {
return `/channels/${channelId}` as const;
},
/**
@@ -43,8 +43,8 @@ export const Routes = {
* - GET `/channels/{channel.id}/messages`
* - POST `/channels/{channel.id}/messages`
*/
channelMessages(channelID: Snowflake) {
return `/channels/${channelID}/messages` as const;
channelMessages(channelId: Snowflake) {
return `/channels/${channelId}/messages` as const;
},
/**
@@ -53,16 +53,16 @@ export const Routes = {
* - PATCH `/channels/{channel.id}/messages/{message.id}`
* - DELETE `/channels/{channel.id}/messages/{message.id}`
*/
channelMessage(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}` as const;
channelMessage(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/messages/${messageId}` as const;
},
/**
* Route for:
* - POST `/channels/{channel.id}/messages/{message.id}/crosspost`
*/
channelMessageCrosspost(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}/crosspost` as const;
channelMessageCrosspost(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/messages/${messageId}/crosspost` as const;
},
/**
@@ -72,8 +72,8 @@ export const Routes = {
*
* **Note**: You need to URL encode the emoji yourself
*/
channelMessageOwnReaction(channelID: Snowflake, messageID: Snowflake, emoji: string) {
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/@me` as const;
channelMessageOwnReaction(channelId: Snowflake, messageId: Snowflake, emoji: string) {
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}/@me` as const;
},
/**
@@ -82,8 +82,8 @@ export const Routes = {
*
* **Note**: You need to URL encode the emoji yourself
*/
channelMessageUserReaction(channelID: Snowflake, messageID: Snowflake, emoji: string, userID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}/${userID}` as const;
channelMessageUserReaction(channelId: Snowflake, messageId: Snowflake, emoji: string, userId: Snowflake) {
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}/${userId}` as const;
},
/**
@@ -93,24 +93,24 @@ export const Routes = {
*
* **Note**: You need to URL encode the emoji yourself
*/
channelMessageReaction(channelID: Snowflake, messageID: Snowflake, emoji: string) {
return `/channels/${channelID}/messages/${messageID}/reactions/${emoji}` as const;
channelMessageReaction(channelId: Snowflake, messageId: Snowflake, emoji: string) {
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}` as const;
},
/**
* Route for:
* - DELETE `/channels/{channel.id}/messages/{message.id}/reactions`
*/
channelMessageAllReactions(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/messages/${messageID}/reactions` as const;
channelMessageAllReactions(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/messages/${messageId}/reactions` as const;
},
/**
* Route for:
* - POST `/channels/{channel.id}/messages/bulk-delete`
*/
channelBulkDelete(channelID: Snowflake) {
return `/channels/${channelID}/messages/bulk-delete` as const;
channelBulkDelete(channelId: Snowflake) {
return `/channels/${channelId}/messages/bulk-delete` as const;
},
/**
@@ -118,8 +118,8 @@ export const Routes = {
* - PUT `/channels/{channel.id}/permissions/{overwrite.id}`
* - DELETE `/channels/{channel.id}/permissions/{overwrite.id}`
*/
channelPermission(channelID: Snowflake, overwriteID: Snowflake) {
return `/channels/${channelID}/permissions/${overwriteID}` as const;
channelPermission(channelId: Snowflake, overwriteId: Snowflake) {
return `/channels/${channelId}/permissions/${overwriteId}` as const;
},
/**
@@ -127,32 +127,32 @@ export const Routes = {
* - GET `/channels/{channel.id}/invites`
* - POST `/channels/{channel.id}/invites`
*/
channelInvites(channelID: Snowflake) {
return `/channels/${channelID}/invites` as const;
channelInvites(channelId: Snowflake) {
return `/channels/${channelId}/invites` as const;
},
/**
* Route for:
* - POST `/channels/{channel.id}/followers`
*/
channelFollowers(channelID: Snowflake) {
return `/channels/${channelID}/followers` as const;
channelFollowers(channelId: Snowflake) {
return `/channels/${channelId}/followers` as const;
},
/**
* Route for:
* - POST `/channels/{channel.id}/typing`
*/
channelTyping(channelID: Snowflake) {
return `/channels/${channelID}/typing` as const;
channelTyping(channelId: Snowflake) {
return `/channels/${channelId}/typing` as const;
},
/**
* Route for:
* - GET `/channels/{channel.id}/pins`
*/
channelPins(channelID: Snowflake) {
return `/channels/${channelID}/pins` as const;
channelPins(channelId: Snowflake) {
return `/channels/${channelId}/pins` as const;
},
/**
@@ -160,8 +160,8 @@ export const Routes = {
* - PUT `/channels/{channel.id}/pins/{message.id}`
* - DELETE `/channels/{channel.id}/pins/{message.id}`
*/
channelPin(channelID: Snowflake, messageID: Snowflake) {
return `/channels/${channelID}/pins/${messageID}` as const;
channelPin(channelId: Snowflake, messageId: Snowflake) {
return `/channels/${channelId}/pins/${messageId}` as const;
},
/**
@@ -169,8 +169,8 @@ export const Routes = {
* - PUT `/channels/{channel.id}/recipients/{user.id}`
* - DELETE `/channels/{channel.id}/recipients/{user.id}`
*/
channelRecipient(channelID: Snowflake, userID: Snowflake) {
return `/channels/${channelID}/recipients/${userID}` as const;
channelRecipient(channelId: Snowflake, userId: Snowflake) {
return `/channels/${channelId}/recipients/${userId}` as const;
},
/**
@@ -178,8 +178,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/emojis`
* - POST `/guilds/{guild.id}/emojis`
*/
guildEmojis(guildID: Snowflake) {
return `/guilds/${guildID}/emojis` as const;
guildEmojis(guildId: Snowflake) {
return `/guilds/${guildId}/emojis` as const;
},
/**
@@ -188,8 +188,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/emojis/{emoji.id}`
* - DELETE `/guilds/{guild.id}/emojis/{emoji.id}`
*/
guildEmoji(guildID: Snowflake, emojiID: Snowflake) {
return `/guilds/${guildID}/emojis/${emojiID}` as const;
guildEmoji(guildId: Snowflake, emojiId: Snowflake) {
return `/guilds/${guildId}/emojis/${emojiId}` as const;
},
/**
@@ -206,16 +206,16 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}`
* - DELETE `/guilds/{guild.id}`
*/
guild(guildID: Snowflake) {
return `/guilds/${guildID}` as const;
guild(guildId: Snowflake) {
return `/guilds/${guildId}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/preview`
*/
guildPreview(guildID: Snowflake) {
return `/guilds/${guildID}/preview` as const;
guildPreview(guildId: Snowflake) {
return `/guilds/${guildId}/preview` as const;
},
/**
@@ -224,8 +224,8 @@ export const Routes = {
* - POST `/guilds/{guild.id}/channels`
* - PATCH `/guilds/{guild.id}/channels`
*/
guildChannels(guildID: Snowflake) {
return `/guilds/${guildID}/channels` as const;
guildChannels(guildId: Snowflake) {
return `/guilds/${guildId}/channels` as const;
},
/**
@@ -235,32 +235,32 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/members/{user.id}`
* - DELETE `/guilds/{guild.id}/members/{user.id}`
*/
guildMember(guildID: Snowflake, userID: Snowflake) {
return `/guilds/${guildID}/members/${userID}` as const;
guildMember(guildId: Snowflake, userId: Snowflake) {
return `/guilds/${guildId}/members/${userId}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/members`
*/
guildMembers(guildID: Snowflake) {
return `/guilds/${guildID}/members` as const;
guildMembers(guildId: Snowflake) {
return `/guilds/${guildId}/members` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/members/search`
*/
guildMembersSearch(guildID: Snowflake) {
return `/guilds/${guildID}/members/search` as const;
guildMembersSearch(guildId: Snowflake) {
return `/guilds/${guildId}/members/search` as const;
},
/**
* Route for:
* - PATCH `/guilds/{guild.id}/members/@me/nick`
*/
guildCurrentMemberNickname(guildID: Snowflake) {
return `/guilds/${guildID}/members/@me/nick` as const;
guildCurrentMemberNickname(guildId: Snowflake) {
return `/guilds/${guildId}/members/@me/nick` as const;
},
/**
@@ -268,16 +268,16 @@ export const Routes = {
* - PUT `/guilds/{guild.id}/members/{user.id}/roles/{role.id}`
* - DELETE `/guilds/{guild.id}/members/{user.id}/roles/{role.id}`
*/
guildMemberRole(guildID: Snowflake, memberID: Snowflake, roleID: Snowflake) {
return `/guilds/${guildID}/members/${memberID}/roles/${roleID}` as const;
guildMemberRole(guildId: Snowflake, memberId: Snowflake, roleId: Snowflake) {
return `/guilds/${guildId}/members/${memberId}/roles/${roleId}` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/bans`
*/
guildBans(guildID: Snowflake) {
return `/guilds/${guildID}/bans` as const;
guildBans(guildId: Snowflake) {
return `/guilds/${guildId}/bans` as const;
},
/**
@@ -286,8 +286,8 @@ export const Routes = {
* - PUT `/guilds/{guild.id}/bans/{user.id}`
* - DELETE `/guilds/{guild.id}/bans/{user.id}`
*/
guildBan(guildID: Snowflake, userID: Snowflake) {
return `/guilds/${guildID}/bans/${userID}` as const;
guildBan(guildId: Snowflake, userId: Snowflake) {
return `/guilds/${guildId}/bans/${userId}` as const;
},
/**
@@ -296,8 +296,8 @@ export const Routes = {
* - POST `/guilds/{guild.id}/roles`
* - PATCH `/guilds/{guild.id}/roles`
*/
guildRoles(guildID: Snowflake) {
return `/guilds/${guildID}/roles` as const;
guildRoles(guildId: Snowflake) {
return `/guilds/${guildId}/roles` as const;
},
/**
@@ -305,8 +305,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/roles/{role.id}`
* - DELETE `/guilds/{guild.id}/roles/{role.id}`
*/
guildRole(guildID: Snowflake, roleID: Snowflake) {
return `/guilds/${guildID}/roles/${roleID}` as const;
guildRole(guildId: Snowflake, roleId: Snowflake) {
return `/guilds/${guildId}/roles/${roleId}` as const;
},
/**
@@ -314,40 +314,40 @@ export const Routes = {
* - GET `/guilds/{guild.id}/prune`
* - POST `/guilds/{guild.id}/prune`
*/
guildPrune(guildID: Snowflake) {
return `/guilds/${guildID}/prune` as const;
guildPrune(guildId: Snowflake) {
return `/guilds/${guildId}/prune` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/regions`
*/
guildVoiceRegions(guildID: Snowflake) {
return `/guilds/${guildID}/regions` as const;
guildVoiceRegions(guildId: Snowflake) {
return `/guilds/${guildId}/regions` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/invites`
*/
guildInvites(guildID: Snowflake) {
return `/guilds/${guildID}/invites` as const;
guildInvites(guildId: Snowflake) {
return `/guilds/${guildId}/invites` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/integrations`
*/
guildIntegrations(guildID: Snowflake) {
return `/guilds/${guildID}/integrations` as const;
guildIntegrations(guildId: Snowflake) {
return `/guilds/${guildId}/integrations` as const;
},
/**
* Route for:
* - DELETE `/guilds/{guild.id}/integrations/{integration.id}`
*/
guildIntegration(guildID: Snowflake, integrationID: Snowflake) {
return `/guilds/${guildID}/integrations/${integrationID}` as const;
guildIntegration(guildId: Snowflake, integrationId: Snowflake) {
return `/guilds/${guildId}/integrations/${integrationId}` as const;
},
/**
@@ -355,32 +355,32 @@ export const Routes = {
* - GET `/guilds/{guild.id}/widget`
* - PATCH `/guilds/{guild.id}/widget`
*/
guildWidgetSettings(guildID: Snowflake) {
return `/guilds/${guildID}/widget` as const;
guildWidgetSettings(guildId: Snowflake) {
return `/guilds/${guildId}/widget` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/widget.json`
*/
guildWidgetJSON(guildID: Snowflake) {
return `/guilds/${guildID}/widget.json` as const;
guildWidgetJSON(guildId: Snowflake) {
return `/guilds/${guildId}/widget.json` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/vanity-url`
*/
guildVanityUrl(guildID: Snowflake) {
return `/guilds/${guildID}/vanity-url` as const;
guildVanityUrl(guildId: Snowflake) {
return `/guilds/${guildId}/vanity-url` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/widget.png`
*/
guildWidgetImage(guildID: Snowflake) {
return `/guilds/${guildID}/widget.png` as const;
guildWidgetImage(guildId: Snowflake) {
return `/guilds/${guildId}/widget.png` as const;
},
/**
@@ -406,8 +406,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/templates`
* - POST `/guilds/{guild.id}/templates`
*/
guildTemplates(guildID: Snowflake) {
return `/guilds/${guildID}/templates` as const;
guildTemplates(guildId: Snowflake) {
return `/guilds/${guildId}/templates` as const;
},
/**
@@ -416,8 +416,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/templates/{template.code}`
* - DELETE `/guilds/{guild.id}/templates/{template.code}`
*/
guildTemplate(guildID: Snowflake, code: string) {
return `/guilds/${guildID}/templates/${code}` as const;
guildTemplate(guildId: Snowflake, code: string) {
return `/guilds/${guildId}/templates/${code}` as const;
},
/**
@@ -425,10 +425,10 @@ export const Routes = {
* - POST `/channels/{channel.id}/threads`
* - POST `/channels/{channel.id}/messages/{message.id}/threads`
*/
threads(parentID: Snowflake, messageID?: Snowflake) {
const parts = ['', 'channels', parentID];
threads(parentId: Snowflake, messageId?: Snowflake) {
const parts = ['', 'channels', parentId];
if (messageID) parts.push('messages', messageID);
if (messageId) parts.push('messages', messageId);
parts.push('threads');
@@ -441,8 +441,8 @@ export const Routes = {
* - GET `/channels/{channel.id}/threads/archived/public`
* - GET `/channels/{channel.id}/threads/archived/private`
*/
channelThreads(channelID: Snowflake, archived?: 'public' | 'private') {
const parts = ['', 'channels', channelID, 'threads'];
channelThreads(channelId: Snowflake, archived?: 'public' | 'private') {
const parts = ['', 'channels', channelId, 'threads'];
if (archived) parts.push('archived', archived);
else parts.push('active');
@@ -456,8 +456,8 @@ export const Routes = {
* Route for:
* - GET `/channels/{channel.id}/users/@me/threads/archived/prviate`
*/
channelJoinedArhivedThreads(channelID: Snowflake) {
return `/channels/${channelID}/users/@me/threads/archived/private` as const;
channelJoinedArhivedThreads(channelId: Snowflake) {
return `/channels/${channelId}/users/@me/threads/archived/private` as const;
},
/**
@@ -468,10 +468,10 @@ export const Routes = {
* - DELETE `/channels/{thread.id}/thread-members/@me`
* - DELETE `/channels/{thread.id}/thread-members/{user.id}`
*/
threadMembers(threadID: Snowflake, userID?: Snowflake | '@me') {
const parts = ['', 'channels', threadID, 'thread-members'];
threadMembers(threadId: Snowflake, userId?: Snowflake | '@me') {
const parts = ['', 'channels', threadId, 'thread-members'];
if (userID) parts.push(userID);
if (userId) parts.push(userId);
return parts.join('/') as
| `/channels/${Snowflake}/thread-members`
@@ -484,10 +484,10 @@ export const Routes = {
* - GET `/users/{user.id}`
* - PATCH `/users/@me`
*
* @param [userID='@me'] The user ID, defaulted to `@me`
* @param [userId='@me'] The user ID, defaulted to `@me`
*/
user(userID: Snowflake | '@me' = '@me') {
return `/users/${userID}` as const;
user(userId: Snowflake | '@me' = '@me') {
return `/users/${userId}` as const;
},
/**
@@ -502,8 +502,8 @@ export const Routes = {
* Route for:
* - DELETE `/users/@me/guilds/{guild.id}`
*/
userGuild(guildID: Snowflake) {
return `/users/@me/guilds/${guildID}` as const;
userGuild(guildId: Snowflake) {
return `/users/@me/guilds/${guildId}` as const;
},
/**
@@ -535,16 +535,16 @@ export const Routes = {
* - GET `/channels/{channel.id}/webhooks`
* - POST `/channels/{channel.id}/webhooks`
*/
channelWebhooks(channelID: Snowflake) {
return `/channels/${channelID}/webhooks` as const;
channelWebhooks(channelId: Snowflake) {
return `/channels/${channelId}/webhooks` as const;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/webhooks`
*/
guildWebhooks(guildID: Snowflake) {
return `/guilds/${guildID}/webhooks` as const;
guildWebhooks(guildId: Snowflake) {
return `/guilds/${guildId}/webhooks` as const;
},
/**
@@ -559,8 +559,8 @@ export const Routes = {
*
* - POST `/webhooks/{application.id}/{interaction.token}`
*/
webhook(webhookID: Snowflake, webhookToken?: string) {
const parts = ['', 'webhooks', webhookID];
webhook(webhookId: Snowflake, webhookToken?: string) {
const parts = ['', 'webhooks', webhookId];
if (webhookToken) parts.push(webhookToken);
@@ -580,10 +580,10 @@ export const Routes = {
* - PATCH `/webhooks/{application.id}/{interaction.token}/messages/{message.id}`
* - DELETE `/webhooks/{application.id}/{interaction.token}/messages/{message.id}`
*
* @param [messageID='@original'] The message ID to change, defaulted to `@original`
* @param [messageId='@original'] The message ID to change, defaulted to `@original`
*/
webhookMessage(webhookID: Snowflake, webhookToken: string, messageID: Snowflake | '@original' = '@original') {
return `/webhooks/${webhookID}/${webhookToken}/messages/${messageID}` as const;
webhookMessage(webhookId: Snowflake, webhookToken: string, messageId: Snowflake | '@original' = '@original') {
return `/webhooks/${webhookId}/${webhookToken}/messages/${messageId}` as const;
},
/**
@@ -591,8 +591,8 @@ export const Routes = {
* - POST `/webhooks/{webhook.id}/{webhook.token}/github`
* - POST `/webhooks/{webhook.id}/{webhook.token}/slack`
*/
webhookPlatform(webhookID: Snowflake, webhookToken: string, platform: 'github' | 'slack') {
return `/webhooks/${webhookID}/${webhookToken}/${platform}` as const;
webhookPlatform(webhookId: Snowflake, webhookToken: string, platform: 'github' | 'slack') {
return `/webhooks/${webhookId}/${webhookToken}/${platform}` as const;
},
/**
@@ -633,8 +633,8 @@ export const Routes = {
* - PUT `/applications/{application.id}/commands`
* - POST `/applications/{application.id}/commands`
*/
applicationCommands(applicationID: Snowflake) {
return `/applications/${applicationID}/commands` as const;
applicationCommands(applicationId: Snowflake) {
return `/applications/${applicationId}/commands` as const;
},
/**
@@ -643,8 +643,8 @@ export const Routes = {
* - PATCH `/applications/{application.id}/commands/{command.id}`
* - DELETE `/applications/{application.id}/commands/{command.id}`
*/
applicationCommand(applicationID: Snowflake, commandID: Snowflake) {
return `/applications/${applicationID}/commands/${commandID}` as const;
applicationCommand(applicationId: Snowflake, commandId: Snowflake) {
return `/applications/${applicationId}/commands/${commandId}` as const;
},
/**
@@ -653,8 +653,8 @@ export const Routes = {
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands`
* - POST `/applications/{application.id}/guilds/{guild.id}/commands`
*/
applicationGuildCommands(applicationID: Snowflake, guildID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands` as const;
applicationGuildCommands(applicationId: Snowflake, guildId: Snowflake) {
return `/applications/${applicationId}/guilds/${guildId}/commands` as const;
},
/**
@@ -663,16 +663,16 @@ export const Routes = {
* - PATCH `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}`
* - DELETE `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}`
*/
applicationGuildCommand(applicationID: Snowflake, guildID: Snowflake, commandID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}` as const;
applicationGuildCommand(applicationId: Snowflake, guildId: Snowflake, commandId: Snowflake) {
return `/applications/${applicationId}/guilds/${guildId}/commands/${commandId}` as const;
},
/**
* Route for:
* - POST `/interactions/{interaction.id}/{interaction.token}/callback`
*/
interactionCallback(interactionID: Snowflake, interactionToken: string) {
return `/interactions/${interactionID}/${interactionToken}/callback` as const;
interactionCallback(interactionId: Snowflake, interactionToken: string) {
return `/interactions/${interactionId}/${interactionToken}/callback` as const;
},
/**
@@ -680,8 +680,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/member-verification`
* - PATCH `/guilds/{guild.id}/member-verification`
*/
guildMemberVerification(guildID: Snowflake) {
return `/guilds/${guildID}/member-verification` as const;
guildMemberVerification(guildId: Snowflake) {
return `/guilds/${guildId}/member-verification` as const;
},
/**
@@ -689,8 +689,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/voice-states/@me`
* - PATCH `/guilds/{guild.id}/voice-states/{user.id}`
*/
guildVoiceState(guildID: Snowflake, userID: Snowflake | '@me' = '@me') {
return `/guilds/${guildID}/voice-states/${userID}` as const;
guildVoiceState(guildId: Snowflake, userId: Snowflake | '@me' = '@me') {
return `/guilds/${guildId}/voice-states/${userId}` as const;
},
/**
@@ -698,8 +698,8 @@ export const Routes = {
* - GET `/applications/{application.id}/guilds/{guild.id}/commands/permissions`
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands/permissions`
*/
guildApplicationCommandsPermissions(applicationID: Snowflake, guildID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands/permissions` as const;
guildApplicationCommandsPermissions(applicationId: Snowflake, guildId: Snowflake) {
return `/applications/${applicationId}/guilds/${guildId}/commands/permissions` as const;
},
/**
@@ -707,8 +707,8 @@ export const Routes = {
* - GET `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`
*/
applicationCommandPermissions(applicationID: Snowflake, guildID: Snowflake, commandID: Snowflake) {
return `/applications/${applicationID}/guilds/${guildID}/commands/${commandID}/permissions` as const;
applicationCommandPermissions(applicationId: Snowflake, guildId: Snowflake, commandId: Snowflake) {
return `/applications/${applicationId}/guilds/${guildId}/commands/${commandId}/permissions` as const;
},
/**
@@ -716,8 +716,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/welcome-screen`
* - PATCH `/guilds/{guild.id}/welcome-screen`
*/
guildWelcomeScreen(guildID: Snowflake) {
return `/guilds/${guildID}/welcome-screen` as const;
guildWelcomeScreen(guildId: Snowflake) {
return `/guilds/${guildId}/welcome-screen` as const;
},
/**
@@ -734,16 +734,16 @@ export const Routes = {
* - PATCH `/stage-instances/{channel.id}`
* - DELETE `/stage-instances/{channel.id}`
*/
stageInstance(channelID: Snowflake) {
return `/stage-instances/${channelID}` as const;
stageInstance(channelId: Snowflake) {
return `/stage-instances/${channelId}` as const;
},
/**
* Route for:
* - GET `/stickers/{sticker.id}`
*/
sticker(stickerID: Snowflake) {
return `/stickers/${stickerID}` as const;
sticker(stickerId: Snowflake) {
return `/stickers/${stickerId}` as const;
},
/**
@@ -759,8 +759,8 @@ export const Routes = {
* - GET `/guilds/{guild.id}/stickers`
* - POST `/guilds/{guild.id}/stickers`
*/
guildStickers(guildID: Snowflake) {
return `/guilds/${guildID}/stickers` as const;
guildStickers(guildId: Snowflake) {
return `/guilds/${guildId}/stickers` as const;
},
/**
@@ -769,8 +769,8 @@ export const Routes = {
* - PATCH `/guilds/{guild.id}/stickers/{sticker.id}`
* - DELETE `/guilds/{guild.id}/stickers/{sticker.id}`
*/
guildSticker(guildID: Snowflake, stickerID: Snowflake) {
return `/guilds/${guildID}/stickers/${stickerID}` as const;
guildSticker(guildId: Snowflake, stickerId: Snowflake) {
return `/guilds/${guildId}/stickers/${stickerId}` as const;
},
};

View File

@@ -3,7 +3,16 @@ import type {
APIApplicationCommandPermission,
APIGuildApplicationCommandPermissions,
APIInteractionResponse,
APIInteractionResponseCallbackData,
} from '../../payloads/v9/index';
import type {
RESTDeleteAPIWebhookWithTokenMessageResult,
RESTGetAPIWebhookWithTokenMessageResult,
RESTPatchAPIWebhookWithTokenMessageFormDataBody,
RESTPatchAPIWebhookWithTokenMessageJSONBody,
RESTPatchAPIWebhookWithTokenMessageResult,
RESTPostAPIWebhookWithTokenWaitResult,
} from './webhook';
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-global-application-commands
@@ -111,6 +120,87 @@ export type RESTPostAPIInteractionCallbackFormDataBody =
file: unknown;
});
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-original-interaction-response
*/
export type RESTGetAPIInteractionOriginalResponseResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
*/
export type RESTPatchAPIInteractionOriginalResponseResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-original-interaction-response
*/
export type RESTDeleteAPIInteractionOriginalResponseResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
*/
export type RESTPostAPIInteractionFollowupJSONBody = APIInteractionResponseCallbackData;
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
*/
export type RESTPostAPIInteractionFollowupFormDataBody =
| {
/**
* JSON stringified message body
*/
payload_json?: string;
/**
* The file contents
*/
file: unknown;
}
| (RESTPostAPIInteractionFollowupJSONBody & {
/**
* The file contents
*/
file: unknown;
});
/**
* https://discord.com/developers/docs/interactions/slash-commands#create-followup-message
*/
export type RESTPostAPIInteractionFollowupResult = RESTPostAPIWebhookWithTokenWaitResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-followup-message
*/
export type RESTGetAPIInteractionFollowupResult = RESTGetAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupJSONBody = RESTPatchAPIWebhookWithTokenMessageJSONBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupFormDataBody = RESTPatchAPIWebhookWithTokenMessageFormDataBody;
/**
* https://discord.com/developers/docs/interactions/slash-commands#edit-followup-message
*/
export type RESTPatchAPIInteractionFollowupResult = RESTPatchAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#delete-followup-message
*/
export type RESTDeleteAPIInteractionFollowupResult = RESTDeleteAPIWebhookWithTokenMessageResult;
/**
* https://discord.com/developers/docs/interactions/slash-commands#get-guild-application-command-permissions
*/

View File

@@ -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;
}
/**
@@ -214,12 +224,25 @@ export type RESTPostAPIWebhookWithTokenGitHubResult = never;
*/
export type RESTPostAPIWebhookWithTokenGitHubWaitResult = APIMessage;
/**
* https://discord.com/developers/docs/resources/webhook#get-webhook-message
*/
export type RESTGetAPIWebhookWithTokenMessageResult = 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
@@ -242,11 +265,6 @@ export type RESTPatchAPIWebhookWithTokenMessageFormDataBody =
file: unknown;
});
/**
* https://discord.com/developers/docs/resources/webhook#get-webhook-message
*/
export type RESTGetAPIWebhookWithTokenMessageResult = APIMessage;
/**
* 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;
};

View File

@@ -9,7 +9,7 @@ export const enum RPCErrorCodes {
InvalidEvent,
InvalidChannel,
InvalidPermissions,
InvalidClientID,
InvalidClientId,
InvalidOrigin,
InvalidToken,
InvalidUser,
@@ -24,7 +24,7 @@ export const enum RPCErrorCodes {
* https://discord.com/developers/docs/topics/opcodes-and-status-codes#rpc-rpc-close-event-codes
*/
export const enum RPCCloseEventCodes {
InvalidClientID = 4000,
InvalidClientId = 4000,
InvalidOrigin,
RateLimited,
TokenRevoked,

Some files were not shown because too many files have changed in this diff Show More