mini-interactions 0.0.0-stage → 0.16.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/LICENSE +21 -0
- package/MIGRATION.md +126 -0
- package/README.md +303 -2
- package/dist/bot.d.ts +113 -0
- package/dist/bot.js +293 -0
- package/dist/builders/ActionRowBuilder.d.ts +22 -0
- package/dist/builders/ActionRowBuilder.js +33 -0
- package/dist/builders/AutomodRuleBuilder.d.ts +45 -0
- package/dist/builders/AutomodRuleBuilder.js +151 -0
- package/dist/builders/ButtonBuilder.d.ts +53 -0
- package/dist/builders/ButtonBuilder.js +124 -0
- package/dist/builders/ChannelSelectMenuBuilder.d.ts +53 -0
- package/dist/builders/ChannelSelectMenuBuilder.js +105 -0
- package/dist/builders/CheckboxBuilder.d.ts +20 -0
- package/dist/builders/CheckboxBuilder.js +20 -0
- package/dist/builders/CheckboxGroupBuilder.d.ts +25 -0
- package/dist/builders/CheckboxGroupBuilder.js +48 -0
- package/dist/builders/EmbedBuilder.d.ts +33 -0
- package/dist/builders/EmbedBuilder.js +103 -0
- package/dist/builders/FileUploadBuilder.d.ts +17 -0
- package/dist/builders/FileUploadBuilder.js +22 -0
- package/dist/builders/LabelBuilder.d.ts +16 -0
- package/dist/builders/LabelBuilder.js +21 -0
- package/dist/builders/MiniContainerBuilder.d.ts +131 -0
- package/dist/builders/MiniContainerBuilder.js +347 -0
- package/dist/builders/ModalBuilder.d.ts +16 -0
- package/dist/builders/ModalBuilder.js +36 -0
- package/dist/builders/ModalChannelSelectMenuBuilder.d.ts +29 -0
- package/dist/builders/ModalChannelSelectMenuBuilder.js +25 -0
- package/dist/builders/ModalMentionableSelectMenuBuilder.d.ts +53 -0
- package/dist/builders/ModalMentionableSelectMenuBuilder.js +87 -0
- package/dist/builders/ModalRoleSelectMenuBuilder.d.ts +27 -0
- package/dist/builders/ModalRoleSelectMenuBuilder.js +24 -0
- package/dist/builders/ModalStringSelectMenuBuilder.d.ts +62 -0
- package/dist/builders/ModalStringSelectMenuBuilder.js +120 -0
- package/dist/builders/ModalUserSelectMenuBuilder.d.ts +53 -0
- package/dist/builders/ModalUserSelectMenuBuilder.js +96 -0
- package/dist/builders/RadioBuilder.d.ts +22 -0
- package/dist/builders/RadioBuilder.js +36 -0
- package/dist/builders/RoleSelectMenuBuilder.d.ts +47 -0
- package/dist/builders/RoleSelectMenuBuilder.js +92 -0
- package/dist/builders/StringSelectMenuBuilder.d.ts +52 -0
- package/dist/builders/StringSelectMenuBuilder.js +104 -0
- package/dist/builders/StringSelectMenuOptionBuilder.d.ts +46 -0
- package/dist/builders/StringSelectMenuOptionBuilder.js +106 -0
- package/dist/builders/TextInputBuilder.d.ts +23 -0
- package/dist/builders/TextInputBuilder.js +26 -0
- package/dist/builders/index.d.ts +44 -0
- package/dist/builders/index.js +22 -0
- package/dist/builders/shared.d.ts +8 -0
- package/dist/builders/shared.js +11 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +71 -0
- package/dist/commands/CommandBuilder.d.ts +278 -0
- package/dist/commands/CommandBuilder.js +687 -0
- package/dist/commands/ContextMenuCommandBuilder.d.ts +94 -0
- package/dist/commands/ContextMenuCommandBuilder.js +145 -0
- package/dist/core/http/DiscordRestClient.d.ts +400 -0
- package/dist/core/http/DiscordRestClient.js +988 -0
- package/dist/core/interactions/InteractionContext.d.ts +33 -0
- package/dist/core/interactions/InteractionContext.js +61 -0
- package/dist/core/interactions/InteractionVerifier.d.ts +8 -0
- package/dist/core/interactions/InteractionVerifier.js +9 -0
- package/dist/core/messages/DiscordSentMessage.d.ts +32 -0
- package/dist/core/messages/DiscordSentMessage.js +64 -0
- package/dist/core/messages/message-payloads.d.ts +94 -0
- package/dist/core/messages/message-payloads.js +99 -0
- package/dist/core/webhooks/DiscordWebhook.d.ts +14 -0
- package/dist/core/webhooks/DiscordWebhook.js +69 -0
- package/dist/database/MiniDataBuilder.d.ts +61 -0
- package/dist/database/MiniDataBuilder.js +98 -0
- package/dist/database/MiniDatabase.d.ts +67 -0
- package/dist/database/MiniDatabase.js +222 -0
- package/dist/database/MiniDatabaseBuilder.d.ts +58 -0
- package/dist/database/MiniDatabaseBuilder.js +84 -0
- package/dist/database/index.d.ts +5 -0
- package/dist/database/index.js +3 -0
- package/dist/identity/ApplicationIdentityProfile.d.ts +188 -0
- package/dist/identity/ApplicationIdentityProfile.js +207 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +34 -0
- package/dist/lobby/Lobby.d.ts +150 -0
- package/dist/lobby/Lobby.js +90 -0
- package/dist/node/MiniInteraction.d.ts +199 -0
- package/dist/node/MiniInteraction.js +861 -0
- package/dist/node/index.d.ts +2 -0
- package/dist/node/index.js +1 -0
- package/dist/oauth2/DiscordOAuth.d.ts +49 -0
- package/dist/oauth2/DiscordOAuth.js +113 -0
- package/dist/oauth2/OAuth2Builder.d.ts +296 -0
- package/dist/oauth2/OAuth2Builder.js +435 -0
- package/dist/oauth2/OAuth2Scopes.d.ts +285 -0
- package/dist/oauth2/OAuth2Scopes.js +438 -0
- package/dist/oauth2/OAuthTokenStorage.d.ts +37 -0
- package/dist/oauth2/OAuthTokenStorage.js +109 -0
- package/dist/oauth2/index.d.ts +8 -0
- package/dist/oauth2/index.js +4 -0
- package/dist/router/AutocompleteContext.d.ts +36 -0
- package/dist/router/AutocompleteContext.js +82 -0
- package/dist/router/InteractionRouter.d.ts +82 -0
- package/dist/router/InteractionRouter.js +225 -0
- package/dist/types/ButtonStyle.d.ts +16 -0
- package/dist/types/ButtonStyle.js +17 -0
- package/dist/types/ChannelType.d.ts +2 -0
- package/dist/types/ChannelType.js +2 -0
- package/dist/types/Commands.d.ts +35 -0
- package/dist/types/Commands.js +1 -0
- package/dist/types/ComponentTypes.d.ts +19 -0
- package/dist/types/ComponentTypes.js +1 -0
- package/dist/types/InteractionFlags.d.ts +5 -0
- package/dist/types/InteractionFlags.js +6 -0
- package/dist/types/PermissionFlags.d.ts +56 -0
- package/dist/types/PermissionFlags.js +5 -0
- package/dist/types/RoleConnectionMetadata.d.ts +14 -0
- package/dist/types/RoleConnectionMetadata.js +1 -0
- package/dist/types/RoleConnectionMetadataTypes.d.ts +11 -0
- package/dist/types/RoleConnectionMetadataTypes.js +12 -0
- package/dist/types/SeparatorSpacingSize.d.ts +2 -0
- package/dist/types/SeparatorSpacingSize.js +2 -0
- package/dist/types/checkbox.d.ts +16 -0
- package/dist/types/checkbox.js +12 -0
- package/dist/types/discord.d.ts +2 -0
- package/dist/types/discord.js +1 -0
- package/dist/types/radio.d.ts +12 -0
- package/dist/types/radio.js +10 -0
- package/dist/types/validation.d.ts +14 -0
- package/dist/types/validation.js +40 -0
- package/dist/utils/CommandInteractionOptions.d.ts +66 -0
- package/dist/utils/CommandInteractionOptions.js +364 -0
- package/dist/utils/ContextMenuInteraction.d.ts +76 -0
- package/dist/utils/ContextMenuInteraction.js +152 -0
- package/dist/utils/MessageComponentInteraction.d.ts +148 -0
- package/dist/utils/MessageComponentInteraction.js +259 -0
- package/dist/utils/ModalSubmitInteraction.d.ts +86 -0
- package/dist/utils/ModalSubmitInteraction.js +267 -0
- package/dist/utils/cdn.d.ts +30 -0
- package/dist/utils/cdn.js +60 -0
- package/dist/utils/formatting.d.ts +76 -0
- package/dist/utils/formatting.js +132 -0
- package/dist/utils/interactionMessageHelpers.d.ts +40 -0
- package/dist/utils/interactionMessageHelpers.js +118 -0
- package/dist/utils/localization.d.ts +25 -0
- package/dist/utils/localization.js +38 -0
- package/dist/utils/snowflake.d.ts +19 -0
- package/dist/utils/snowflake.js +32 -0
- package/dist/webhooks/WebhookEvent.d.ts +229 -0
- package/dist/webhooks/WebhookEvent.js +59 -0
- package/dist/webhooks/WebhookEventRouter.d.ts +123 -0
- package/dist/webhooks/WebhookEventRouter.js +160 -0
- package/dist/webhooks/WebhookEventVerifier.d.ts +33 -0
- package/dist/webhooks/WebhookEventVerifier.js +37 -0
- package/dist/webhooks/index.d.ts +6 -0
- package/dist/webhooks/index.js +3 -0
- package/package.json +93 -4
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every OAuth2 scope Discord supports, with human-readable descriptions for
|
|
3
|
+
* rendering a consent screen.
|
|
4
|
+
*
|
|
5
|
+
* @see {@link https://docs.discord.com/developers/topics/oauth2#shared-resources-oauth2-scopes}
|
|
6
|
+
* @see {@link https://docs.discord.com/developers/discord-social-sdk/core-concepts/oauth2-scopes}
|
|
7
|
+
*
|
|
8
|
+
* Scopes are added only when you need them: requesting capabilities a feature
|
|
9
|
+
* does not use measurably increases the number of users who abandon the link
|
|
10
|
+
* flow.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* The scope registry. Use the values (not the keys) when building an
|
|
14
|
+
* authorization URL, and pass them to `OAuth2Builder.addScopes`.
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* new OAuth2Builder({ clientId })
|
|
18
|
+
* .addScopes(OAuth2Scope.Identify, OAuth2Scope.Email)
|
|
19
|
+
* .toURL();
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare const OAuth2Scope: {
|
|
23
|
+
/**
|
|
24
|
+
* `identify` — read the user's basic profile through `/users/@me` (id,
|
|
25
|
+
* username, avatar, flags) **without** email.
|
|
26
|
+
*
|
|
27
|
+
* The safest baseline: every user-facing flow should request at least this.
|
|
28
|
+
*/
|
|
29
|
+
readonly Identify: "identify";
|
|
30
|
+
/**
|
|
31
|
+
* `identify.premium` — read the user's Nitro subscription type (`premium_type`
|
|
32
|
+
* on the user object).
|
|
33
|
+
*
|
|
34
|
+
* Only available to approved partners.
|
|
35
|
+
*/
|
|
36
|
+
readonly IdentifyPremium: "identify.premium";
|
|
37
|
+
/** `email` — makes `/users/@me` return the user's verified email address. */
|
|
38
|
+
readonly Email: "email";
|
|
39
|
+
/** `connections` — read the user's linked third-party accounts via `/users/@me/connections`. */
|
|
40
|
+
readonly Connections: "connections";
|
|
41
|
+
/** `guilds` — list the user's servers (`/users/@me/guilds`), names and icons included. */
|
|
42
|
+
readonly Guilds: "guilds";
|
|
43
|
+
/**
|
|
44
|
+
* `guilds.join` — add the user to a server with
|
|
45
|
+
* `PUT /guilds/{guild.id}/members/{user.id}`.
|
|
46
|
+
*
|
|
47
|
+
* Your bot must already be in that server.
|
|
48
|
+
*/
|
|
49
|
+
readonly GuildsJoin: "guilds.join";
|
|
50
|
+
/** `guilds.members.read` — read the user's own member record in a guild (nickname, roles, join date). */
|
|
51
|
+
readonly GuildsMembersRead: "guilds.members.read";
|
|
52
|
+
/** `applications.builds.read` — read build data for the user's applications. */
|
|
53
|
+
readonly ApplicationsBuildsRead: "applications.builds.read";
|
|
54
|
+
/**
|
|
55
|
+
* `applications.builds.upload` — upload or update builds for the user's
|
|
56
|
+
* applications. Only available to approved partners.
|
|
57
|
+
*/
|
|
58
|
+
readonly ApplicationsBuildsUpload: "applications.builds.upload";
|
|
59
|
+
/**
|
|
60
|
+
* `applications.commands` — add application commands to a guild.
|
|
61
|
+
*
|
|
62
|
+
* Included automatically when the `bot` scope is requested; list it
|
|
63
|
+
* explicitly only for a command-only install with no bot user.
|
|
64
|
+
*/
|
|
65
|
+
readonly ApplicationsCommands: "applications.commands";
|
|
66
|
+
/**
|
|
67
|
+
* `applications.commands.update` — let the app update its own commands with a
|
|
68
|
+
* Bearer token.
|
|
69
|
+
*
|
|
70
|
+
* Client-credentials grant only. Also one of the two scopes a **team-owned**
|
|
71
|
+
* application may request without a user context.
|
|
72
|
+
*/
|
|
73
|
+
readonly ApplicationsCommandsUpdate: "applications.commands.update";
|
|
74
|
+
/**
|
|
75
|
+
* `applications.commands.permissions.update` — update command permissions in
|
|
76
|
+
* a guild the user is allowed to manage.
|
|
77
|
+
*/
|
|
78
|
+
readonly ApplicationsCommandsPermissionsUpdate: "applications.commands.permissions.update";
|
|
79
|
+
/** `applications.entitlements` — read the user's entitlements (SKU grants, purchases). */
|
|
80
|
+
readonly ApplicationsEntitlements: "applications.entitlements";
|
|
81
|
+
/** `applications.store.update` — read and update store data (SKUs, listings, achievements) for the user's applications. */
|
|
82
|
+
readonly ApplicationsStoreUpdate: "applications.store.update";
|
|
83
|
+
/**
|
|
84
|
+
* `bot` — the bot-authorization flow: puts the bot in the user's selected
|
|
85
|
+
* server by default and implicitly grants `applications.commands`.
|
|
86
|
+
*
|
|
87
|
+
* A passthrough scope, so authorization is always re-confirmed even when
|
|
88
|
+
* `prompt=none`.
|
|
89
|
+
*/
|
|
90
|
+
readonly Bot: "bot";
|
|
91
|
+
/**
|
|
92
|
+
* `webhook.incoming` — creates a webhook in a channel the user picks, returned
|
|
93
|
+
* in the token response.
|
|
94
|
+
*
|
|
95
|
+
* A passthrough scope, so authorization is always re-confirmed even when
|
|
96
|
+
* `prompt=none`. Still needs a `redirect_uri` to receive the code back.
|
|
97
|
+
*/
|
|
98
|
+
readonly WebhookIncoming: "webhook.incoming";
|
|
99
|
+
/** `messages.read` — read messages from all client channels through the local RPC server. */
|
|
100
|
+
readonly MessagesRead: "messages.read";
|
|
101
|
+
/**
|
|
102
|
+
* `dm_channels.read` — see the user's DMs and group DMs.
|
|
103
|
+
*
|
|
104
|
+
* Only available to approved partners.
|
|
105
|
+
*/
|
|
106
|
+
readonly DmChannelsRead: "dm_channels.read";
|
|
107
|
+
/** `gdm.join` — add the user to a group DM. */
|
|
108
|
+
readonly GdmJoin: "gdm.join";
|
|
109
|
+
/**
|
|
110
|
+
* `relationships.read` — read the user's friends list, pending requests and
|
|
111
|
+
* blocks.
|
|
112
|
+
*
|
|
113
|
+
* Part of the Social SDK; requires an access request, and the Social SDK
|
|
114
|
+
* terms apply to the data you receive. Pair it with
|
|
115
|
+
* {@link OAuth2Scope.SdkSocialLayerPresence} for a friends list.
|
|
116
|
+
*/
|
|
117
|
+
readonly RelationshipsRead: "relationships.read";
|
|
118
|
+
/**
|
|
119
|
+
* `rpc` — control the user's local Discord client over the RPC server.
|
|
120
|
+
*
|
|
121
|
+
* Only available to approved partners.
|
|
122
|
+
*/
|
|
123
|
+
readonly Rpc: "rpc";
|
|
124
|
+
/** `rpc.activities.write` — update the user's activity over RPC. Approved partners only. */
|
|
125
|
+
readonly RpcActivitiesWrite: "rpc.activities.write";
|
|
126
|
+
/** `rpc.notifications.read` — receive the user's pushed notifications over RPC. Approved partners only. */
|
|
127
|
+
readonly RpcNotificationsRead: "rpc.notifications.read";
|
|
128
|
+
/** `rpc.voice.read` — read voice settings and listen to voice events over RPC. Approved partners only. */
|
|
129
|
+
readonly RpcVoiceRead: "rpc.voice.read";
|
|
130
|
+
/** `rpc.voice.write` — update voice settings over RPC. Approved partners only. */
|
|
131
|
+
readonly RpcVoiceWrite: "rpc.voice.write";
|
|
132
|
+
/**
|
|
133
|
+
* `voice` — connect to voice on the user's behalf and see every voice member.
|
|
134
|
+
*
|
|
135
|
+
* Only available to approved partners.
|
|
136
|
+
*/
|
|
137
|
+
readonly Voice: "voice";
|
|
138
|
+
/**
|
|
139
|
+
* `activities.read` — read the user's "Now Playing / Recently Played" list.
|
|
140
|
+
*
|
|
141
|
+
* Not currently available to applications.
|
|
142
|
+
*/
|
|
143
|
+
readonly ActivitiesRead: "activities.read";
|
|
144
|
+
/**
|
|
145
|
+
* `activities.write` — update the user's activity.
|
|
146
|
+
*
|
|
147
|
+
* Not currently available to applications, and **not** required for the Game
|
|
148
|
+
* SDK activity manager.
|
|
149
|
+
*/
|
|
150
|
+
readonly ActivitiesWrite: "activities.write";
|
|
151
|
+
/**
|
|
152
|
+
* `openid` — the OpenID Connect identifier claim.
|
|
153
|
+
*
|
|
154
|
+
* Always part of the Social SDK's default scope sets; request it alongside
|
|
155
|
+
* {@link OAuth2Scope.SdkSocialLayer} or
|
|
156
|
+
* {@link OAuth2Scope.SdkSocialLayerPresence} rather than on its own.
|
|
157
|
+
*/
|
|
158
|
+
readonly OpenId: "openid";
|
|
159
|
+
/**
|
|
160
|
+
* `sdk.social_layer` — full Discord Social SDK access: account linking,
|
|
161
|
+
* provisional accounts, relationships, presence **and** the limited-access
|
|
162
|
+
* communication features (messaging, lobbies and in-game chat, and
|
|
163
|
+
* **[Linked Channels]**).
|
|
164
|
+
*
|
|
165
|
+
* Implies {@link OAuth2Scope.SdkSocialLayerPresence}. Subject to limited
|
|
166
|
+
* access; see {@link RestrictedOAuth2Scopes}.
|
|
167
|
+
*
|
|
168
|
+
* [Linked Channels]: https://docs.discord.com/developers/discord-social-sdk/development-guides/linked-channels
|
|
169
|
+
*/
|
|
170
|
+
readonly SdkSocialLayer: "sdk.social_layer";
|
|
171
|
+
/**
|
|
172
|
+
* `sdk.social_layer_presence` — the Social SDK's default presence set:
|
|
173
|
+
* account linking, provisional accounts, the friend system and rich presence.
|
|
174
|
+
*
|
|
175
|
+
* Does **not** unlock any communication or Linked Channel feature.
|
|
176
|
+
*/
|
|
177
|
+
readonly SdkSocialLayerPresence: "sdk.social_layer_presence";
|
|
178
|
+
/**
|
|
179
|
+
* `role_connections.write` — update a user's connection and metadata for your
|
|
180
|
+
* app, i.e. the platform that renders a linked role on their profile.
|
|
181
|
+
*
|
|
182
|
+
* **Only usable with the authorization code grant** — Discord rejects it on
|
|
183
|
+
* the implicit grant.
|
|
184
|
+
*/
|
|
185
|
+
readonly RoleConnectionsWrite: "role_connections.write";
|
|
186
|
+
};
|
|
187
|
+
/** Any Discord OAuth2 scope name. */
|
|
188
|
+
export type OAuth2Scope = (typeof OAuth2Scope)[keyof typeof OAuth2Scope];
|
|
189
|
+
/** Grouping used to lay out a consent screen; not a Discord concept. */
|
|
190
|
+
export type OAuth2ScopeCategory = "identity" | "applications" | "bot" | "messaging" | "rpc" | "social-sdk" | "verification";
|
|
191
|
+
export type OAuth2ScopeMetadata = {
|
|
192
|
+
/** One-sentence explanation of what the scope lets the app do. */
|
|
193
|
+
description: string;
|
|
194
|
+
/** Suggested consent-screen grouping. */
|
|
195
|
+
category: OAuth2ScopeCategory;
|
|
196
|
+
/**
|
|
197
|
+
* Requires explicit approval from Discord (or a Social SDK access request)
|
|
198
|
+
* before the flow works. Requesting these without approval causes errors or
|
|
199
|
+
* undocumented behaviour.
|
|
200
|
+
*/
|
|
201
|
+
restricted?: boolean;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Runtime metadata for every scope: the same descriptions as the JSDoc above,
|
|
205
|
+
* so a UI can render a real consent screen without duplicating the copy.
|
|
206
|
+
*/
|
|
207
|
+
export declare const OAuth2ScopeMetadata: Record<OAuth2Scope, OAuth2ScopeMetadata>;
|
|
208
|
+
/**
|
|
209
|
+
* Scope name to description, for a consent screen that only needs the copy:
|
|
210
|
+
*
|
|
211
|
+
* ```ts
|
|
212
|
+
* OAuth2ScopeDescriptions[OAuth2Scope.GuildsJoin];
|
|
213
|
+
* // "Add you to a server."
|
|
214
|
+
* ```
|
|
215
|
+
*
|
|
216
|
+
* Prefer {@link OAuth2ScopeMetadata} when you also want the category or the
|
|
217
|
+
* restricted flag.
|
|
218
|
+
*/
|
|
219
|
+
export declare const OAuth2ScopeDescriptions: Record<OAuth2Scope, string>;
|
|
220
|
+
/**
|
|
221
|
+
* Scopes Discord only grants after an approval request (or, for the Social SDK,
|
|
222
|
+
* an access request). Requesting them without approval can fail the flow or
|
|
223
|
+
* behave unpredictably.
|
|
224
|
+
*/
|
|
225
|
+
export declare const RestrictedOAuth2Scopes: ReadonlySet<OAuth2Scope>;
|
|
226
|
+
/** Scopes grouped by category, in a stable order, for rendering a consent screen. */
|
|
227
|
+
export declare const OAuth2ScopeCategories: Record<OAuth2ScopeCategory, OAuth2Scope[]>;
|
|
228
|
+
/**
|
|
229
|
+
* Ready-made scope sets for the common flows.
|
|
230
|
+
*
|
|
231
|
+
* `Communication` is the one Linked Channels needs — see
|
|
232
|
+
* {@link https://docs.discord.com/developers/discord-social-sdk/core-concepts/oauth2-scopes}
|
|
233
|
+
*/
|
|
234
|
+
export declare const OAuth2ScopePresets: {
|
|
235
|
+
/** `identify` only: the smallest request that still identifies the user. */
|
|
236
|
+
readonly Minimal: readonly ["identify"];
|
|
237
|
+
/** `identify email`: the usual "sign in with Discord". */
|
|
238
|
+
readonly SignIn: readonly ["identify", "email"];
|
|
239
|
+
/** `identify guilds`: sign-in plus the user's server list. */
|
|
240
|
+
readonly SignInWithGuilds: readonly ["identify", "email", "guilds"];
|
|
241
|
+
/**
|
|
242
|
+
* The Social SDK's default `Client::GetDefaultPresenceScopes` — account
|
|
243
|
+
* linking, provisional accounts, friends and rich presence. No messaging.
|
|
244
|
+
*/
|
|
245
|
+
readonly SocialPresence: readonly ["openid", "sdk.social_layer_presence"];
|
|
246
|
+
/**
|
|
247
|
+
* The Social SDK's `Client::GetDefaultCommunicationScopes` — required for
|
|
248
|
+
* lobbies, in-game chat and **Linked Channels**.
|
|
249
|
+
*/
|
|
250
|
+
readonly SocialCommunication: readonly ["openid", "sdk.social_layer"];
|
|
251
|
+
/** Add the bot, with its commands. */
|
|
252
|
+
readonly Bot: readonly ["bot", "applications.commands"];
|
|
253
|
+
/** Create an incoming webhook in a channel the user picks. */
|
|
254
|
+
readonly Webhook: readonly ["webhook.incoming"];
|
|
255
|
+
/** Linked roles: read the profile and write the connection metadata. */
|
|
256
|
+
readonly RoleConnection: readonly ["identify", "role_connections.write"];
|
|
257
|
+
};
|
|
258
|
+
/** The authorization URL Discord serves the consent screen from. */
|
|
259
|
+
export declare const OAUTH2_AUTHORIZE_URL = "https://discord.com/oauth2/authorize";
|
|
260
|
+
/** The token endpoint, used by the authorization code, refresh and client credentials grants. */
|
|
261
|
+
export declare const OAUTH2_TOKEN_URL = "https://discord.com/api/oauth2/token";
|
|
262
|
+
/** The token revocation endpoint. */
|
|
263
|
+
export declare const OAUTH2_REVOKE_URL = "https://discord.com/api/oauth2/token/revoke";
|
|
264
|
+
/** `GET` this with a Bearer token to learn what the token may actually do. */
|
|
265
|
+
export declare const OAUTH2_ME_URL = "https://discord.com/api/oauth2/@me";
|
|
266
|
+
/** Whether a string is a scope Discord documents support for. */
|
|
267
|
+
export declare function isOAuth2Scope(value: string): value is OAuth2Scope;
|
|
268
|
+
/**
|
|
269
|
+
* Descriptions for a set of scopes, ready to render as a consent list:
|
|
270
|
+
*
|
|
271
|
+
* ```ts
|
|
272
|
+
* describeOAuth2Scopes(OAuth2ScopePresets.SignIn);
|
|
273
|
+
* // [{ scope: "identify", description: "…" }, …]
|
|
274
|
+
* ```
|
|
275
|
+
*
|
|
276
|
+
* Unknown scope names are included with a `undefined` description rather than
|
|
277
|
+
* dropped, so a typo stays visible.
|
|
278
|
+
*/
|
|
279
|
+
export declare function describeOAuth2Scopes(scopes: Iterable<string>): {
|
|
280
|
+
scope: string;
|
|
281
|
+
description: string | undefined;
|
|
282
|
+
restricted: boolean;
|
|
283
|
+
}[];
|
|
284
|
+
/** Whether any of the given scopes needs Discord's approval before use. */
|
|
285
|
+
export declare function requiresOAuth2ScopeApproval(scopes: Iterable<string>): boolean;
|