seyfert 2.1.1-dev-11566750568.0 → 2.1.1-dev-11638605397.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/lib/common/it/formatter.d.ts +28 -0
- package/lib/common/it/formatter.js +21 -0
- package/lib/common/it/utils.js +4 -6
- package/lib/types/payloads/_interactions/base.d.ts +1 -1
- package/lib/types/payloads/application.d.ts +1 -1
- package/lib/types/rest/guild.d.ts +1 -1
- package/lib/types/rest/oauth2.d.ts +1 -1
- package/lib/types/rest/user.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
import type { BitFieldResolvable } from '../../structures/extra/BitField';
|
|
2
|
+
import type { OAuth2Scopes, PermissionFlagsBits } from '../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Represents options for creating a OAuth2 uri
|
|
5
|
+
*/
|
|
6
|
+
export type OAuth2URLOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* Oauth2 scopes to be used.
|
|
9
|
+
*/
|
|
10
|
+
scopes: OAuth2Scopes[];
|
|
11
|
+
/**
|
|
12
|
+
* Permissions to be granted to the application.
|
|
13
|
+
*/
|
|
14
|
+
permissions: BitFieldResolvable<typeof PermissionFlagsBits>;
|
|
15
|
+
/**
|
|
16
|
+
* Whether guild select must be disabled in oauth2 interface.
|
|
17
|
+
*/
|
|
18
|
+
disableGuildSelect?: boolean;
|
|
19
|
+
};
|
|
1
20
|
/**
|
|
2
21
|
* Represents heading levels.
|
|
3
22
|
*/
|
|
@@ -183,5 +202,14 @@ export declare const Formatter: {
|
|
|
183
202
|
* @returns The formatted channel link.
|
|
184
203
|
*/
|
|
185
204
|
channelLink(channelId: string, guildId?: string): string;
|
|
205
|
+
/**
|
|
206
|
+
* Forms a oauth2 invite link for the bot.
|
|
207
|
+
* @param applicationId The ID of the application.
|
|
208
|
+
* @param options Options for forming the invite link.
|
|
209
|
+
* @param options.scopes Oauth2 scopes to be used.
|
|
210
|
+
* @param options.disableGuildSelect Whether or not guild select must be disabled in oauth2 interface.
|
|
211
|
+
* @param options.permissions Permissions to be granted to the application.
|
|
212
|
+
*/
|
|
213
|
+
generateOAuth2URL(applicationId: string, { scopes, permissions, disableGuildSelect }: OAuth2URLOptions): string;
|
|
186
214
|
};
|
|
187
215
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Formatter = exports.TimestampStyle = exports.HeadingLevel = void 0;
|
|
4
|
+
const Permissions_1 = require("../../structures/extra/Permissions");
|
|
4
5
|
/**
|
|
5
6
|
* Represents heading levels.
|
|
6
7
|
*/
|
|
@@ -222,4 +223,24 @@ exports.Formatter = {
|
|
|
222
223
|
channelLink(channelId, guildId) {
|
|
223
224
|
return `https://discord.com/channels/${guildId ?? '@me'}/${channelId}`;
|
|
224
225
|
},
|
|
226
|
+
/**
|
|
227
|
+
* Forms a oauth2 invite link for the bot.
|
|
228
|
+
* @param applicationId The ID of the application.
|
|
229
|
+
* @param options Options for forming the invite link.
|
|
230
|
+
* @param options.scopes Oauth2 scopes to be used.
|
|
231
|
+
* @param options.disableGuildSelect Whether or not guild select must be disabled in oauth2 interface.
|
|
232
|
+
* @param options.permissions Permissions to be granted to the application.
|
|
233
|
+
*/
|
|
234
|
+
generateOAuth2URL(applicationId, { scopes, permissions, disableGuildSelect = false }) {
|
|
235
|
+
const queryOptions = new URLSearchParams({
|
|
236
|
+
client_id: applicationId,
|
|
237
|
+
scope: scopes.join(' '),
|
|
238
|
+
disable_guild_select: String(disableGuildSelect),
|
|
239
|
+
});
|
|
240
|
+
if (permissions) {
|
|
241
|
+
permissions = Permissions_1.PermissionsBitField.resolve(permissions);
|
|
242
|
+
queryOptions.set('permissions', permissions.toString());
|
|
243
|
+
}
|
|
244
|
+
return `https://discord.com/oauth2/authorize?${queryOptions.toString()}`;
|
|
245
|
+
},
|
|
225
246
|
};
|
package/lib/common/it/utils.js
CHANGED
|
@@ -258,12 +258,10 @@ exports.ReplaceRegex = {
|
|
|
258
258
|
},
|
|
259
259
|
};
|
|
260
260
|
async function magicImport(path) {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
return eval('((path) => import(`file:///${path}?update=${Date.now()}`))')(path.split('\\').join('\\\\'));
|
|
266
|
-
}
|
|
261
|
+
//@ts-expect-error
|
|
262
|
+
if (typeof require === 'undefined' || globalThis.Deno)
|
|
263
|
+
return new Function('return ((path) => import(`file:///${path}?update=${Date.now()}`))')()(path.split('\\').join('\\\\'));
|
|
264
|
+
return require(path);
|
|
267
265
|
}
|
|
268
266
|
function fakePromise(value) {
|
|
269
267
|
if (value instanceof Promise)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ApplicationIntegrationType, InteractionContextType } from '..';
|
|
2
|
-
import type { ChannelType, Snowflake } from '../..';
|
|
2
|
+
import type { ChannelType, Permissions, Snowflake } from '../..';
|
|
3
3
|
import type { LocaleString } from '../../rest';
|
|
4
4
|
import type { APIAttachment, APIChannel, APIMessage, APIPartialChannel, APIThreadChannel, ThreadChannelType } from '../channel';
|
|
5
5
|
import type { APIGuildMember } from '../guild';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Types extracted from https://discord.com/developers/docs/resources/application
|
|
3
3
|
*/
|
|
4
4
|
import type { LocalizationMap } from '.';
|
|
5
|
-
import type { Snowflake } from '..';
|
|
5
|
+
import type { Permissions, Snowflake } from '..';
|
|
6
6
|
import type { APIPartialGuild } from './guild';
|
|
7
7
|
import type { ApplicationIntegrationType } from './interactions';
|
|
8
8
|
import type { OAuth2Scopes } from './oauth2';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Snowflake } from '..';
|
|
1
|
+
import type { Permissions, Snowflake } from '..';
|
|
2
2
|
import type { APIBan, APIChannel, APIDMChannel, APIExtendedInvite, APIGroupDMChannel, APIGuild, APIGuildIntegration, APIGuildMember, APIGuildMembershipScreening, APIGuildOnboarding, APIGuildOnboardingPrompt, APIGuildOnboardingPromptOption, APIGuildPreview, APIGuildWelcomeScreen, APIGuildWidget, APIGuildWidgetSettings, APIRole, APIThreadList, APIVoiceRegion, GuildDefaultMessageNotifications, GuildExplicitContentFilter, GuildFeature, GuildMFALevel, GuildSystemChannelFlags, GuildVerificationLevel, GuildWidgetStyle } from '../payloads';
|
|
3
3
|
import type { AddUndefinedToPossiblyUndefinedPropertiesOfInterface, DistributiveOmit, DistributivePick, Nullable, StrictPartial, StrictRequired } from '../utils';
|
|
4
4
|
import type { RESTPutAPIChannelPermissionJSONBody } from './channel';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Snowflake } from '..';
|
|
1
|
+
import type { Permissions, Snowflake } from '..';
|
|
2
2
|
import type { APIApplication, APIGuild, APIUser, APIWebhook, OAuth2Scopes } from '../payloads';
|
|
3
3
|
/**
|
|
4
4
|
* https://discord.com/developers/docs/topics/oauth2#get-current-bot-application-information
|
package/lib/types/rest/user.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Snowflake } from '..';
|
|
1
|
+
import type { Permissions, Snowflake } from '..';
|
|
2
2
|
import type { APIApplicationRoleConnection, APIChannel, APIConnection, APIGuildMember, APIUser, GuildFeature } from '../payloads';
|
|
3
3
|
/**
|
|
4
4
|
* https://discord.com/developers/docs/resources/user#get-current-user
|