seyfert 2.1.1-dev-11566750568.0 → 2.1.1-dev-11635725680.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.
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seyfert",
3
- "version": "2.1.1-dev-11566750568.0",
3
+ "version": "2.1.1-dev-11635725680.0",
4
4
  "description": "The most advanced framework for discord bots",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",