discord-api-types
Version:
Discord API typings that are kept up to date for use in bot library creation.
1,270 lines • 40.8 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.OAuth2Routes = exports.RouteBases = exports.CDNRoutes = exports.ImageFormat = exports.StickerPackApplicationId = exports.Routes = exports.APIVersion = void 0;
const internals_1 = require("../../utils/internals");
__exportStar(require("../common"), exports);
__exportStar(require("./channel"), exports);
__exportStar(require("./monetization"), exports);
exports.APIVersion = '9';
exports.Routes = {
/**
* Route for:
* - GET `/applications/{application.id}/role-connections/metadata`
* - PUT `/applications/{application.id}/role-connections/metadata`
*/
applicationRoleConnectionMetadata(applicationId) {
return `/applications/${applicationId}/role-connections/metadata`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/auto-moderation/rules`
* - POST `/guilds/{guild.id}/auto-moderation/rules`
*/
guildAutoModerationRules(guildId) {
return `/guilds/${guildId}/auto-moderation/rules`;
},
/**
* Routes for:
* - GET `/guilds/{guild.id}/auto-moderation/rules/{rule.id}`
* - PATCH `/guilds/{guild.id}/auto-moderation/rules/{rule.id}`
* - DELETE `/guilds/{guild.id}/auto-moderation/rules/{rule.id}`
*/
guildAutoModerationRule(guildId, ruleId) {
return `/guilds/${guildId}/auto-moderation/rules/${ruleId}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/audit-logs`
*/
guildAuditLog(guildId) {
return `/guilds/${guildId}/audit-logs`;
},
/**
* Route for:
* - GET `/channels/{channel.id}`
* - PATCH `/channels/{channel.id}`
* - DELETE `/channels/{channel.id}`
*/
channel(channelId) {
return `/channels/${channelId}`;
},
/**
* Route for:
* - GET `/channels/{channel.id}/messages`
* - POST `/channels/{channel.id}/messages`
*/
channelMessages(channelId) {
return `/channels/${channelId}/messages`;
},
/**
* Route for:
* - GET `/channels/{channel.id}/messages/{message.id}`
* - PATCH `/channels/{channel.id}/messages/{message.id}`
* - DELETE `/channels/{channel.id}/messages/{message.id}`
*/
channelMessage(channelId, messageId) {
return `/channels/${channelId}/messages/${messageId}`;
},
/**
* Route for:
* - POST `/channels/{channel.id}/messages/{message.id}/crosspost`
*/
channelMessageCrosspost(channelId, messageId) {
return `/channels/${channelId}/messages/${messageId}/crosspost`;
},
/**
* Route for:
* - PUT `/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/@me`
* - DELETE `/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/@me`
*
* **Note**: You need to URL encode the emoji yourself
*/
channelMessageOwnReaction(channelId, messageId, emoji) {
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}/@me`;
},
/**
* Route for:
* - DELETE `/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/{user.id}`
*
* **Note**: You need to URL encode the emoji yourself
*/
channelMessageUserReaction(channelId, messageId, emoji, userId) {
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}/${userId}`;
},
/**
* Route for:
* - GET `/channels/{channel.id}/messages/{message.id}/reactions/{emoji}`
* - DELETE `/channels/{channel.id}/messages/{message.id}/reactions/{emoji}`
*
* **Note**: You need to URL encode the emoji yourself
*/
channelMessageReaction(channelId, messageId, emoji) {
return `/channels/${channelId}/messages/${messageId}/reactions/${emoji}`;
},
/**
* Route for:
* - DELETE `/channels/{channel.id}/messages/{message.id}/reactions`
*/
channelMessageAllReactions(channelId, messageId) {
return `/channels/${channelId}/messages/${messageId}/reactions`;
},
/**
* Route for:
* - POST `/channels/{channel.id}/messages/bulk-delete`
*/
channelBulkDelete(channelId) {
return `/channels/${channelId}/messages/bulk-delete`;
},
/**
* Route for:
* - PUT `/channels/{channel.id}/permissions/{overwrite.id}`
* - DELETE `/channels/{channel.id}/permissions/{overwrite.id}`
*/
channelPermission(channelId, overwriteId) {
return `/channels/${channelId}/permissions/${overwriteId}`;
},
/**
* Route for:
* - GET `/channels/{channel.id}/invites`
* - POST `/channels/{channel.id}/invites`
*/
channelInvites(channelId) {
return `/channels/${channelId}/invites`;
},
/**
* Route for:
* - POST `/channels/{channel.id}/followers`
*/
channelFollowers(channelId) {
return `/channels/${channelId}/followers`;
},
/**
* Route for:
* - POST `/channels/{channel.id}/typing`
*/
channelTyping(channelId) {
return `/channels/${channelId}/typing`;
},
/**
* Route for:
* - GET `/channels/{channel.id}/messages/pins`
*/
channelMessagesPins(channelId) {
return `/channels/${channelId}/messages/pins`;
},
/**
* Route for:
* - PUT `/channels/{channel.id}/messages/pins/{message.id}`
* - DELETE `/channels/{channel.id}/messages/pins/{message.id}`
*/
channelMessagesPin(channelId, messageId) {
return `/channels/${channelId}/messages/pins/${messageId}`;
},
/**
* Route for:
* - GET `/channels/{channel.id}/pins`
*
* @deprecated Use {@link Routes.channelMessagesPins} instead.
*/
channelPins(channelId) {
return `/channels/${channelId}/pins`;
},
/**
* Route for:
* - PUT `/channels/{channel.id}/pins/{message.id}`
* - DELETE `/channels/{channel.id}/pins/{message.id}`
*
* @deprecated Use {@link Routes.channelMessagesPin} instead.
*/
channelPin(channelId, messageId) {
return `/channels/${channelId}/pins/${messageId}`;
},
/**
* Route for:
* - PUT `/channels/{channel.id}/recipients/{user.id}`
* - DELETE `/channels/{channel.id}/recipients/{user.id}`
*/
channelRecipient(channelId, userId) {
return `/channels/${channelId}/recipients/${userId}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/emojis`
* - POST `/guilds/{guild.id}/emojis`
*/
guildEmojis(guildId) {
return `/guilds/${guildId}/emojis`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/emojis/{emoji.id}`
* - PATCH `/guilds/{guild.id}/emojis/{emoji.id}`
* - DELETE `/guilds/{guild.id}/emojis/{emoji.id}`
*/
guildEmoji(guildId, emojiId) {
return `/guilds/${guildId}/emojis/${emojiId}`;
},
/**
* Route for:
* - POST `/guilds`
*
* @deprecated {@link https://discord.com/developers/docs/change-log#guild-create-deprecation}
*/
guilds() {
return '/guilds';
},
/**
* Route for:
* - GET `/guilds/{guild.id}`
* - PATCH `/guilds/{guild.id}`
* - DELETE `/guilds/{guild.id}` (**deprecated**)
*/
guild(guildId) {
return `/guilds/${guildId}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/preview`
*/
guildPreview(guildId) {
return `/guilds/${guildId}/preview`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/channels`
* - POST `/guilds/{guild.id}/channels`
* - PATCH `/guilds/{guild.id}/channels`
*/
guildChannels(guildId) {
return `/guilds/${guildId}/channels`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/members/{user.id}`
* - PUT `/guilds/{guild.id}/members/{user.id}`
* - PATCH `/guilds/{guild.id}/members/@me`
* - PATCH `/guilds/{guild.id}/members/{user.id}`
* - DELETE `/guilds/{guild.id}/members/{user.id}`
*/
guildMember(guildId, userId = '@me') {
return `/guilds/${guildId}/members/${userId}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/members`
*/
guildMembers(guildId) {
return `/guilds/${guildId}/members`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/members/search`
*/
guildMembersSearch(guildId) {
return `/guilds/${guildId}/members/search`;
},
/**
* Route for:
* - PATCH `/guilds/{guild.id}/members/@me/nick`
*
* @deprecated Use {@link Routes.guildMember} instead.
*/
guildCurrentMemberNickname(guildId) {
return `/guilds/${guildId}/members/@me/nick`;
},
/**
* Route for:
* - PUT `/guilds/{guild.id}/members/{user.id}/roles/{role.id}`
* - DELETE `/guilds/{guild.id}/members/{user.id}/roles/{role.id}`
*/
guildMemberRole(guildId, memberId, roleId) {
return `/guilds/${guildId}/members/${memberId}/roles/${roleId}`;
},
/**
* Route for:
* - POST `/guilds/{guild.id}/mfa`
*
* @deprecated
*/
guildMFA(guildId) {
return `/guilds/${guildId}/mfa`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/bans`
*/
guildBans(guildId) {
return `/guilds/${guildId}/bans`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/bans/{user.id}`
* - PUT `/guilds/{guild.id}/bans/{user.id}`
* - DELETE `/guilds/{guild.id}/bans/{user.id}`
*/
guildBan(guildId, userId) {
return `/guilds/${guildId}/bans/${userId}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/roles`
* - POST `/guilds/{guild.id}/roles`
* - PATCH `/guilds/{guild.id}/roles`
*/
guildRoles(guildId) {
return `/guilds/${guildId}/roles`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/roles/{role.id}`
* - PATCH `/guilds/{guild.id}/roles/{role.id}`
* - DELETE `/guilds/{guild.id}/roles/{role.id}`
*/
guildRole(guildId, roleId) {
return `/guilds/${guildId}/roles/${roleId}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/prune`
* - POST `/guilds/{guild.id}/prune`
*/
guildPrune(guildId) {
return `/guilds/${guildId}/prune`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/regions`
*/
guildVoiceRegions(guildId) {
return `/guilds/${guildId}/regions`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/invites`
*/
guildInvites(guildId) {
return `/guilds/${guildId}/invites`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/integrations`
*/
guildIntegrations(guildId) {
return `/guilds/${guildId}/integrations`;
},
/**
* Route for:
* - DELETE `/guilds/{guild.id}/integrations/{integration.id}`
*/
guildIntegration(guildId, integrationId) {
return `/guilds/${guildId}/integrations/${integrationId}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/widget`
* - PATCH `/guilds/{guild.id}/widget`
*/
guildWidgetSettings(guildId) {
return `/guilds/${guildId}/widget`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/widget.json`
*/
guildWidgetJSON(guildId) {
return `/guilds/${guildId}/widget.json`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/vanity-url`
*/
guildVanityUrl(guildId) {
return `/guilds/${guildId}/vanity-url`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/widget.png`
*/
guildWidgetImage(guildId) {
return `/guilds/${guildId}/widget.png`;
},
/**
* Route for:
* - GET `/invites/{invite.code}`
* - DELETE `/invites/{invite.code}`
*/
invite(code) {
return `/invites/${code}`;
},
/**
* Route for:
* - GET `/guilds/templates/{template.code}`
* - POST `/guilds/templates/{template.code}` (**deprecated**)
*/
template(code) {
return `/guilds/templates/${code}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/templates`
* - POST `/guilds/{guild.id}/templates`
*/
guildTemplates(guildId) {
return `/guilds/${guildId}/templates`;
},
/**
* Route for:
* - PUT `/guilds/{guild.id}/templates/{template.code}`
* - PATCH `/guilds/{guild.id}/templates/{template.code}`
* - DELETE `/guilds/{guild.id}/templates/{template.code}`
*/
guildTemplate(guildId, code) {
return `/guilds/${guildId}/templates/${code}`;
},
/**
* Route for:
* - GET `/channels/{channel.id}/polls/{message.id}/answers/{answer_id}`
*/
pollAnswerVoters(channelId, messageId, answerId) {
return `/channels/${channelId}/polls/${messageId}/answers/${answerId}`;
},
/**
* Route for:
* - POST `/channels/{channel.id}/polls/{message.id}/expire`
*/
expirePoll(channelId, messageId) {
return `/channels/${channelId}/polls/${messageId}/expire`;
},
/**
* Route for:
* - POST `/channels/{channel.id}/threads`
* - POST `/channels/{channel.id}/messages/{message.id}/threads`
*/
threads(parentId, messageId) {
const parts = ['', 'channels', parentId];
if (messageId)
parts.push('messages', messageId);
parts.push('threads');
return parts.join('/');
},
/**
* Route for:
* - GET `/guilds/{guild.id}/threads/active`
*/
guildActiveThreads(guildId) {
return `/guilds/${guildId}/threads/active`;
},
/**
* Route for:
* - GET `/channels/{channel.id}/threads/active`
* (deprecated, removed in API v10, use {@link https://discord.com/developers/docs/resources/guild#list-active-threads | List Active Guild Threads} instead.)
* - GET `/channels/{channel.id}/threads/archived/public`
* - GET `/channels/{channel.id}/threads/archived/private`
*/
channelThreads(channelId, archived) {
const parts = ['', 'channels', channelId, 'threads'];
if (archived)
parts.push('archived', archived);
else
parts.push('active');
return parts.join('/');
},
/**
* Route for:
* - GET `/channels/{channel.id}/users/@me/threads/archived/private`
*/
channelJoinedArchivedThreads(channelId) {
return `/channels/${channelId}/users/@me/threads/archived/private`;
},
/**
* Route for:
* - GET `/channels/{thread.id}/thread-members`
* - GET `/channels/{thread.id}/thread-members/{user.id}`
* - PUT `/channels/{thread.id}/thread-members/@me`
* - PUT `/channels/{thread.id}/thread-members/{user.id}`
* - DELETE `/channels/{thread.id}/thread-members/@me`
* - DELETE `/channels/{thread.id}/thread-members/{user.id}`
*/
threadMembers(threadId, userId) {
const parts = ['', 'channels', threadId, 'thread-members'];
if (userId)
parts.push(userId);
return parts.join('/');
},
/**
* Route for:
* - GET `/users/@me`
* - GET `/users/{user.id}`
* - PATCH `/users/@me`
*
* @param userId - The user ID, defaulted to `@me`
*/
user(userId = '@me') {
return `/users/${userId}`;
},
/**
* Route for:
* - GET `/users/@me/applications/{application.id}/role-connection`
* - PUT `/users/@me/applications/{application.id}/role-connection`
*/
userApplicationRoleConnection(applicationId) {
return `/users/@me/applications/${applicationId}/role-connection`;
},
/**
* Route for:
* - GET `/users/@me/guilds`
*/
userGuilds() {
return `/users/@me/guilds`;
},
/**
* Route for:
* - GET `/users/@me/guilds/{guild.id}/member`
*/
userGuildMember(guildId) {
return `/users/@me/guilds/${guildId}/member`;
},
/**
* Route for:
* - DELETE `/users/@me/guilds/{guild.id}`
*/
userGuild(guildId) {
return `/users/@me/guilds/${guildId}`;
},
/**
* Route for:
* - POST `/users/@me/channels`
*/
userChannels() {
return `/users/@me/channels`;
},
/**
* Route for:
* - GET `/users/@me/connections`
*/
userConnections() {
return `/users/@me/connections`;
},
/**
* Route for:
* - GET `/voice/regions`
*/
voiceRegions() {
return `/voice/regions`;
},
/**
* Route for:
* - GET `/channels/{channel.id}/webhooks`
* - POST `/channels/{channel.id}/webhooks`
*/
channelWebhooks(channelId) {
return `/channels/${channelId}/webhooks`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/webhooks`
*/
guildWebhooks(guildId) {
return `/guilds/${guildId}/webhooks`;
},
/**
* Route for:
* - GET `/webhooks/{webhook.id}`
* - GET `/webhooks/{webhook.id}/{webhook.token}`
* - PATCH `/webhooks/{webhook.id}`
* - PATCH `/webhooks/{webhook.id}/{webhook.token}`
* - DELETE `/webhooks/{webhook.id}`
* - DELETE `/webhooks/{webhook.id}/{webhook.token}`
* - POST `/webhooks/{webhook.id}/{webhook.token}`
*
* - POST `/webhooks/{application.id}/{interaction.token}`
*/
webhook(webhookId, webhookToken) {
const parts = ['', 'webhooks', webhookId];
if (webhookToken)
parts.push(webhookToken);
return parts.join('/');
},
/**
* Route for:
* - GET `/webhooks/{webhook.id}/{webhook.token}/messages/@original`
* - GET `/webhooks/{webhook.id}/{webhook.token}/messages/{message.id}`
* - PATCH `/webhooks/{webhook.id}/{webhook.token}/messages/@original`
* - PATCH `/webhooks/{webhook.id}/{webhook.token}/messages/{message.id}`
* - DELETE `/webhooks/{webhook.id}/{webhook.token}/messages/@original`
* - DELETE `/webhooks/{webhook.id}/{webhook.token}/messages/{message.id}`
*
* - PATCH `/webhooks/{application.id}/{interaction.token}/messages/@original`
* - PATCH `/webhooks/{application.id}/{interaction.token}/messages/{message.id}`
* - DELETE `/webhooks/{application.id}/{interaction.token}/messages/{message.id}`
*/
webhookMessage(webhookId, webhookToken, messageId = '@original') {
return `/webhooks/${webhookId}/${webhookToken}/messages/${messageId}`;
},
/**
* Route for:
* - POST `/webhooks/{webhook.id}/{webhook.token}/github`
* - POST `/webhooks/{webhook.id}/{webhook.token}/slack`
*/
webhookPlatform(webhookId, webhookToken, platform) {
return `/webhooks/${webhookId}/${webhookToken}/${platform}`;
},
/**
* Route for:
* - GET `/gateway`
*/
gateway() {
return `/gateway`;
},
/**
* Route for:
* - GET `/gateway/bot`
*/
gatewayBot() {
return `/gateway/bot`;
},
/**
* Route for:
* - GET `/oauth2/applications/@me`
*/
oauth2CurrentApplication() {
return `/oauth2/applications/@me`;
},
/**
* Route for:
* - GET `/oauth2/@me`
*/
oauth2CurrentAuthorization() {
return `/oauth2/@me`;
},
/**
* Route for:
* - GET `/oauth2/authorize`
*/
oauth2Authorization() {
return `/oauth2/authorize`;
},
/**
* Route for:
* - POST `/oauth2/token`
*/
oauth2TokenExchange() {
return `/oauth2/token`;
},
/**
* Route for:
* - POST `/oauth2/token/revoke`
*/
oauth2TokenRevocation() {
return `/oauth2/token/revoke`;
},
/**
* Route for:
* - GET `/applications/{application.id}/commands`
* - PUT `/applications/{application.id}/commands`
* - POST `/applications/{application.id}/commands`
*/
applicationCommands(applicationId) {
return `/applications/${applicationId}/commands`;
},
/**
* Route for:
* - GET `/applications/{application.id}/commands/{command.id}`
* - PATCH `/applications/{application.id}/commands/{command.id}`
* - DELETE `/applications/{application.id}/commands/{command.id}`
*/
applicationCommand(applicationId, commandId) {
return `/applications/${applicationId}/commands/${commandId}`;
},
/**
* Route for:
* - GET `/applications/{application.id}/guilds/{guild.id}/commands`
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands`
* - POST `/applications/{application.id}/guilds/{guild.id}/commands`
*/
applicationGuildCommands(applicationId, guildId) {
return `/applications/${applicationId}/guilds/${guildId}/commands`;
},
/**
* Route for:
* - GET `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}`
* - PATCH `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}`
* - DELETE `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}`
*/
applicationGuildCommand(applicationId, guildId, commandId) {
return `/applications/${applicationId}/guilds/${guildId}/commands/${commandId}`;
},
/**
* Route for:
* - POST `/interactions/{interaction.id}/{interaction.token}/callback`
*/
interactionCallback(interactionId, interactionToken) {
return `/interactions/${interactionId}/${interactionToken}/callback`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/member-verification`
* - PATCH `/guilds/{guild.id}/member-verification`
*/
guildMemberVerification(guildId) {
return `/guilds/${guildId}/member-verification`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/voice-states/@me`
* - GET `/guilds/{guild.id}/voice-states/{user.id}`
* - PATCH `/guilds/{guild.id}/voice-states/@me`
* - PATCH `/guilds/{guild.id}/voice-states/{user.id}`
*/
guildVoiceState(guildId, userId = '@me') {
return `/guilds/${guildId}/voice-states/${userId}`;
},
/**
* Route for:
* - GET `/applications/{application.id}/guilds/{guild.id}/commands/permissions`
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands/permissions`
*/
guildApplicationCommandsPermissions(applicationId, guildId) {
return `/applications/${applicationId}/guilds/${guildId}/commands/permissions`;
},
/**
* Route for:
* - GET `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`
* - PUT `/applications/{application.id}/guilds/{guild.id}/commands/{command.id}/permissions`
*/
applicationCommandPermissions(applicationId, guildId, commandId) {
return `/applications/${applicationId}/guilds/${guildId}/commands/${commandId}/permissions`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/welcome-screen`
* - PATCH `/guilds/{guild.id}/welcome-screen`
*/
guildWelcomeScreen(guildId) {
return `/guilds/${guildId}/welcome-screen`;
},
/**
* Route for:
* - POST `/stage-instances`
*/
stageInstances() {
return `/stage-instances`;
},
/**
* Route for:
* - GET `/stage-instances/{channel.id}`
* - PATCH `/stage-instances/{channel.id}`
* - DELETE `/stage-instances/{channel.id}`
*/
stageInstance(channelId) {
return `/stage-instances/${channelId}`;
},
/**
* Route for:
* - GET `/stickers/{sticker.id}`
*/
sticker(stickerId) {
return `/stickers/${stickerId}`;
},
/**
* Route for:
* - GET `/sticker-packs`
*/
stickerPacks() {
return '/sticker-packs';
},
/**
* Route for:
* - GET `/sticker-packs/{pack.id}`
*/
stickerPack(packId) {
return `/sticker-packs/${packId}`;
},
/**
* Route for:
* - GET `/sticker-packs`
*
* @deprecated Use {@link Routes.stickerPacks} instead.
*/
nitroStickerPacks() {
return '/sticker-packs';
},
/**
* Route for:
* - GET `/guilds/{guild.id}/stickers`
* - POST `/guilds/{guild.id}/stickers`
*/
guildStickers(guildId) {
return `/guilds/${guildId}/stickers`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/stickers/{sticker.id}`
* - PATCH `/guilds/{guild.id}/stickers/{sticker.id}`
* - DELETE `/guilds/{guild.id}/stickers/{sticker.id}`
*/
guildSticker(guildId, stickerId) {
return `/guilds/${guildId}/stickers/${stickerId}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/scheduled-events`
* - POST `/guilds/{guild.id}/scheduled-events`
*/
guildScheduledEvents(guildId) {
return `/guilds/${guildId}/scheduled-events`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/scheduled-events/{guildScheduledEvent.id}`
* - PATCH `/guilds/{guild.id}/scheduled-events/{guildScheduledEvent.id}`
* - DELETE `/guilds/{guild.id}/scheduled-events/{guildScheduledEvent.id}`
*/
guildScheduledEvent(guildId, guildScheduledEventId) {
return `/guilds/${guildId}/scheduled-events/${guildScheduledEventId}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/scheduled-events/{guildScheduledEvent.id}/users`
*/
guildScheduledEventUsers(guildId, guildScheduledEventId) {
return `/guilds/${guildId}/scheduled-events/${guildScheduledEventId}/users`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/onboarding`
* - PUT `/guilds/{guild.id}/onboarding`
*/
guildOnboarding(guildId) {
return `/guilds/${guildId}/onboarding`;
},
/**
* Route for:
* - PUT `/guilds/${guild.id}/incident-actions`
*/
guildIncidentActions(guildId) {
return `/guilds/${guildId}/incident-actions`;
},
/**
* Route for:
* - GET `/applications/@me`
* - PATCH `/applications/@me`
*/
currentApplication() {
return '/applications/@me';
},
/**
* Route for:
* - GET `/applications/{application.id}/entitlements`
* - POST `/applications/{application.id}/entitlements`
*/
entitlements(applicationId) {
return `/applications/${applicationId}/entitlements`;
},
/**
* Route for:
* - GET `/applications/{application.id}/entitlements/{entitlement.id}`
* - DELETE `/applications/{application.id}/entitlements/{entitlement.id}`
*/
entitlement(applicationId, entitlementId) {
return `/applications/${applicationId}/entitlements/${entitlementId}`;
},
/**
* Route for:
* - GET `/applications/{application.id}/skus`
*/
skus(applicationId) {
return `/applications/${applicationId}/skus`;
},
/**
* Route for:
* - POST `/guilds/{guild.id}/bulk-ban`
*/
guildBulkBan(guildId) {
return `/guilds/${guildId}/bulk-ban`;
},
/**
* Route for:
* - POST `/applications/{application.id}/entitlements/{entitlement.id}/consume`
*/
consumeEntitlement(applicationId, entitlementId) {
return `/applications/${applicationId}/entitlements/${entitlementId}/consume`;
},
/**
* Route for:
* - GET `/applications/{application.id}/emojis`
* - POST `/applications/{application.id}/emojis`
*/
applicationEmojis(applicationId) {
return `/applications/${applicationId}/emojis`;
},
/**
* Route for:
* - GET `/applications/{application.id}/emojis/{emoji.id}`
* - PATCH `/applications/{application.id}/emojis/{emoji.id}`
* - DELETE `/applications/{application.id}/emojis/{emoji.id}`
*/
applicationEmoji(applicationId, emojiId) {
return `/applications/${applicationId}/emojis/${emojiId}`;
},
/**
* Route for:
* - GET `/skus/{sku.id}/subscriptions`
*/
skuSubscriptions(skuId) {
return `/skus/${skuId}/subscriptions`;
},
/**
* Route for:
* - GET `/skus/{sku.id}/subscriptions/{subscription.id}`
*/
skuSubscription(skuId, subscriptionId) {
return `/skus/${skuId}/subscriptions/${subscriptionId}`;
},
/**
* Route for:
* - POST `/channels/{channel.id}/send-soundboard-sound`
*/
sendSoundboardSound(channelId) {
return `/channels/${channelId}/send-soundboard-sound`;
},
/**
* Route for:
* - GET `/soundboard-default-sounds`
*/
soundboardDefaultSounds() {
return '/soundboard-default-sounds';
},
/**
* Route for:
* - GET `/guilds/{guild.id}/soundboard-sounds`
* - POST `/guilds/{guild.id}/soundboard-sounds`
*/
guildSoundboardSounds(guildId) {
return `/guilds/${guildId}/soundboard-sounds`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/soundboard-sounds/{sound.id}`
* - PATCH `/guilds/{guild.id}/soundboard-sounds/{sound.id}`
* - DELETE `/guilds/{guild.id}/soundboard-sounds/{sound.id}`
*/
guildSoundboardSound(guildId, soundId) {
return `/guilds/${guildId}/soundboard-sounds/${soundId}`;
},
};
for (const [key, fn] of Object.entries(exports.Routes)) {
exports.Routes[key] = (...args) => {
const escaped = args.map((arg) => {
if (arg) {
// Skip already "safe" urls
if (internals_1.urlSafeCharacters.test(String(arg))) {
return arg;
}
return encodeURIComponent(arg);
}
return arg;
});
// eslint-disable-next-line no-useless-call
return fn.call(null, ...escaped);
};
}
// Freeze the object so it can't be changed
Object.freeze(exports.Routes);
exports.StickerPackApplicationId = '710982414301790216';
var ImageFormat;
(function (ImageFormat) {
ImageFormat["JPEG"] = "jpeg";
ImageFormat["PNG"] = "png";
ImageFormat["WebP"] = "webp";
ImageFormat["GIF"] = "gif";
ImageFormat["Lottie"] = "json";
})(ImageFormat || (exports.ImageFormat = ImageFormat = {}));
exports.CDNRoutes = {
/**
* Route for:
* - GET `/emojis/{emoji.id}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
emoji(emojiId, format) {
return `/emojis/${emojiId}.${format}`;
},
/**
* Route for:
* - GET `/icons/{guild.id}/{guild.icon}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildIcon(guildId, guildIcon, format) {
return `/icons/${guildId}/${guildIcon}.${format}`;
},
/**
* Route for:
* - GET `/splashes/{guild.id}/{guild.splash}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
guildSplash(guildId, guildSplash, format) {
return `/splashes/${guildId}/${guildSplash}.${format}`;
},
/**
* Route for:
* - GET `/discovery-splashes/{guild.id}/{guild.discovery_splash}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
guildDiscoverySplash(guildId, guildDiscoverySplash, format) {
return `/discovery-splashes/${guildId}/${guildDiscoverySplash}.${format}`;
},
/**
* Route for:
* - GET `/banners/{guild.id}/{guild.banner}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildBanner(guildId, guildBanner, format) {
return `/banners/${guildId}/${guildBanner}.${format}`;
},
/**
* Route for:
* - GET `/banners/{user.id}/{user.banner}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
userBanner(userId, userBanner, format) {
return `/banners/${userId}/${userBanner}.${format}`;
},
/**
* Route for:
* - GET `/embed/avatars/{index}.png`
*
* The value for `index` parameter depends on whether the user is {@link https://discord.com/developers/docs/change-log#unique-usernames-on-discord | migrated to the new username system}.
* For users on the new username system, `index` will be `(user.id >> 22) % 6`.
* For users on the legacy username system, `index` will be `user.discriminator % 5`.
*
* This route supports the extension: PNG
*/
defaultUserAvatar(index) {
return `/embed/avatars/${index}.png`;
},
/**
* Route for:
* - GET `/avatars/{user.id}/{user.avatar}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
userAvatar(userId, userAvatar, format) {
return `/avatars/${userId}/${userAvatar}.${format}`;
},
/**
* Route for:
* - GET `/guilds/{guild.id}/users/{user.id}/avatars/{guild_member.avatar}.{png|jpeg|webp|gif}`
*
* As this route supports GIFs, the hash will begin with `a_` if it is available in GIF format
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildMemberAvatar(guildId, userId, memberAvatar, format) {
return `/guilds/${guildId}/users/${userId}/avatars/${memberAvatar}.${format}`;
},
/**
* Route for:
* - GET `/avatar-decorations/{user.id}/{user.avatar_decoration}.png`
*
* This route supports the extension: PNG
*
* @deprecated Use {@link CDNRoutes.avatarDecoration} instead.
*/
userAvatarDecoration(userId, userAvatarDecoration) {
return `/avatar-decorations/${userId}/${userAvatarDecoration}.png`;
},
/**
* Route for:
* - GET `/avatar-decoration-presets/{avatar_decoration_data_asset}.png`
*
* This route supports the extension: PNG
*/
avatarDecoration(avatarDecorationDataAsset) {
return `/avatar-decoration-presets/${avatarDecorationDataAsset}.png`;
},
/**
* Route for:
* - GET `/app-icons/{application.id}/{application.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
applicationIcon(applicationId, applicationIcon, format) {
return `/app-icons/${applicationId}/${applicationIcon}.${format}`;
},
/**
* Route for:
* - GET `/app-icons/{application.id}/{application.cover_image}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
applicationCover(applicationId, applicationCoverImage, format) {
return `/app-icons/${applicationId}/${applicationCoverImage}.${format}`;
},
/**
* Route for:
* - GET `/app-assets/{application.id}/{application.asset_id}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
applicationAsset(applicationId, applicationAssetId, format) {
return `/app-assets/${applicationId}/${applicationAssetId}.${format}`;
},
/**
* Route for:
* - GET `/app-assets/{application.id}/achievements/{achievement.id}/icons/{achievement.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
achievementIcon(applicationId, achievementId, achievementIconHash, format) {
return `/app-assets/${applicationId}/achievements/${achievementId}/icons/${achievementIconHash}.${format}`;
},
/**
* Route for:
* - GET `/app-assets/710982414301790216/store/{sticker_pack.banner.asset_id}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
stickerPackBanner(stickerPackBannerAssetId, format) {
return `/app-assets/${exports.StickerPackApplicationId}/store/${stickerPackBannerAssetId}.${format}`;
},
/**
* Route for:
* - GET `/app-assets/${application.id}/store/${asset.id}.{png|jpeg|webp}}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
storePageAsset(applicationId, assetId, format = ImageFormat.PNG) {
return `/app-assets/${applicationId}/store/${assetId}.${format}`;
},
/**
* Route for:
* - GET `/team-icons/{team.id}/{team.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
teamIcon(teamId, teamIcon, format) {
return `/team-icons/${teamId}/${teamIcon}.${format}`;
},
/**
* Route for:
* - GET `/stickers/{sticker.id}.{png|json}`
*
* This route supports the extensions: PNG, Lottie, GIF
*/
sticker(stickerId, format) {
return `/stickers/${stickerId}.${format}`;
},
/**
* Route for:
* - GET `/role-icons/{role.id}/{role.icon}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
roleIcon(roleId, roleIcon, format) {
return `/role-icons/${roleId}/${roleIcon}.${format}`;
},
/**
* Route for:
* - GET `/guild-events/{guild_scheduled_event.id}/{guild_scheduled_event.image}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
guildScheduledEventCover(guildScheduledEventId, guildScheduledEventCoverImage, format) {
return `/guild-events/${guildScheduledEventId}/${guildScheduledEventCoverImage}.${format}`;
},
/**
* Route for:
* - GET `/guilds/${guild.id}/users/${user.id}/banners/${guild_member.banner}.{png|jpeg|webp|gif}`
*
* This route supports the extensions: PNG, JPEG, WebP, GIF
*/
guildMemberBanner(guildId, userId, guildMemberBanner, format) {
return `/guilds/${guildId}/users/${userId}/banners/${guildMemberBanner}.${format}`;
},
/**
* Route for:
* - GET `/soundboard-sounds/${sound.id}`
*/
soundboardSound(soundId) {
return `/soundboard-sounds/${soundId}`;
},
/**
* Route for:
* - GET `/guild-tag-badges/{guild.id}/{badge}.{png|jpeg|webp}`
*
* This route supports the extensions: PNG, JPEG, WebP
*/
guildTagBadge(guildId, guildTagBadge, format) {
return `/guild-tag-badges/${guildId}/${guildTagBadge}.${format}`;
},
};
for (const [key, fn] of Object.entries(exports.CDNRoutes)) {
exports.CDNRoutes[key] = (...args) => {
const escaped = args.map((arg) => {
if (arg) {
// Skip already "safe" urls
if (internals_1.urlSafeCharacters.test(String(arg))) {
return arg;
}
return encodeURIComponent(arg);
}
return arg;
});
// eslint-disable-next-line no-useless-call
return fn.call(null, ...escaped);
};
}
// Freeze the object so it can't be changed
Object.freeze(exports.CDNRoutes);
exports.RouteBases = {
api: `https://discord.com/api/v${exports.APIVersion}`,
cdn: 'https://cdn.discordapp.com',
media: 'https://media.discordapp.net',
invite: 'https://discord.gg',
template: 'https://discord.new',
gift: 'https://discord.gift',
scheduledEvent: 'https://discord.com/events',
};
// Freeze bases object
Object.freeze(exports.RouteBases);
exports.OAuth2Routes = {
authorizationURL: `${exports.RouteBases.api}${exports.Routes.oauth2Authorization()}`,
tokenURL: `${exports.RouteBases.api}${exports.Routes.oauth2TokenExchange()}`,
/**
* @see {@link https://tools.ietf.org/html/rfc7009}
*/
tokenRevocationURL: `${exports.RouteBases.api}${exports.Routes.oauth2TokenRevocation()}`,
};
// Freeze OAuth2 route object
Object.freeze(exports.OAuth2Routes);
//# sourceMappingURL=index.js.map