@discordjs/builders 0.14.0-dev.1652400688-aed687b → 0.14.0-dev.1652443433-d522320
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 +75 -5
- package/dist/index.js +55 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _sapphire_shapeshift from '@sapphire/shapeshift';
|
|
2
|
-
import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, APIActionRowComponentTypes, APIActionRowComponent, APIBaseComponent, ComponentType, APIMessageActionRowComponent, APIModalActionRowComponent, APIButtonComponent, APIMessageComponent, APIModalComponent, APITextInputComponent, TextInputStyle, APIModalInteractionResponseCallbackData, APISelectMenuComponent, LocalizationMap, LocaleString, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandAttachmentOption, APIApplicationCommandBooleanOption, ChannelType, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, RESTPostAPIApplicationCommandsJSONBody, APIApplicationCommandOption, Locale, ApplicationCommandType } from 'discord-api-types/v10';
|
|
2
|
+
import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, APIActionRowComponentTypes, APIActionRowComponent, APIBaseComponent, ComponentType, APIMessageActionRowComponent, APIModalActionRowComponent, APIButtonComponent, APIMessageComponent, APIModalComponent, APITextInputComponent, TextInputStyle, APIModalInteractionResponseCallbackData, APISelectMenuComponent, LocalizationMap, LocaleString, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandAttachmentOption, APIApplicationCommandBooleanOption, ChannelType, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, RESTPostAPIApplicationCommandsJSONBody, APIApplicationCommandOption, Locale, Permissions as Permissions$1, ApplicationCommandType } from 'discord-api-types/v10';
|
|
3
3
|
import { URL } from 'url';
|
|
4
4
|
import { Snowflake } from 'discord-api-types/globals';
|
|
5
5
|
|
|
@@ -1148,9 +1148,19 @@ declare class SlashCommandBuilder {
|
|
|
1148
1148
|
/**
|
|
1149
1149
|
* Whether the command is enabled by default when the app is added to a guild
|
|
1150
1150
|
*
|
|
1151
|
-
* @
|
|
1151
|
+
* @deprecated This property is deprecated and will be removed in the future.
|
|
1152
|
+
* You should use `setDefaultMemberPermissions` or `setDMPermission` instead.
|
|
1152
1153
|
*/
|
|
1153
|
-
readonly
|
|
1154
|
+
readonly default_permission: boolean | undefined;
|
|
1155
|
+
/**
|
|
1156
|
+
* Set of permissions represented as a bit set for the command
|
|
1157
|
+
*/
|
|
1158
|
+
readonly default_member_permissions: Permissions | null | undefined;
|
|
1159
|
+
/**
|
|
1160
|
+
* Indicates whether the command is available in DMs with the application, only for globally-scoped commands.
|
|
1161
|
+
* By default, commands are visible.
|
|
1162
|
+
*/
|
|
1163
|
+
readonly dm_permission: boolean | null | undefined;
|
|
1154
1164
|
/**
|
|
1155
1165
|
* Returns the final data that should be sent to Discord.
|
|
1156
1166
|
*
|
|
@@ -1165,8 +1175,28 @@ declare class SlashCommandBuilder {
|
|
|
1165
1175
|
* @param value Whether or not to enable this command by default
|
|
1166
1176
|
*
|
|
1167
1177
|
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
1178
|
+
* @deprecated Use `setDefaultMemberPermissions` or `setDMPermission` instead.
|
|
1168
1179
|
*/
|
|
1169
1180
|
setDefaultPermission(value: boolean): this;
|
|
1181
|
+
/**
|
|
1182
|
+
* Sets the default permissions a member should have in order to run the command.
|
|
1183
|
+
*
|
|
1184
|
+
* **Note:** You can set this to `'0'` to disable the command by default.
|
|
1185
|
+
*
|
|
1186
|
+
* @param permissions The permissions bit field to set
|
|
1187
|
+
*
|
|
1188
|
+
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
1189
|
+
*/
|
|
1190
|
+
setDefaultMemberPermissions(permissions: Permissions | null | undefined): this;
|
|
1191
|
+
/**
|
|
1192
|
+
* Sets if the command is available in DMs with the application, only for globally-scoped commands.
|
|
1193
|
+
* By default, commands are visible.
|
|
1194
|
+
*
|
|
1195
|
+
* @param enabled If the command should be enabled in DMs
|
|
1196
|
+
*
|
|
1197
|
+
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
1198
|
+
*/
|
|
1199
|
+
setDMPermission(enabled: boolean | null | undefined): this;
|
|
1170
1200
|
/**
|
|
1171
1201
|
* Adds a new subcommand group to this command
|
|
1172
1202
|
*
|
|
@@ -1232,6 +1262,8 @@ declare const localizationMapPredicate: _sapphire_shapeshift.UnionValidator<{
|
|
|
1232
1262
|
vi: string | null;
|
|
1233
1263
|
} | null | undefined>;
|
|
1234
1264
|
declare function validateLocalizationMap(value: unknown): asserts value is LocalizationMap;
|
|
1265
|
+
declare function validateDMPermission$1(value: unknown): asserts value is boolean | null | undefined;
|
|
1266
|
+
declare function validateDefaultMemberPermissions$1(permissions: unknown): string | null | undefined;
|
|
1235
1267
|
|
|
1236
1268
|
declare const Assertions$1_validateDescription: typeof validateDescription;
|
|
1237
1269
|
declare const Assertions$1_validateLocale: typeof validateLocale;
|
|
@@ -1254,6 +1286,8 @@ declare namespace Assertions$1 {
|
|
|
1254
1286
|
Assertions$1_assertReturnOfBuilder as assertReturnOfBuilder,
|
|
1255
1287
|
Assertions$1_localizationMapPredicate as localizationMapPredicate,
|
|
1256
1288
|
Assertions$1_validateLocalizationMap as validateLocalizationMap,
|
|
1289
|
+
validateDMPermission$1 as validateDMPermission,
|
|
1290
|
+
validateDefaultMemberPermissions$1 as validateDefaultMemberPermissions,
|
|
1257
1291
|
};
|
|
1258
1292
|
}
|
|
1259
1293
|
|
|
@@ -1273,9 +1307,19 @@ declare class ContextMenuCommandBuilder {
|
|
|
1273
1307
|
/**
|
|
1274
1308
|
* Whether the command is enabled by default when the app is added to a guild
|
|
1275
1309
|
*
|
|
1276
|
-
* @
|
|
1310
|
+
* @deprecated This property is deprecated and will be removed in the future.
|
|
1311
|
+
* You should use `setDefaultMemberPermissions` or `setDMPermission` instead.
|
|
1277
1312
|
*/
|
|
1278
|
-
readonly
|
|
1313
|
+
readonly default_permission: boolean | undefined;
|
|
1314
|
+
/**
|
|
1315
|
+
* Set of permissions represented as a bit set for the command
|
|
1316
|
+
*/
|
|
1317
|
+
readonly default_member_permissions: Permissions$1 | null | undefined;
|
|
1318
|
+
/**
|
|
1319
|
+
* Indicates whether the command is available in DMs with the application, only for globally-scoped commands.
|
|
1320
|
+
* By default, commands are visible.
|
|
1321
|
+
*/
|
|
1322
|
+
readonly dm_permission: boolean | null | undefined;
|
|
1279
1323
|
/**
|
|
1280
1324
|
* Sets the name
|
|
1281
1325
|
*
|
|
@@ -1296,8 +1340,28 @@ declare class ContextMenuCommandBuilder {
|
|
|
1296
1340
|
* @param value Whether or not to enable this command by default
|
|
1297
1341
|
*
|
|
1298
1342
|
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
1343
|
+
* @deprecated Use `setDefaultMemberPermissions` or `setDMPermission` instead.
|
|
1299
1344
|
*/
|
|
1300
1345
|
setDefaultPermission(value: boolean): this;
|
|
1346
|
+
/**
|
|
1347
|
+
* Sets the default permissions a member should have in order to run the command.
|
|
1348
|
+
*
|
|
1349
|
+
* **Note:** You can set this to `'0'` to disable the command by default.
|
|
1350
|
+
*
|
|
1351
|
+
* @param permissions The permissions bit field to set
|
|
1352
|
+
*
|
|
1353
|
+
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
1354
|
+
*/
|
|
1355
|
+
setDefaultMemberPermissions(permissions: Permissions$1 | null | undefined): this;
|
|
1356
|
+
/**
|
|
1357
|
+
* Sets if the command is available in DMs with the application, only for globally-scoped commands.
|
|
1358
|
+
* By default, commands are visible.
|
|
1359
|
+
*
|
|
1360
|
+
* @param enabled If the command should be enabled in DMs
|
|
1361
|
+
*
|
|
1362
|
+
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
1363
|
+
*/
|
|
1364
|
+
setDMPermission(enabled: boolean | null | undefined): this;
|
|
1301
1365
|
/**
|
|
1302
1366
|
* Sets a name localization
|
|
1303
1367
|
*
|
|
@@ -1324,17 +1388,23 @@ declare function validateDefaultPermission(value: unknown): asserts value is boo
|
|
|
1324
1388
|
declare function validateName(name: unknown): asserts name is string;
|
|
1325
1389
|
declare function validateType(type: unknown): asserts type is ContextMenuCommandType;
|
|
1326
1390
|
declare function validateRequiredParameters(name: string, type: number): void;
|
|
1391
|
+
declare function validateDMPermission(value: unknown): asserts value is boolean | null | undefined;
|
|
1392
|
+
declare function validateDefaultMemberPermissions(permissions: unknown): string | null | undefined;
|
|
1327
1393
|
|
|
1328
1394
|
declare const Assertions_validateDefaultPermission: typeof validateDefaultPermission;
|
|
1329
1395
|
declare const Assertions_validateName: typeof validateName;
|
|
1330
1396
|
declare const Assertions_validateType: typeof validateType;
|
|
1331
1397
|
declare const Assertions_validateRequiredParameters: typeof validateRequiredParameters;
|
|
1398
|
+
declare const Assertions_validateDMPermission: typeof validateDMPermission;
|
|
1399
|
+
declare const Assertions_validateDefaultMemberPermissions: typeof validateDefaultMemberPermissions;
|
|
1332
1400
|
declare namespace Assertions {
|
|
1333
1401
|
export {
|
|
1334
1402
|
Assertions_validateDefaultPermission as validateDefaultPermission,
|
|
1335
1403
|
Assertions_validateName as validateName,
|
|
1336
1404
|
Assertions_validateType as validateType,
|
|
1337
1405
|
Assertions_validateRequiredParameters as validateRequiredParameters,
|
|
1406
|
+
Assertions_validateDMPermission as validateDMPermission,
|
|
1407
|
+
Assertions_validateDefaultMemberPermissions as validateDefaultMemberPermissions,
|
|
1338
1408
|
};
|
|
1339
1409
|
}
|
|
1340
1410
|
|
package/dist/index.js
CHANGED
|
@@ -878,6 +878,8 @@ __export(Assertions_exports5, {
|
|
|
878
878
|
assertReturnOfBuilder: () => assertReturnOfBuilder,
|
|
879
879
|
localizationMapPredicate: () => localizationMapPredicate,
|
|
880
880
|
validateChoicesLength: () => validateChoicesLength,
|
|
881
|
+
validateDMPermission: () => validateDMPermission,
|
|
882
|
+
validateDefaultMemberPermissions: () => validateDefaultMemberPermissions,
|
|
881
883
|
validateDefaultPermission: () => validateDefaultPermission,
|
|
882
884
|
validateDescription: () => validateDescription,
|
|
883
885
|
validateLocale: () => validateLocale,
|
|
@@ -952,6 +954,16 @@ function validateLocalizationMap(value) {
|
|
|
952
954
|
localizationMapPredicate.parse(value);
|
|
953
955
|
}
|
|
954
956
|
__name(validateLocalizationMap, "validateLocalizationMap");
|
|
957
|
+
var dmPermissionPredicate = import_shapeshift5.s.boolean.nullish;
|
|
958
|
+
function validateDMPermission(value) {
|
|
959
|
+
dmPermissionPredicate.parse(value);
|
|
960
|
+
}
|
|
961
|
+
__name(validateDMPermission, "validateDMPermission");
|
|
962
|
+
var memberPermissionPredicate = import_shapeshift5.s.union(import_shapeshift5.s.bigint.transform((value) => value.toString()), import_shapeshift5.s.number.safeInt.transform((value) => value.toString()), import_shapeshift5.s.string.regex(/^\d+$/)).nullish;
|
|
963
|
+
function validateDefaultMemberPermissions(permissions) {
|
|
964
|
+
return memberPermissionPredicate.parse(permissions);
|
|
965
|
+
}
|
|
966
|
+
__name(validateDefaultMemberPermissions, "validateDefaultMemberPermissions");
|
|
955
967
|
|
|
956
968
|
// src/interactions/slashCommands/SlashCommandBuilder.ts
|
|
957
969
|
var import_ts_mixer6 = require("ts-mixer");
|
|
@@ -1424,24 +1436,32 @@ var SlashCommandBuilder = class {
|
|
|
1424
1436
|
__publicField(this, "description");
|
|
1425
1437
|
__publicField(this, "description_localizations");
|
|
1426
1438
|
__publicField(this, "options", []);
|
|
1427
|
-
__publicField(this, "
|
|
1439
|
+
__publicField(this, "default_permission");
|
|
1440
|
+
__publicField(this, "default_member_permissions");
|
|
1441
|
+
__publicField(this, "dm_permission");
|
|
1428
1442
|
}
|
|
1429
1443
|
toJSON() {
|
|
1430
1444
|
validateRequiredParameters3(this.name, this.description, this.options);
|
|
1431
1445
|
validateLocalizationMap(this.name_localizations);
|
|
1432
1446
|
validateLocalizationMap(this.description_localizations);
|
|
1433
1447
|
return {
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
description: this.description,
|
|
1437
|
-
description_localizations: this.description_localizations,
|
|
1438
|
-
options: this.options.map((option) => option.toJSON()),
|
|
1439
|
-
default_permission: this.defaultPermission
|
|
1448
|
+
...this,
|
|
1449
|
+
options: this.options.map((option) => option.toJSON())
|
|
1440
1450
|
};
|
|
1441
1451
|
}
|
|
1442
1452
|
setDefaultPermission(value) {
|
|
1443
1453
|
validateDefaultPermission(value);
|
|
1444
|
-
Reflect.set(this, "
|
|
1454
|
+
Reflect.set(this, "default_permission", value);
|
|
1455
|
+
return this;
|
|
1456
|
+
}
|
|
1457
|
+
setDefaultMemberPermissions(permissions) {
|
|
1458
|
+
const permissionValue = validateDefaultMemberPermissions(permissions);
|
|
1459
|
+
Reflect.set(this, "default_member_permissions", permissionValue);
|
|
1460
|
+
return this;
|
|
1461
|
+
}
|
|
1462
|
+
setDMPermission(enabled) {
|
|
1463
|
+
validateDMPermission(enabled);
|
|
1464
|
+
Reflect.set(this, "dm_permission", enabled);
|
|
1445
1465
|
return this;
|
|
1446
1466
|
}
|
|
1447
1467
|
addSubcommandGroup(input) {
|
|
@@ -1469,6 +1489,8 @@ SlashCommandBuilder = __decorateClass([
|
|
|
1469
1489
|
// src/interactions/contextMenuCommands/Assertions.ts
|
|
1470
1490
|
var Assertions_exports6 = {};
|
|
1471
1491
|
__export(Assertions_exports6, {
|
|
1492
|
+
validateDMPermission: () => validateDMPermission2,
|
|
1493
|
+
validateDefaultMemberPermissions: () => validateDefaultMemberPermissions2,
|
|
1472
1494
|
validateDefaultPermission: () => validateDefaultPermission2,
|
|
1473
1495
|
validateName: () => validateName2,
|
|
1474
1496
|
validateRequiredParameters: () => validateRequiredParameters4,
|
|
@@ -1496,6 +1518,16 @@ function validateRequiredParameters4(name, type) {
|
|
|
1496
1518
|
validateType(type);
|
|
1497
1519
|
}
|
|
1498
1520
|
__name(validateRequiredParameters4, "validateRequiredParameters");
|
|
1521
|
+
var dmPermissionPredicate2 = import_shapeshift10.s.boolean.nullish;
|
|
1522
|
+
function validateDMPermission2(value) {
|
|
1523
|
+
dmPermissionPredicate2.parse(value);
|
|
1524
|
+
}
|
|
1525
|
+
__name(validateDMPermission2, "validateDMPermission");
|
|
1526
|
+
var memberPermissionPredicate2 = import_shapeshift10.s.union(import_shapeshift10.s.bigint.transform((value) => value.toString()), import_shapeshift10.s.number.safeInt.transform((value) => value.toString()), import_shapeshift10.s.string.regex(/^\d+$/)).nullish;
|
|
1527
|
+
function validateDefaultMemberPermissions2(permissions) {
|
|
1528
|
+
return memberPermissionPredicate2.parse(permissions);
|
|
1529
|
+
}
|
|
1530
|
+
__name(validateDefaultMemberPermissions2, "validateDefaultMemberPermissions");
|
|
1499
1531
|
|
|
1500
1532
|
// src/interactions/contextMenuCommands/ContextMenuCommandBuilder.ts
|
|
1501
1533
|
var ContextMenuCommandBuilder = class {
|
|
@@ -1503,7 +1535,9 @@ var ContextMenuCommandBuilder = class {
|
|
|
1503
1535
|
__publicField(this, "name");
|
|
1504
1536
|
__publicField(this, "name_localizations");
|
|
1505
1537
|
__publicField(this, "type");
|
|
1506
|
-
__publicField(this, "
|
|
1538
|
+
__publicField(this, "default_permission");
|
|
1539
|
+
__publicField(this, "default_member_permissions");
|
|
1540
|
+
__publicField(this, "dm_permission");
|
|
1507
1541
|
}
|
|
1508
1542
|
setName(name) {
|
|
1509
1543
|
validateName2(name);
|
|
@@ -1517,7 +1551,17 @@ var ContextMenuCommandBuilder = class {
|
|
|
1517
1551
|
}
|
|
1518
1552
|
setDefaultPermission(value) {
|
|
1519
1553
|
validateDefaultPermission2(value);
|
|
1520
|
-
Reflect.set(this, "
|
|
1554
|
+
Reflect.set(this, "default_permission", value);
|
|
1555
|
+
return this;
|
|
1556
|
+
}
|
|
1557
|
+
setDefaultMemberPermissions(permissions) {
|
|
1558
|
+
const permissionValue = validateDefaultMemberPermissions2(permissions);
|
|
1559
|
+
Reflect.set(this, "default_member_permissions", permissionValue);
|
|
1560
|
+
return this;
|
|
1561
|
+
}
|
|
1562
|
+
setDMPermission(enabled) {
|
|
1563
|
+
validateDMPermission2(enabled);
|
|
1564
|
+
Reflect.set(this, "dm_permission", enabled);
|
|
1521
1565
|
return this;
|
|
1522
1566
|
}
|
|
1523
1567
|
setNameLocalization(locale, localizedName) {
|
|
@@ -1545,12 +1589,7 @@ var ContextMenuCommandBuilder = class {
|
|
|
1545
1589
|
toJSON() {
|
|
1546
1590
|
validateRequiredParameters4(this.name, this.type);
|
|
1547
1591
|
validateLocalizationMap(this.name_localizations);
|
|
1548
|
-
return {
|
|
1549
|
-
name: this.name,
|
|
1550
|
-
name_localizations: this.name_localizations,
|
|
1551
|
-
type: this.type,
|
|
1552
|
-
default_permission: this.defaultPermission
|
|
1553
|
-
};
|
|
1592
|
+
return { ...this };
|
|
1554
1593
|
}
|
|
1555
1594
|
};
|
|
1556
1595
|
__name(ContextMenuCommandBuilder, "ContextMenuCommandBuilder");
|