@discordjs/core 0.4.0-dev.1671969841-22e2bbb.0 → 0.4.0-dev.1672833854-3407e1e.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +50 -2
- package/dist/index.js +101 -51
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +103 -51
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { REST, RawFile } from '@discordjs/rest';
|
|
2
2
|
import * as discord_api_types_v10 from 'discord-api-types/v10';
|
|
3
|
-
import { Snowflake, RESTGetAPIApplicationCommandsQuery, RESTGetAPIApplicationCommandsResult, RESTPostAPIApplicationCommandsJSONBody, RESTPatchAPIApplicationCommandJSONBody, RESTPutAPIApplicationCommandsJSONBody, RESTPutAPIApplicationCommandsResult, RESTGetAPIApplicationGuildCommandsQuery, RESTGetAPIGuildApplicationCommandsPermissionsResult, RESTPutAPIApplicationCommandPermissionsJSONBody, RESTPostAPIChannelMessageJSONBody, RESTGetAPIChannelMessageReactionUsersQuery, RESTGetAPIChannelMessageReactionUsersResult, RESTPatchAPIChannelJSONBody, RESTGetAPIChannelMessagesQuery, RESTGetAPIChannelMessagesResult, RESTGetAPIChannelPinsResult, RESTPostAPIChannelInviteJSONBody, RESTGetAPIChannelInvitesResult, RESTGetAPIChannelThreadsArchivedQuery, RESTGetAPIChannelUsersThreadsArchivedResult, RESTPostAPIGuildsJSONBody, RESTPatchAPIGuildJSONBody, RESTGetAPIGuildMembersQuery, RESTGetAPIGuildChannelsResult, RESTPostAPIGuildChannelJSONBody, RESTPatchAPIGuildChannelPositionsJSONBody, RESTGetAPIGuildBansResult, RESTPutAPIGuildBanJSONBody, RESTGetAPIGuildRolesResult, RESTPostAPIGuildRoleJSONBody, RESTPatchAPIGuildRolePositionsJSONBody, RESTPatchAPIGuildRolePositionsResult, RESTPatchAPIGuildRoleJSONBody, GuildMFALevel, RESTGetAPIGuildPruneCountQuery, RESTGetAPIGuildPruneCountResult, RESTPostAPIGuildPruneJSONBody, RESTGetAPIGuildVoiceRegionsResult, RESTGetAPIGuildInvitesResult, RESTGetAPIGuildIntegrationsResult, RESTPatchAPIGuildWidgetSettingsJSONBody, RESTGetAPIGuildVanityUrlResult, GuildWidgetStyle, RESTPatchAPIGuildWelcomeScreenJSONBody, RESTPatchAPIGuildVoiceStateUserJSONBody, RESTGetAPIGuildEmojisResult, RESTPostAPIGuildEmojiJSONBody, RESTPatchAPIGuildEmojiJSONBody, RESTGetAPIGuildScheduledEventsQuery, RESTGetAPIGuildScheduledEventsResult, RESTPostAPIGuildScheduledEventJSONBody, RESTGetAPIGuildScheduledEventQuery, RESTPatchAPIGuildScheduledEventJSONBody, RESTGetAPIGuildScheduledEventUsersQuery, RESTGetAPIGuildScheduledEventUsersResult, RESTGetAPIGuildTemplatesResult, RESTPatchAPIGuildTemplateJSONBody, RESTGetAPIGuildStickersResult, RESTPostAPIGuildStickerFormDataBody, RESTPatchAPIGuildStickerJSONBody, RESTGetAPIAuditLogQuery, RESTGetAPIAutoModerationRulesResult, RESTPostAPIAutoModerationRuleJSONBody, RESTPatchAPIAutoModerationRuleJSONBody, RESTGetAPIGuildMembersSearchQuery, RESTGetAPIGuildMembersSearchResult, RESTPatchAPIGuildMemberJSONBody, RESTPostAPITemplateCreateGuildJSONBody, RESTPostAPIChannelWebhookJSONBody, RESTPatchAPIWebhookJSONBody, RESTPostAPIWebhookWithTokenJSONBody, RESTPostAPIWebhookWithTokenQuery, RESTPostAPIWebhookWithTokenWaitResult, RESTPostAPIWebhookWithTokenSlackQuery, RESTPostAPIWebhookWithTokenGitHubQuery, RESTPatchAPIWebhookWithTokenMessageJSONBody, APIInteractionResponseCallbackData, APICommandAutocompleteInteractionResponseCallbackData, APIModalInteractionResponseCallbackData, RESTGetAPIInviteQuery, RESTGetAPIApplicationRoleConnectionMetadataResult, RESTPutAPIApplicationRoleConnectionMetadataResult, RESTGetNitroStickerPacksResult, RESTPostAPIChannelThreadsJSONBody, RESTPostAPIGuildForumThreadsJSONBody, APIThreadChannel, APIThreadMember, RESTGetAPIChannelThreadMembersResult, RESTGetAPICurrentUserGuildsQuery, RESTGetAPICurrentUserGuildsResult, RESTPatchAPICurrentUserJSONBody, RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody, RESTGetAPICurrentUserConnectionsResult, RESTPutAPICurrentUserApplicationRoleConnectionJSONBody, GatewayDispatchEvents, GatewayChannelCreateDispatchData, GatewayChannelDeleteDispatchData, GatewayChannelPinsUpdateDispatchData, GatewayChannelUpdateDispatchData, GatewayGuildBanAddDispatchData, GatewayGuildBanRemoveDispatchData, GatewayGuildCreateDispatchData, GatewayGuildDeleteDispatchData, GatewayGuildEmojisUpdateDispatchData, GatewayGuildIntegrationsUpdateDispatchData, GatewayGuildMemberAddDispatchData, GatewayGuildMemberRemoveDispatchData, GatewayGuildMemberUpdateDispatchData, GatewayGuildMembersChunkDispatchData, GatewayGuildRoleCreateDispatchData, GatewayGuildRoleDeleteDispatchData, GatewayGuildRoleUpdateDispatchData, GatewayGuildScheduledEventCreateDispatchData, GatewayGuildScheduledEventDeleteDispatchData, GatewayGuildScheduledEventUpdateDispatchData, GatewayGuildScheduledEventUserAddDispatchData, GatewayGuildScheduledEventUserRemoveDispatchData, GatewayGuildStickersUpdateDispatchData, GatewayGuildUpdateDispatchData, GatewayIntegrationCreateDispatchData, GatewayIntegrationDeleteDispatchData, GatewayIntegrationUpdateDispatchData, GatewayInteractionCreateDispatchData, GatewayInviteCreateDispatchData, GatewayInviteDeleteDispatchData, GatewayMessageCreateDispatchData, GatewayMessageDeleteDispatchData, GatewayMessageDeleteBulkDispatchData, GatewayMessageReactionAddDispatchData, GatewayMessageReactionRemoveDispatchData, GatewayMessageReactionRemoveAllDispatchData, GatewayMessageReactionRemoveEmojiDispatchData, GatewayMessageUpdateDispatchData, GatewayPresenceUpdateDispatchData, GatewayReadyDispatchData, GatewayStageInstanceCreateDispatchData, GatewayStageInstanceDeleteDispatchData, GatewayStageInstanceUpdateDispatchData, GatewayThreadCreateDispatchData, GatewayThreadDeleteDispatchData, GatewayThreadListSyncDispatchData, GatewayThreadMemberUpdateDispatchData, GatewayThreadMembersUpdateDispatchData, GatewayThreadUpdateDispatchData, GatewayUserUpdateDispatchData, GatewayVoiceServerUpdateDispatchData, GatewayVoiceStateUpdateDispatchData, GatewayWebhooksUpdateDispatchData, GatewayTypingStartDispatchData, GatewayAutoModerationActionExecutionDispatchData, GatewayAutoModerationRuleCreateDispatchData, GatewayAutoModerationRuleDeleteDispatchData, GatewayAutoModerationRuleUpdateDispatchData } from 'discord-api-types/v10';
|
|
3
|
+
import { Snowflake, RESTGetAPIApplicationCommandsQuery, RESTGetAPIApplicationCommandsResult, RESTPostAPIApplicationCommandsJSONBody, RESTPatchAPIApplicationCommandJSONBody, RESTPutAPIApplicationCommandsJSONBody, RESTPutAPIApplicationCommandsResult, RESTGetAPIApplicationGuildCommandsQuery, RESTGetAPIGuildApplicationCommandsPermissionsResult, RESTPutAPIApplicationCommandPermissionsJSONBody, RESTPostAPIChannelMessageJSONBody, RESTGetAPIChannelMessageReactionUsersQuery, RESTGetAPIChannelMessageReactionUsersResult, RESTPatchAPIChannelJSONBody, RESTGetAPIChannelMessagesQuery, RESTGetAPIChannelMessagesResult, RESTGetAPIChannelPinsResult, RESTPostAPIChannelInviteJSONBody, RESTGetAPIChannelInvitesResult, RESTGetAPIChannelThreadsArchivedQuery, RESTGetAPIChannelUsersThreadsArchivedResult, RESTPostAPIGuildsJSONBody, RESTPatchAPIGuildJSONBody, RESTGetAPIGuildMembersQuery, RESTGetAPIGuildChannelsResult, RESTPostAPIGuildChannelJSONBody, RESTPatchAPIGuildChannelPositionsJSONBody, RESTGetAPIGuildBansResult, RESTPutAPIGuildBanJSONBody, RESTGetAPIGuildRolesResult, RESTPostAPIGuildRoleJSONBody, RESTPatchAPIGuildRolePositionsJSONBody, RESTPatchAPIGuildRolePositionsResult, RESTPatchAPIGuildRoleJSONBody, GuildMFALevel, RESTGetAPIGuildPruneCountQuery, RESTGetAPIGuildPruneCountResult, RESTPostAPIGuildPruneJSONBody, RESTGetAPIGuildVoiceRegionsResult, RESTGetAPIGuildInvitesResult, RESTGetAPIGuildIntegrationsResult, RESTPatchAPIGuildWidgetSettingsJSONBody, RESTGetAPIGuildVanityUrlResult, GuildWidgetStyle, RESTPatchAPIGuildWelcomeScreenJSONBody, RESTPatchAPIGuildVoiceStateUserJSONBody, RESTGetAPIGuildEmojisResult, RESTPostAPIGuildEmojiJSONBody, RESTPatchAPIGuildEmojiJSONBody, RESTGetAPIGuildScheduledEventsQuery, RESTGetAPIGuildScheduledEventsResult, RESTPostAPIGuildScheduledEventJSONBody, RESTGetAPIGuildScheduledEventQuery, RESTPatchAPIGuildScheduledEventJSONBody, RESTGetAPIGuildScheduledEventUsersQuery, RESTGetAPIGuildScheduledEventUsersResult, RESTGetAPIGuildTemplatesResult, RESTPatchAPIGuildTemplateJSONBody, RESTGetAPIGuildStickersResult, RESTPostAPIGuildStickerFormDataBody, RESTPatchAPIGuildStickerJSONBody, RESTGetAPIAuditLogQuery, RESTGetAPIAutoModerationRulesResult, RESTPostAPIAutoModerationRuleJSONBody, RESTPatchAPIAutoModerationRuleJSONBody, RESTGetAPIGuildMembersSearchQuery, RESTGetAPIGuildMembersSearchResult, RESTPatchAPIGuildMemberJSONBody, RESTPostAPITemplateCreateGuildJSONBody, RESTPostAPIChannelWebhookJSONBody, RESTPatchAPIWebhookJSONBody, RESTPostAPIWebhookWithTokenJSONBody, RESTPostAPIWebhookWithTokenQuery, RESTPostAPIWebhookWithTokenWaitResult, RESTPostAPIWebhookWithTokenSlackQuery, RESTPostAPIWebhookWithTokenGitHubQuery, RESTPatchAPIWebhookWithTokenMessageJSONBody, APIInteractionResponseCallbackData, APICommandAutocompleteInteractionResponseCallbackData, APIModalInteractionResponseCallbackData, RESTGetAPIInviteQuery, RESTOAuth2AuthorizationQuery, RESTPostOAuth2AccessTokenURLEncodedData, RESTPostOAuth2AccessTokenResult, RESTPostOAuth2RefreshTokenURLEncodedData, RESTPostOAuth2ClientCredentialsURLEncodedData, RESTGetAPIOAuth2CurrentApplicationResult, RESTGetAPIOAuth2CurrentAuthorizationResult, RESTGetAPIApplicationRoleConnectionMetadataResult, RESTPutAPIApplicationRoleConnectionMetadataResult, RESTGetNitroStickerPacksResult, RESTPostAPIChannelThreadsJSONBody, RESTPostAPIGuildForumThreadsJSONBody, APIThreadChannel, APIThreadMember, RESTGetAPIChannelThreadMembersResult, RESTGetAPICurrentUserGuildsQuery, RESTGetAPICurrentUserGuildsResult, RESTPatchAPICurrentUserJSONBody, RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody, RESTGetAPICurrentUserConnectionsResult, RESTPutAPICurrentUserApplicationRoleConnectionJSONBody, GatewayDispatchEvents, GatewayChannelCreateDispatchData, GatewayChannelDeleteDispatchData, GatewayChannelPinsUpdateDispatchData, GatewayChannelUpdateDispatchData, GatewayGuildBanAddDispatchData, GatewayGuildBanRemoveDispatchData, GatewayGuildCreateDispatchData, GatewayGuildDeleteDispatchData, GatewayGuildEmojisUpdateDispatchData, GatewayGuildIntegrationsUpdateDispatchData, GatewayGuildMemberAddDispatchData, GatewayGuildMemberRemoveDispatchData, GatewayGuildMemberUpdateDispatchData, GatewayGuildMembersChunkDispatchData, GatewayGuildRoleCreateDispatchData, GatewayGuildRoleDeleteDispatchData, GatewayGuildRoleUpdateDispatchData, GatewayGuildScheduledEventCreateDispatchData, GatewayGuildScheduledEventDeleteDispatchData, GatewayGuildScheduledEventUpdateDispatchData, GatewayGuildScheduledEventUserAddDispatchData, GatewayGuildScheduledEventUserRemoveDispatchData, GatewayGuildStickersUpdateDispatchData, GatewayGuildUpdateDispatchData, GatewayIntegrationCreateDispatchData, GatewayIntegrationDeleteDispatchData, GatewayIntegrationUpdateDispatchData, GatewayInteractionCreateDispatchData, GatewayInviteCreateDispatchData, GatewayInviteDeleteDispatchData, GatewayMessageCreateDispatchData, GatewayMessageDeleteDispatchData, GatewayMessageDeleteBulkDispatchData, GatewayMessageReactionAddDispatchData, GatewayMessageReactionRemoveDispatchData, GatewayMessageReactionRemoveAllDispatchData, GatewayMessageReactionRemoveEmojiDispatchData, GatewayMessageUpdateDispatchData, GatewayPresenceUpdateDispatchData, GatewayReadyDispatchData, GatewayStageInstanceCreateDispatchData, GatewayStageInstanceDeleteDispatchData, GatewayStageInstanceUpdateDispatchData, GatewayThreadCreateDispatchData, GatewayThreadDeleteDispatchData, GatewayThreadListSyncDispatchData, GatewayThreadMemberUpdateDispatchData, GatewayThreadMembersUpdateDispatchData, GatewayThreadUpdateDispatchData, GatewayUserUpdateDispatchData, GatewayVoiceServerUpdateDispatchData, GatewayVoiceStateUpdateDispatchData, GatewayWebhooksUpdateDispatchData, GatewayTypingStartDispatchData, GatewayAutoModerationActionExecutionDispatchData, GatewayAutoModerationRuleCreateDispatchData, GatewayAutoModerationRuleDeleteDispatchData, GatewayAutoModerationRuleUpdateDispatchData } from 'discord-api-types/v10';
|
|
4
4
|
export * from 'discord-api-types/v10';
|
|
5
5
|
import { WebSocketManager } from '@discordjs/ws';
|
|
6
6
|
import { AsyncEventEmitter } from '@vladfrangu/async_event_emitter';
|
|
@@ -1169,6 +1169,53 @@ declare class InvitesAPI {
|
|
|
1169
1169
|
delete(code: string, reason?: string): Promise<void>;
|
|
1170
1170
|
}
|
|
1171
1171
|
|
|
1172
|
+
declare class OAuth2API {
|
|
1173
|
+
private readonly rest;
|
|
1174
|
+
constructor(rest: REST);
|
|
1175
|
+
/**
|
|
1176
|
+
* Creates an OAuth2 authorization URL given the options
|
|
1177
|
+
*
|
|
1178
|
+
* @see {@link https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-authorization-url-example}
|
|
1179
|
+
* @param options - The options for creating the authorization URL
|
|
1180
|
+
*/
|
|
1181
|
+
generateAuthorizationURL(options: RESTOAuth2AuthorizationQuery): string;
|
|
1182
|
+
/**
|
|
1183
|
+
* Performs an OAuth2 token exchange, giving you an access token
|
|
1184
|
+
*
|
|
1185
|
+
* @see {@link https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-access-token-exchange-example}
|
|
1186
|
+
* @param options - The options for the token exchange request
|
|
1187
|
+
*/
|
|
1188
|
+
tokenExchange(options: RESTPostOAuth2AccessTokenURLEncodedData): Promise<RESTPostOAuth2AccessTokenResult>;
|
|
1189
|
+
/**
|
|
1190
|
+
* Refreshes an OAuth2 access token, giving you a new one
|
|
1191
|
+
*
|
|
1192
|
+
* @see {@link https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-refresh-token-exchange-example}
|
|
1193
|
+
* @param options - The options for the refresh token request
|
|
1194
|
+
*/
|
|
1195
|
+
refreshToken(options: RESTPostOAuth2RefreshTokenURLEncodedData): Promise<RESTPostOAuth2AccessTokenResult>;
|
|
1196
|
+
/**
|
|
1197
|
+
* Fetches the bearer token for the current application
|
|
1198
|
+
*
|
|
1199
|
+
* @remarks
|
|
1200
|
+
* This is primarily used for testing purposes
|
|
1201
|
+
* @see {@link https://discord.com/developers/docs/topics/oauth2#client-credentials-grant}
|
|
1202
|
+
* @param options - The options for the client credentials grant request
|
|
1203
|
+
*/
|
|
1204
|
+
getToken(options: RESTPostOAuth2ClientCredentialsURLEncodedData): Promise<discord_api_types_v10.RESTOAuth2ImplicitAuthorizationURLFragmentResult>;
|
|
1205
|
+
/**
|
|
1206
|
+
* Fetches the current bot's application information
|
|
1207
|
+
*
|
|
1208
|
+
* @see {@link https://discord.com/developers/docs/topics/oauth2#get-current-bot-application-information}
|
|
1209
|
+
*/
|
|
1210
|
+
getCurrentBotApplicationInformation(): Promise<RESTGetAPIOAuth2CurrentApplicationResult>;
|
|
1211
|
+
/**
|
|
1212
|
+
* Fetches the current authorization information
|
|
1213
|
+
*
|
|
1214
|
+
* @see {@link https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information}
|
|
1215
|
+
*/
|
|
1216
|
+
getCurrentAuthorizationInformation(): Promise<RESTGetAPIOAuth2CurrentAuthorizationResult>;
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1172
1219
|
declare class RoleConnectionsAPI {
|
|
1173
1220
|
private readonly rest;
|
|
1174
1221
|
constructor(rest: REST);
|
|
@@ -1398,6 +1445,7 @@ declare class API {
|
|
|
1398
1445
|
readonly guilds: GuildsAPI;
|
|
1399
1446
|
readonly interactions: InteractionsAPI;
|
|
1400
1447
|
readonly invites: InvitesAPI;
|
|
1448
|
+
readonly oauth2: OAuth2API;
|
|
1401
1449
|
readonly roleConnections: RoleConnectionsAPI;
|
|
1402
1450
|
readonly stickers: StickersAPI;
|
|
1403
1451
|
readonly threads: ThreadsAPI;
|
|
@@ -1527,4 +1575,4 @@ declare function withFiles(files: DescriptiveRawFile[], options: APIInteractionR
|
|
|
1527
1575
|
}[];
|
|
1528
1576
|
};
|
|
1529
1577
|
|
|
1530
|
-
export { API, ApplicationCommandsAPI, ChannelsAPI, ClientOptions, DescriptiveRawFile, GuildsAPI, InteractionsAPI, IntrinsicProps, InvitesAPI, ManagerShardEventsMap, MappedEvents, RoleConnectionsAPI, StartForumThreadOptions, StartThreadOptions, StickersAPI, ThreadsAPI, UsersAPI, VoiceAPI, WebhooksAPI, WithIntrinsicProps, createClient, withFiles };
|
|
1578
|
+
export { API, ApplicationCommandsAPI, ChannelsAPI, ClientOptions, DescriptiveRawFile, GuildsAPI, InteractionsAPI, IntrinsicProps, InvitesAPI, ManagerShardEventsMap, MappedEvents, OAuth2API, RoleConnectionsAPI, StartForumThreadOptions, StartThreadOptions, StickersAPI, ThreadsAPI, UsersAPI, VoiceAPI, WebhooksAPI, WithIntrinsicProps, createClient, withFiles };
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,7 @@ __export(src_exports, {
|
|
|
28
28
|
GuildsAPI: () => GuildsAPI,
|
|
29
29
|
InteractionsAPI: () => InteractionsAPI,
|
|
30
30
|
InvitesAPI: () => InvitesAPI,
|
|
31
|
+
OAuth2API: () => OAuth2API,
|
|
31
32
|
RoleConnectionsAPI: () => RoleConnectionsAPI,
|
|
32
33
|
StickersAPI: () => StickersAPI,
|
|
33
34
|
ThreadsAPI: () => ThreadsAPI,
|
|
@@ -599,19 +600,65 @@ var InvitesAPI = class {
|
|
|
599
600
|
};
|
|
600
601
|
__name(InvitesAPI, "InvitesAPI");
|
|
601
602
|
|
|
602
|
-
// src/api/
|
|
603
|
+
// src/api/oauth2.ts
|
|
604
|
+
var import_node_url = require("url");
|
|
605
|
+
var import_rest5 = require("@discordjs/rest");
|
|
603
606
|
var import_v106 = require("discord-api-types/v10");
|
|
607
|
+
var OAuth2API = class {
|
|
608
|
+
constructor(rest) {
|
|
609
|
+
this.rest = rest;
|
|
610
|
+
}
|
|
611
|
+
generateAuthorizationURL(options) {
|
|
612
|
+
const url = new import_node_url.URL(`${import_v106.RouteBases.api}${import_v106.Routes.oauth2Authorization()}`);
|
|
613
|
+
url.search = (0, import_rest5.makeURLSearchParams)(options).toString();
|
|
614
|
+
return url.toString();
|
|
615
|
+
}
|
|
616
|
+
async tokenExchange(options) {
|
|
617
|
+
return this.rest.post(import_v106.Routes.oauth2TokenExchange(), {
|
|
618
|
+
body: (0, import_rest5.makeURLSearchParams)(options),
|
|
619
|
+
headers: {
|
|
620
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
621
|
+
}
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
async refreshToken(options) {
|
|
625
|
+
return this.rest.post(import_v106.Routes.oauth2TokenExchange(), {
|
|
626
|
+
body: (0, import_rest5.makeURLSearchParams)(options),
|
|
627
|
+
headers: {
|
|
628
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
629
|
+
}
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
async getToken(options) {
|
|
633
|
+
return this.rest.post(import_v106.Routes.oauth2TokenExchange(), {
|
|
634
|
+
body: (0, import_rest5.makeURLSearchParams)(options),
|
|
635
|
+
headers: {
|
|
636
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
async getCurrentBotApplicationInformation() {
|
|
641
|
+
return this.rest.get(import_v106.Routes.oauth2CurrentApplication());
|
|
642
|
+
}
|
|
643
|
+
async getCurrentAuthorizationInformation() {
|
|
644
|
+
return this.rest.get(import_v106.Routes.oauth2CurrentAuthorization());
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
__name(OAuth2API, "OAuth2API");
|
|
648
|
+
|
|
649
|
+
// src/api/roleConnections.ts
|
|
650
|
+
var import_v107 = require("discord-api-types/v10");
|
|
604
651
|
var RoleConnectionsAPI = class {
|
|
605
652
|
constructor(rest) {
|
|
606
653
|
this.rest = rest;
|
|
607
654
|
}
|
|
608
655
|
async getMetadataRecords(applicationId) {
|
|
609
656
|
return this.rest.get(
|
|
610
|
-
|
|
657
|
+
import_v107.Routes.applicationRoleConnectionMetadata(applicationId)
|
|
611
658
|
);
|
|
612
659
|
}
|
|
613
660
|
async updateMetadataRecords(applicationId, options) {
|
|
614
|
-
return this.rest.put(
|
|
661
|
+
return this.rest.put(import_v107.Routes.applicationRoleConnectionMetadata(applicationId), {
|
|
615
662
|
body: options
|
|
616
663
|
});
|
|
617
664
|
}
|
|
@@ -619,31 +666,31 @@ var RoleConnectionsAPI = class {
|
|
|
619
666
|
__name(RoleConnectionsAPI, "RoleConnectionsAPI");
|
|
620
667
|
|
|
621
668
|
// src/api/sticker.ts
|
|
622
|
-
var
|
|
669
|
+
var import_v108 = require("discord-api-types/v10");
|
|
623
670
|
var StickersAPI = class {
|
|
624
671
|
constructor(rest) {
|
|
625
672
|
this.rest = rest;
|
|
626
673
|
}
|
|
627
674
|
async getNitroStickers() {
|
|
628
|
-
return this.rest.get(
|
|
675
|
+
return this.rest.get(import_v108.Routes.nitroStickerPacks());
|
|
629
676
|
}
|
|
630
677
|
async get(stickerId) {
|
|
631
|
-
return this.rest.get(
|
|
678
|
+
return this.rest.get(import_v108.Routes.sticker(stickerId));
|
|
632
679
|
}
|
|
633
680
|
};
|
|
634
681
|
__name(StickersAPI, "StickersAPI");
|
|
635
682
|
|
|
636
683
|
// src/api/thread.ts
|
|
637
|
-
var
|
|
684
|
+
var import_v109 = require("discord-api-types/v10");
|
|
638
685
|
var ThreadsAPI = class {
|
|
639
686
|
constructor(rest) {
|
|
640
687
|
this.rest = rest;
|
|
641
688
|
}
|
|
642
689
|
async get(threadId) {
|
|
643
|
-
return this.rest.get(
|
|
690
|
+
return this.rest.get(import_v109.Routes.channel(threadId));
|
|
644
691
|
}
|
|
645
692
|
async create(channelId, { message_id, ...body }) {
|
|
646
|
-
return this.rest.post(
|
|
693
|
+
return this.rest.post(import_v109.Routes.threads(channelId, message_id), { body });
|
|
647
694
|
}
|
|
648
695
|
async createForumThread(channelId, { message, ...optionsBody }) {
|
|
649
696
|
const { files, ...messageBody } = message;
|
|
@@ -651,82 +698,82 @@ var ThreadsAPI = class {
|
|
|
651
698
|
...optionsBody,
|
|
652
699
|
message: messageBody
|
|
653
700
|
};
|
|
654
|
-
return this.rest.post(
|
|
701
|
+
return this.rest.post(import_v109.Routes.threads(channelId), { files, body });
|
|
655
702
|
}
|
|
656
703
|
async join(threadId) {
|
|
657
|
-
await this.rest.put(
|
|
704
|
+
await this.rest.put(import_v109.Routes.threadMembers(threadId, "@me"));
|
|
658
705
|
}
|
|
659
706
|
async addMember(threadId, userId) {
|
|
660
|
-
await this.rest.put(
|
|
707
|
+
await this.rest.put(import_v109.Routes.threadMembers(threadId, userId));
|
|
661
708
|
}
|
|
662
709
|
async leave(threadId) {
|
|
663
|
-
await this.rest.delete(
|
|
710
|
+
await this.rest.delete(import_v109.Routes.threadMembers(threadId, "@me"));
|
|
664
711
|
}
|
|
665
712
|
async removeMember(threadId, userId) {
|
|
666
|
-
await this.rest.delete(
|
|
713
|
+
await this.rest.delete(import_v109.Routes.threadMembers(threadId, userId));
|
|
667
714
|
}
|
|
668
715
|
async getMember(threadId, userId) {
|
|
669
|
-
return this.rest.get(
|
|
716
|
+
return this.rest.get(import_v109.Routes.threadMembers(threadId, userId));
|
|
670
717
|
}
|
|
671
718
|
async getAllMembers(threadId) {
|
|
672
|
-
return this.rest.get(
|
|
719
|
+
return this.rest.get(import_v109.Routes.threadMembers(threadId));
|
|
673
720
|
}
|
|
674
721
|
};
|
|
675
722
|
__name(ThreadsAPI, "ThreadsAPI");
|
|
676
723
|
|
|
677
724
|
// src/api/user.ts
|
|
678
|
-
var
|
|
679
|
-
var
|
|
725
|
+
var import_rest6 = require("@discordjs/rest");
|
|
726
|
+
var import_v1010 = require("discord-api-types/v10");
|
|
680
727
|
var UsersAPI = class {
|
|
681
728
|
constructor(rest) {
|
|
682
729
|
this.rest = rest;
|
|
683
730
|
}
|
|
684
731
|
async get(userId) {
|
|
685
|
-
return this.rest.get(
|
|
732
|
+
return this.rest.get(import_v1010.Routes.user(userId));
|
|
686
733
|
}
|
|
687
734
|
async getCurrent() {
|
|
688
|
-
return this.rest.get(
|
|
735
|
+
return this.rest.get(import_v1010.Routes.user("@me"));
|
|
689
736
|
}
|
|
690
737
|
async getGuilds(options = {}) {
|
|
691
|
-
return this.rest.get(
|
|
692
|
-
query: (0,
|
|
738
|
+
return this.rest.get(import_v1010.Routes.userGuilds(), {
|
|
739
|
+
query: (0, import_rest6.makeURLSearchParams)(options)
|
|
693
740
|
});
|
|
694
741
|
}
|
|
695
742
|
async leaveGuild(guildId) {
|
|
696
|
-
await this.rest.delete(
|
|
743
|
+
await this.rest.delete(import_v1010.Routes.userGuild(guildId));
|
|
697
744
|
}
|
|
698
745
|
async edit(user) {
|
|
699
|
-
return this.rest.patch(
|
|
746
|
+
return this.rest.patch(import_v1010.Routes.user("@me"), { body: user });
|
|
700
747
|
}
|
|
701
748
|
async getGuildMember(guildId) {
|
|
702
|
-
return this.rest.get(
|
|
749
|
+
return this.rest.get(import_v1010.Routes.userGuildMember(guildId));
|
|
703
750
|
}
|
|
704
751
|
async editGuildMember(guildId, member = {}, reason) {
|
|
705
|
-
return this.rest.patch(
|
|
752
|
+
return this.rest.patch(import_v1010.Routes.guildMember(guildId, "@me"), {
|
|
706
753
|
reason,
|
|
707
754
|
body: member
|
|
708
755
|
});
|
|
709
756
|
}
|
|
710
757
|
async setVoiceState(guildId, options = {}) {
|
|
711
|
-
return this.rest.patch(
|
|
758
|
+
return this.rest.patch(import_v1010.Routes.guildVoiceState(guildId, "@me"), {
|
|
712
759
|
body: options
|
|
713
760
|
});
|
|
714
761
|
}
|
|
715
762
|
async createDM(userId) {
|
|
716
|
-
return this.rest.post(
|
|
763
|
+
return this.rest.post(import_v1010.Routes.userChannels(), {
|
|
717
764
|
body: { recipient_id: userId }
|
|
718
765
|
});
|
|
719
766
|
}
|
|
720
767
|
async getConnections() {
|
|
721
|
-
return this.rest.get(
|
|
768
|
+
return this.rest.get(import_v1010.Routes.userConnections());
|
|
722
769
|
}
|
|
723
770
|
async getApplicationRoleConnection(applicationId) {
|
|
724
771
|
return this.rest.get(
|
|
725
|
-
|
|
772
|
+
import_v1010.Routes.userApplicationRoleConnection(applicationId)
|
|
726
773
|
);
|
|
727
774
|
}
|
|
728
775
|
async updateApplicationRoleConnection(applicationId, options) {
|
|
729
|
-
return this.rest.put(
|
|
776
|
+
return this.rest.put(import_v1010.Routes.userApplicationRoleConnection(applicationId), {
|
|
730
777
|
body: options
|
|
731
778
|
});
|
|
732
779
|
}
|
|
@@ -734,38 +781,38 @@ var UsersAPI = class {
|
|
|
734
781
|
__name(UsersAPI, "UsersAPI");
|
|
735
782
|
|
|
736
783
|
// src/api/voice.ts
|
|
737
|
-
var
|
|
784
|
+
var import_v1011 = require("discord-api-types/v10");
|
|
738
785
|
var VoiceAPI = class {
|
|
739
786
|
constructor(rest) {
|
|
740
787
|
this.rest = rest;
|
|
741
788
|
}
|
|
742
789
|
async getVoiceRegions() {
|
|
743
|
-
return this.rest.get(
|
|
790
|
+
return this.rest.get(import_v1011.Routes.voiceRegions());
|
|
744
791
|
}
|
|
745
792
|
};
|
|
746
793
|
__name(VoiceAPI, "VoiceAPI");
|
|
747
794
|
|
|
748
795
|
// src/api/webhook.ts
|
|
749
|
-
var
|
|
750
|
-
var
|
|
796
|
+
var import_rest7 = require("@discordjs/rest");
|
|
797
|
+
var import_v1012 = require("discord-api-types/v10");
|
|
751
798
|
var WebhooksAPI = class {
|
|
752
799
|
constructor(rest) {
|
|
753
800
|
this.rest = rest;
|
|
754
801
|
}
|
|
755
802
|
async get(id, token) {
|
|
756
|
-
return this.rest.get(
|
|
803
|
+
return this.rest.get(import_v1012.Routes.webhook(id, token));
|
|
757
804
|
}
|
|
758
805
|
async create(channelId, data, reason) {
|
|
759
|
-
return this.rest.post(
|
|
806
|
+
return this.rest.post(import_v1012.Routes.channelWebhooks(channelId), {
|
|
760
807
|
reason,
|
|
761
808
|
body: data
|
|
762
809
|
});
|
|
763
810
|
}
|
|
764
811
|
async edit(id, webhook, { token, reason } = {}) {
|
|
765
|
-
return this.rest.patch(
|
|
812
|
+
return this.rest.patch(import_v1012.Routes.webhook(id, token), { reason, body: webhook });
|
|
766
813
|
}
|
|
767
814
|
async delete(id, { token, reason } = {}) {
|
|
768
|
-
await this.rest.delete(
|
|
815
|
+
await this.rest.delete(import_v1012.Routes.webhook(id, token), { reason });
|
|
769
816
|
}
|
|
770
817
|
async execute(id, token, {
|
|
771
818
|
wait,
|
|
@@ -773,43 +820,43 @@ var WebhooksAPI = class {
|
|
|
773
820
|
files,
|
|
774
821
|
...body
|
|
775
822
|
}) {
|
|
776
|
-
return this.rest.post(
|
|
777
|
-
query: (0,
|
|
823
|
+
return this.rest.post(import_v1012.Routes.webhook(id, token), {
|
|
824
|
+
query: (0, import_rest7.makeURLSearchParams)({ wait, thread_id }),
|
|
778
825
|
files,
|
|
779
826
|
body,
|
|
780
827
|
auth: false
|
|
781
828
|
});
|
|
782
829
|
}
|
|
783
830
|
async executeSlack(id, token, body, options = {}) {
|
|
784
|
-
await this.rest.post(
|
|
785
|
-
query: (0,
|
|
831
|
+
await this.rest.post(import_v1012.Routes.webhookPlatform(id, token, "slack"), {
|
|
832
|
+
query: (0, import_rest7.makeURLSearchParams)(options),
|
|
786
833
|
body,
|
|
787
834
|
auth: false
|
|
788
835
|
});
|
|
789
836
|
}
|
|
790
837
|
async executeGitHub(id, token, body, options = {}) {
|
|
791
|
-
await this.rest.post(
|
|
792
|
-
query: (0,
|
|
838
|
+
await this.rest.post(import_v1012.Routes.webhookPlatform(id, token, "github"), {
|
|
839
|
+
query: (0, import_rest7.makeURLSearchParams)(options),
|
|
793
840
|
body,
|
|
794
841
|
auth: false
|
|
795
842
|
});
|
|
796
843
|
}
|
|
797
844
|
async getMessage(id, token, messageId, options = {}) {
|
|
798
|
-
return this.rest.get(
|
|
799
|
-
query: (0,
|
|
845
|
+
return this.rest.get(import_v1012.Routes.webhookMessage(id, token, messageId), {
|
|
846
|
+
query: (0, import_rest7.makeURLSearchParams)(options),
|
|
800
847
|
auth: false
|
|
801
848
|
});
|
|
802
849
|
}
|
|
803
850
|
async editMessage(id, token, messageId, { thread_id, ...body }) {
|
|
804
|
-
return this.rest.patch(
|
|
805
|
-
query: (0,
|
|
851
|
+
return this.rest.patch(import_v1012.Routes.webhookMessage(id, token, messageId), {
|
|
852
|
+
query: (0, import_rest7.makeURLSearchParams)({ thread_id }),
|
|
806
853
|
auth: false,
|
|
807
854
|
body
|
|
808
855
|
});
|
|
809
856
|
}
|
|
810
857
|
async deleteMessage(id, token, messageId, options = {}) {
|
|
811
|
-
await this.rest.delete(
|
|
812
|
-
query: (0,
|
|
858
|
+
await this.rest.delete(import_v1012.Routes.webhookMessage(id, token, messageId), {
|
|
859
|
+
query: (0, import_rest7.makeURLSearchParams)(options),
|
|
813
860
|
auth: false
|
|
814
861
|
});
|
|
815
862
|
}
|
|
@@ -825,6 +872,7 @@ var API = class {
|
|
|
825
872
|
this.guilds = new GuildsAPI(rest);
|
|
826
873
|
this.invites = new InvitesAPI(rest);
|
|
827
874
|
this.roleConnections = new RoleConnectionsAPI(rest);
|
|
875
|
+
this.oauth2 = new OAuth2API(rest);
|
|
828
876
|
this.stickers = new StickersAPI(rest);
|
|
829
877
|
this.threads = new ThreadsAPI(rest);
|
|
830
878
|
this.users = new UsersAPI(rest);
|
|
@@ -837,6 +885,7 @@ var API = class {
|
|
|
837
885
|
guilds;
|
|
838
886
|
interactions;
|
|
839
887
|
invites;
|
|
888
|
+
oauth2;
|
|
840
889
|
roleConnections;
|
|
841
890
|
stickers;
|
|
842
891
|
threads;
|
|
@@ -894,6 +943,7 @@ __reExport(src_exports, require("discord-api-types/v10"), module.exports);
|
|
|
894
943
|
GuildsAPI,
|
|
895
944
|
InteractionsAPI,
|
|
896
945
|
InvitesAPI,
|
|
946
|
+
OAuth2API,
|
|
897
947
|
RoleConnectionsAPI,
|
|
898
948
|
StickersAPI,
|
|
899
949
|
ThreadsAPI,
|