@discordjs/builders 1.14.0 → 1.15.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/README.md +9 -8
- package/dist/index.d.mts +59 -4
- package/dist/index.d.ts +59 -4
- package/dist/index.js +209 -115
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +209 -113
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -469,6 +469,7 @@ var StringSelectMenuOptionBuilder = class {
|
|
|
469
469
|
constructor(data = {}) {
|
|
470
470
|
this.data = data;
|
|
471
471
|
}
|
|
472
|
+
data;
|
|
472
473
|
static {
|
|
473
474
|
__name(this, "StringSelectMenuOptionBuilder");
|
|
474
475
|
}
|
|
@@ -924,6 +925,7 @@ var CheckboxGroupOptionBuilder = class {
|
|
|
924
925
|
constructor(data = {}) {
|
|
925
926
|
this.data = data;
|
|
926
927
|
}
|
|
928
|
+
data;
|
|
927
929
|
static {
|
|
928
930
|
__name(this, "CheckboxGroupOptionBuilder");
|
|
929
931
|
}
|
|
@@ -1047,7 +1049,7 @@ var CheckboxGroupBuilder = class extends ComponentBuilder {
|
|
|
1047
1049
|
*
|
|
1048
1050
|
* @param options - The options to use
|
|
1049
1051
|
*/
|
|
1050
|
-
setOptions(options) {
|
|
1052
|
+
setOptions(...options) {
|
|
1051
1053
|
return this.spliceOptions(0, this.options.length, ...options);
|
|
1052
1054
|
}
|
|
1053
1055
|
/**
|
|
@@ -1145,6 +1147,7 @@ var RadioGroupOptionBuilder = class {
|
|
|
1145
1147
|
constructor(data = {}) {
|
|
1146
1148
|
this.data = data;
|
|
1147
1149
|
}
|
|
1150
|
+
data;
|
|
1148
1151
|
static {
|
|
1149
1152
|
__name(this, "RadioGroupOptionBuilder");
|
|
1150
1153
|
}
|
|
@@ -1266,7 +1269,7 @@ var RadioGroupBuilder = class extends ComponentBuilder {
|
|
|
1266
1269
|
*
|
|
1267
1270
|
* @param options - The options to use
|
|
1268
1271
|
*/
|
|
1269
|
-
setOptions(options) {
|
|
1272
|
+
setOptions(...options) {
|
|
1270
1273
|
return this.spliceOptions(0, this.options.length, ...options);
|
|
1271
1274
|
}
|
|
1272
1275
|
/**
|
|
@@ -1326,15 +1329,29 @@ var Assertions_exports4 = {};
|
|
|
1326
1329
|
__export(Assertions_exports4, {
|
|
1327
1330
|
fileUploadPredicate: () => fileUploadPredicate
|
|
1328
1331
|
});
|
|
1329
|
-
var
|
|
1332
|
+
var import_shapeshift5 = require("@sapphire/shapeshift");
|
|
1330
1333
|
var import_v107 = require("discord-api-types/v10");
|
|
1331
|
-
|
|
1332
|
-
|
|
1334
|
+
|
|
1335
|
+
// src/util/fileUpload.ts
|
|
1336
|
+
var import_shapeshift4 = require("@sapphire/shapeshift");
|
|
1337
|
+
var fileUploadTypesValidator = import_shapeshift4.s.array(
|
|
1338
|
+
import_shapeshift4.s.union([
|
|
1339
|
+
import_shapeshift4.s.literal("audio"),
|
|
1340
|
+
import_shapeshift4.s.literal("image"),
|
|
1341
|
+
import_shapeshift4.s.literal("video"),
|
|
1342
|
+
import_shapeshift4.s.string().lengthGreaterThanOrEqual(2).regex(/^\./)
|
|
1343
|
+
])
|
|
1344
|
+
).lengthLessThanOrEqual(10).setValidationEnabled(isValidationEnabled);
|
|
1345
|
+
|
|
1346
|
+
// src/components/fileUpload/Assertions.ts
|
|
1347
|
+
var fileUploadPredicate = import_shapeshift5.s.object({
|
|
1348
|
+
type: import_shapeshift5.s.literal(import_v107.ComponentType.FileUpload),
|
|
1333
1349
|
id: idValidator.optional(),
|
|
1334
1350
|
custom_id: customIdValidator,
|
|
1335
|
-
min_values:
|
|
1336
|
-
max_values:
|
|
1337
|
-
|
|
1351
|
+
min_values: import_shapeshift5.s.number().greaterThanOrEqual(0).lessThanOrEqual(10).optional(),
|
|
1352
|
+
max_values: import_shapeshift5.s.number().greaterThanOrEqual(1).lessThanOrEqual(10).optional(),
|
|
1353
|
+
file_types: fileUploadTypesValidator.optional(),
|
|
1354
|
+
required: import_shapeshift5.s.boolean().optional()
|
|
1338
1355
|
});
|
|
1339
1356
|
|
|
1340
1357
|
// src/components/fileUpload/FileUpload.ts
|
|
@@ -1353,6 +1370,7 @@ var FileUploadBuilder = class extends ComponentBuilder {
|
|
|
1353
1370
|
* custom_id: "file_upload",
|
|
1354
1371
|
* min_values: 2,
|
|
1355
1372
|
* max_values: 5,
|
|
1373
|
+
* file_types: ["image", ".pdf"],
|
|
1356
1374
|
* });
|
|
1357
1375
|
* ```
|
|
1358
1376
|
* @example
|
|
@@ -1362,7 +1380,9 @@ var FileUploadBuilder = class extends ComponentBuilder {
|
|
|
1362
1380
|
* custom_id: "file_upload",
|
|
1363
1381
|
* min_values: 2,
|
|
1364
1382
|
* max_values: 5,
|
|
1365
|
-
* })
|
|
1383
|
+
* })
|
|
1384
|
+
* .setFileTypes("image", ".pdf")
|
|
1385
|
+
* .setRequired();
|
|
1366
1386
|
* ```
|
|
1367
1387
|
*/
|
|
1368
1388
|
constructor(data = {}) {
|
|
@@ -1409,6 +1429,38 @@ var FileUploadBuilder = class extends ComponentBuilder {
|
|
|
1409
1429
|
this.data.max_values = void 0;
|
|
1410
1430
|
return this;
|
|
1411
1431
|
}
|
|
1432
|
+
/**
|
|
1433
|
+
* Adds file types allowed in this file upload.
|
|
1434
|
+
*
|
|
1435
|
+
* @remarks
|
|
1436
|
+
* When specifying only extensions, include `.jpg` for image uploads and both `.mp4` and `.mov`
|
|
1437
|
+
* for video uploads due to mobile platform limitations.
|
|
1438
|
+
* @param fileTypes - The file groups or dot-prefixed extensions to allow
|
|
1439
|
+
*/
|
|
1440
|
+
addFileTypes(...fileTypes) {
|
|
1441
|
+
this.data.file_types ??= [];
|
|
1442
|
+
this.data.file_types.push(...normalizeArray(fileTypes));
|
|
1443
|
+
return this;
|
|
1444
|
+
}
|
|
1445
|
+
/**
|
|
1446
|
+
* Sets the file types allowed in this file upload.
|
|
1447
|
+
*
|
|
1448
|
+
* @remarks
|
|
1449
|
+
* When specifying only extensions, include `.jpg` for image uploads and both `.mp4` and `.mov`
|
|
1450
|
+
* for video uploads due to mobile platform limitations.
|
|
1451
|
+
* @param fileTypes - The file groups or dot-prefixed extensions to allow
|
|
1452
|
+
*/
|
|
1453
|
+
setFileTypes(...fileTypes) {
|
|
1454
|
+
this.data.file_types = normalizeArray(fileTypes);
|
|
1455
|
+
return this;
|
|
1456
|
+
}
|
|
1457
|
+
/**
|
|
1458
|
+
* Clears the file types allowed in this file upload.
|
|
1459
|
+
*/
|
|
1460
|
+
clearFileTypes() {
|
|
1461
|
+
this.data.file_types = void 0;
|
|
1462
|
+
return this;
|
|
1463
|
+
}
|
|
1412
1464
|
/**
|
|
1413
1465
|
* Sets whether this file upload is required.
|
|
1414
1466
|
*
|
|
@@ -1446,17 +1498,17 @@ __export(Assertions_exports5, {
|
|
|
1446
1498
|
validateRequiredParameters: () => validateRequiredParameters,
|
|
1447
1499
|
valueValidator: () => valueValidator
|
|
1448
1500
|
});
|
|
1449
|
-
var
|
|
1501
|
+
var import_shapeshift6 = require("@sapphire/shapeshift");
|
|
1450
1502
|
var import_v109 = require("discord-api-types/v10");
|
|
1451
|
-
var textInputStyleValidator =
|
|
1452
|
-
var minLengthValidator =
|
|
1453
|
-
var maxLengthValidator =
|
|
1454
|
-
var requiredValidator =
|
|
1455
|
-
var valueValidator =
|
|
1456
|
-
var placeholderValidator2 =
|
|
1457
|
-
var labelValidator =
|
|
1458
|
-
var textInputPredicate =
|
|
1459
|
-
type:
|
|
1503
|
+
var textInputStyleValidator = import_shapeshift6.s.nativeEnum(import_v109.TextInputStyle).setValidationEnabled(isValidationEnabled);
|
|
1504
|
+
var minLengthValidator = import_shapeshift6.s.number().int().greaterThanOrEqual(0).lessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
1505
|
+
var maxLengthValidator = import_shapeshift6.s.number().int().greaterThanOrEqual(1).lessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
1506
|
+
var requiredValidator = import_shapeshift6.s.boolean().setValidationEnabled(isValidationEnabled);
|
|
1507
|
+
var valueValidator = import_shapeshift6.s.string().lengthLessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
1508
|
+
var placeholderValidator2 = import_shapeshift6.s.string().lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled);
|
|
1509
|
+
var labelValidator = import_shapeshift6.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45).setValidationEnabled(isValidationEnabled);
|
|
1510
|
+
var textInputPredicate = import_shapeshift6.s.object({
|
|
1511
|
+
type: import_shapeshift6.s.literal(import_v109.ComponentType.TextInput),
|
|
1460
1512
|
custom_id: customIdValidator,
|
|
1461
1513
|
style: textInputStyleValidator,
|
|
1462
1514
|
id: idValidator.optional(),
|
|
@@ -1805,56 +1857,56 @@ __export(Assertions_exports6, {
|
|
|
1805
1857
|
selectMenuStringPredicate: () => selectMenuStringPredicate,
|
|
1806
1858
|
selectMenuUserPredicate: () => selectMenuUserPredicate
|
|
1807
1859
|
});
|
|
1808
|
-
var
|
|
1860
|
+
var import_shapeshift7 = require("@sapphire/shapeshift");
|
|
1809
1861
|
var import_v1013 = require("discord-api-types/v10");
|
|
1810
|
-
var selectMenuBasePredicate =
|
|
1862
|
+
var selectMenuBasePredicate = import_shapeshift7.s.object({
|
|
1811
1863
|
id: idValidator.optional(),
|
|
1812
|
-
placeholder:
|
|
1813
|
-
min_values:
|
|
1814
|
-
max_values:
|
|
1864
|
+
placeholder: import_shapeshift7.s.string().lengthLessThanOrEqual(150).optional(),
|
|
1865
|
+
min_values: import_shapeshift7.s.number().greaterThanOrEqual(0).lessThanOrEqual(25).optional(),
|
|
1866
|
+
max_values: import_shapeshift7.s.number().greaterThanOrEqual(0).lessThanOrEqual(25).optional(),
|
|
1815
1867
|
custom_id: customIdValidator,
|
|
1816
|
-
disabled:
|
|
1868
|
+
disabled: import_shapeshift7.s.boolean().optional()
|
|
1817
1869
|
});
|
|
1818
1870
|
var selectMenuChannelPredicate = selectMenuBasePredicate.extend({
|
|
1819
|
-
type:
|
|
1820
|
-
channel_types:
|
|
1821
|
-
default_values:
|
|
1871
|
+
type: import_shapeshift7.s.literal(import_v1013.ComponentType.ChannelSelect),
|
|
1872
|
+
channel_types: import_shapeshift7.s.nativeEnum(import_v1013.ChannelType).array().optional(),
|
|
1873
|
+
default_values: import_shapeshift7.s.object({ id: import_shapeshift7.s.string(), type: import_shapeshift7.s.literal(import_v1013.SelectMenuDefaultValueType.Channel) }).array().lengthLessThanOrEqual(25).optional()
|
|
1822
1874
|
}).setValidationEnabled(isValidationEnabled);
|
|
1823
1875
|
var selectMenuMentionablePredicate = selectMenuBasePredicate.extend({
|
|
1824
|
-
type:
|
|
1825
|
-
default_values:
|
|
1826
|
-
id:
|
|
1827
|
-
type:
|
|
1876
|
+
type: import_shapeshift7.s.literal(import_v1013.ComponentType.MentionableSelect),
|
|
1877
|
+
default_values: import_shapeshift7.s.object({
|
|
1878
|
+
id: import_shapeshift7.s.string(),
|
|
1879
|
+
type: import_shapeshift7.s.union([import_shapeshift7.s.literal(import_v1013.SelectMenuDefaultValueType.Role), import_shapeshift7.s.literal(import_v1013.SelectMenuDefaultValueType.User)])
|
|
1828
1880
|
}).array().lengthLessThanOrEqual(25).optional()
|
|
1829
1881
|
}).setValidationEnabled(isValidationEnabled);
|
|
1830
1882
|
var selectMenuRolePredicate = selectMenuBasePredicate.extend({
|
|
1831
|
-
type:
|
|
1832
|
-
default_values:
|
|
1883
|
+
type: import_shapeshift7.s.literal(import_v1013.ComponentType.RoleSelect),
|
|
1884
|
+
default_values: import_shapeshift7.s.object({ id: import_shapeshift7.s.string(), type: import_shapeshift7.s.literal(import_v1013.SelectMenuDefaultValueType.Role) }).array().lengthLessThanOrEqual(25).optional()
|
|
1833
1885
|
}).setValidationEnabled(isValidationEnabled);
|
|
1834
1886
|
var selectMenuUserPredicate = selectMenuBasePredicate.extend({
|
|
1835
|
-
type:
|
|
1836
|
-
default_values:
|
|
1887
|
+
type: import_shapeshift7.s.literal(import_v1013.ComponentType.UserSelect),
|
|
1888
|
+
default_values: import_shapeshift7.s.object({ id: import_shapeshift7.s.string(), type: import_shapeshift7.s.literal(import_v1013.SelectMenuDefaultValueType.User) }).array().lengthLessThanOrEqual(25).optional()
|
|
1837
1889
|
}).setValidationEnabled(isValidationEnabled);
|
|
1838
|
-
var selectMenuStringOptionPredicate =
|
|
1839
|
-
label:
|
|
1840
|
-
value:
|
|
1841
|
-
description:
|
|
1890
|
+
var selectMenuStringOptionPredicate = import_shapeshift7.s.object({
|
|
1891
|
+
label: import_shapeshift7.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
|
|
1892
|
+
value: import_shapeshift7.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
|
|
1893
|
+
description: import_shapeshift7.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).optional(),
|
|
1842
1894
|
emoji: emojiValidator.optional(),
|
|
1843
|
-
default:
|
|
1895
|
+
default: import_shapeshift7.s.boolean().optional()
|
|
1844
1896
|
}).setValidationEnabled(isValidationEnabled);
|
|
1845
1897
|
var selectMenuStringPredicate = selectMenuBasePredicate.extend({
|
|
1846
|
-
type:
|
|
1898
|
+
type: import_shapeshift7.s.literal(import_v1013.ComponentType.StringSelect),
|
|
1847
1899
|
options: selectMenuStringOptionPredicate.array().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(25)
|
|
1848
1900
|
}).reshape((value) => {
|
|
1849
1901
|
if (value.min_values !== void 0 && value.options.length < value.min_values) {
|
|
1850
|
-
return
|
|
1902
|
+
return import_shapeshift7.Result.err(new RangeError(`The number of options must be greater than or equal to min_values`));
|
|
1851
1903
|
}
|
|
1852
1904
|
if (value.min_values !== void 0 && value.max_values !== void 0 && value.min_values > value.max_values) {
|
|
1853
|
-
return
|
|
1905
|
+
return import_shapeshift7.Result.err(
|
|
1854
1906
|
new RangeError(`The maximum amount of options must be greater than or equal to the minimum amount of options`)
|
|
1855
1907
|
);
|
|
1856
1908
|
}
|
|
1857
|
-
return
|
|
1909
|
+
return import_shapeshift7.Result.ok(value);
|
|
1858
1910
|
}).setValidationEnabled(isValidationEnabled);
|
|
1859
1911
|
|
|
1860
1912
|
// src/components/selectMenu/StringSelectMenu.ts
|
|
@@ -2174,14 +2226,14 @@ var Assertions_exports7 = {};
|
|
|
2174
2226
|
__export(Assertions_exports7, {
|
|
2175
2227
|
labelPredicate: () => labelPredicate
|
|
2176
2228
|
});
|
|
2177
|
-
var
|
|
2229
|
+
var import_shapeshift8 = require("@sapphire/shapeshift");
|
|
2178
2230
|
var import_v1017 = require("discord-api-types/v10");
|
|
2179
|
-
var labelPredicate =
|
|
2231
|
+
var labelPredicate = import_shapeshift8.s.object({
|
|
2180
2232
|
id: idValidator.optional(),
|
|
2181
|
-
type:
|
|
2182
|
-
label:
|
|
2183
|
-
description:
|
|
2184
|
-
component:
|
|
2233
|
+
type: import_shapeshift8.s.literal(import_v1017.ComponentType.Label),
|
|
2234
|
+
label: import_shapeshift8.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45),
|
|
2235
|
+
description: import_shapeshift8.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).optional(),
|
|
2236
|
+
component: import_shapeshift8.s.union([
|
|
2185
2237
|
textInputPredicate,
|
|
2186
2238
|
selectMenuUserPredicate,
|
|
2187
2239
|
selectMenuRolePredicate,
|
|
@@ -2382,7 +2434,7 @@ __export(Assertions_exports8, {
|
|
|
2382
2434
|
unfurledMediaItemPredicate: () => unfurledMediaItemPredicate,
|
|
2383
2435
|
validateComponentArray: () => validateComponentArray
|
|
2384
2436
|
});
|
|
2385
|
-
var
|
|
2437
|
+
var import_shapeshift9 = require("@sapphire/shapeshift");
|
|
2386
2438
|
var import_v1020 = require("discord-api-types/v10");
|
|
2387
2439
|
|
|
2388
2440
|
// src/components/v2/Thumbnail.ts
|
|
@@ -2467,28 +2519,28 @@ var ThumbnailBuilder = class extends ComponentBuilder {
|
|
|
2467
2519
|
};
|
|
2468
2520
|
|
|
2469
2521
|
// src/components/v2/Assertions.ts
|
|
2470
|
-
var unfurledMediaItemPredicate =
|
|
2471
|
-
url:
|
|
2522
|
+
var unfurledMediaItemPredicate = import_shapeshift9.s.object({
|
|
2523
|
+
url: import_shapeshift9.s.string().url(
|
|
2472
2524
|
{ allowedProtocols: ["http:", "https:", "attachment:"] },
|
|
2473
2525
|
{ message: "Invalid protocol for media URL. Must be http:, https:, or attachment:" }
|
|
2474
2526
|
)
|
|
2475
2527
|
}).setValidationEnabled(isValidationEnabled);
|
|
2476
|
-
var descriptionPredicate2 =
|
|
2477
|
-
var filePredicate =
|
|
2478
|
-
url:
|
|
2528
|
+
var descriptionPredicate2 = import_shapeshift9.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(1024).setValidationEnabled(isValidationEnabled);
|
|
2529
|
+
var filePredicate = import_shapeshift9.s.object({
|
|
2530
|
+
url: import_shapeshift9.s.string().url({ allowedProtocols: ["attachment:"] }, { message: "Invalid protocol for file URL. Must be attachment:" })
|
|
2479
2531
|
}).setValidationEnabled(isValidationEnabled);
|
|
2480
|
-
var spoilerPredicate =
|
|
2481
|
-
var dividerPredicate =
|
|
2482
|
-
var spacingPredicate =
|
|
2483
|
-
var textDisplayContentPredicate =
|
|
2484
|
-
var accessoryPredicate =
|
|
2532
|
+
var spoilerPredicate = import_shapeshift9.s.boolean();
|
|
2533
|
+
var dividerPredicate = import_shapeshift9.s.boolean();
|
|
2534
|
+
var spacingPredicate = import_shapeshift9.s.nativeEnum(import_v1020.SeparatorSpacingSize);
|
|
2535
|
+
var textDisplayContentPredicate = import_shapeshift9.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
2536
|
+
var accessoryPredicate = import_shapeshift9.s.instance(ButtonBuilder).or(import_shapeshift9.s.instance(ThumbnailBuilder)).setValidationEnabled(isValidationEnabled);
|
|
2485
2537
|
var containerColorPredicate = colorPredicate.nullish();
|
|
2486
2538
|
function assertReturnOfBuilder(input, ExpectedInstanceOf) {
|
|
2487
|
-
|
|
2539
|
+
import_shapeshift9.s.instance(ExpectedInstanceOf).setValidationEnabled(isValidationEnabled).parse(input);
|
|
2488
2540
|
}
|
|
2489
2541
|
__name(assertReturnOfBuilder, "assertReturnOfBuilder");
|
|
2490
2542
|
function validateComponentArray(input, min, max, ExpectedInstanceOf) {
|
|
2491
|
-
(ExpectedInstanceOf ?
|
|
2543
|
+
(ExpectedInstanceOf ? import_shapeshift9.s.instance(ExpectedInstanceOf) : import_shapeshift9.s.instance(ComponentBuilder)).array().lengthGreaterThanOrEqual(min).lengthLessThanOrEqual(max).setValidationEnabled(isValidationEnabled).parse(input);
|
|
2492
2544
|
}
|
|
2493
2545
|
__name(validateComponentArray, "validateComponentArray");
|
|
2494
2546
|
|
|
@@ -3283,9 +3335,9 @@ __export(Assertions_exports9, {
|
|
|
3283
3335
|
titleValidator: () => titleValidator,
|
|
3284
3336
|
validateRequiredParameters: () => validateRequiredParameters2
|
|
3285
3337
|
});
|
|
3286
|
-
var
|
|
3287
|
-
var titleValidator =
|
|
3288
|
-
var componentsValidator =
|
|
3338
|
+
var import_shapeshift10 = require("@sapphire/shapeshift");
|
|
3339
|
+
var titleValidator = import_shapeshift10.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45).setValidationEnabled(isValidationEnabled);
|
|
3340
|
+
var componentsValidator = import_shapeshift10.s.union([import_shapeshift10.s.instance(ActionRowBuilder), import_shapeshift10.s.instance(LabelBuilder), import_shapeshift10.s.instance(TextDisplayBuilder)]).array().lengthGreaterThanOrEqual(1).setValidationEnabled(isValidationEnabled);
|
|
3289
3341
|
function validateRequiredParameters2(customId, title, components) {
|
|
3290
3342
|
customIdValidator.parse(customId);
|
|
3291
3343
|
titleValidator.parse(title);
|
|
@@ -3489,20 +3541,20 @@ __export(Assertions_exports10, {
|
|
|
3489
3541
|
validateRequired: () => validateRequired,
|
|
3490
3542
|
validateRequiredParameters: () => validateRequiredParameters3
|
|
3491
3543
|
});
|
|
3492
|
-
var
|
|
3544
|
+
var import_shapeshift11 = require("@sapphire/shapeshift");
|
|
3493
3545
|
var import_v1030 = require("discord-api-types/v10");
|
|
3494
|
-
var namePredicate =
|
|
3546
|
+
var namePredicate = import_shapeshift11.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u).setValidationEnabled(isValidationEnabled);
|
|
3495
3547
|
function validateName(name) {
|
|
3496
3548
|
namePredicate.parse(name);
|
|
3497
3549
|
}
|
|
3498
3550
|
__name(validateName, "validateName");
|
|
3499
|
-
var descriptionPredicate3 =
|
|
3500
|
-
var localePredicate =
|
|
3551
|
+
var descriptionPredicate3 = import_shapeshift11.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled);
|
|
3552
|
+
var localePredicate = import_shapeshift11.s.nativeEnum(import_v1030.Locale);
|
|
3501
3553
|
function validateDescription(description) {
|
|
3502
3554
|
descriptionPredicate3.parse(description);
|
|
3503
3555
|
}
|
|
3504
3556
|
__name(validateDescription, "validateDescription");
|
|
3505
|
-
var maxArrayLengthPredicate =
|
|
3557
|
+
var maxArrayLengthPredicate = import_shapeshift11.s.unknown().array().lengthLessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
|
3506
3558
|
function validateLocale(locale) {
|
|
3507
3559
|
return localePredicate.parse(locale);
|
|
3508
3560
|
}
|
|
@@ -3517,7 +3569,7 @@ function validateRequiredParameters3(name, description, options) {
|
|
|
3517
3569
|
validateMaxOptionsLength(options);
|
|
3518
3570
|
}
|
|
3519
3571
|
__name(validateRequiredParameters3, "validateRequiredParameters");
|
|
3520
|
-
var booleanPredicate =
|
|
3572
|
+
var booleanPredicate = import_shapeshift11.s.boolean();
|
|
3521
3573
|
function validateDefaultPermission(value) {
|
|
3522
3574
|
booleanPredicate.parse(value);
|
|
3523
3575
|
}
|
|
@@ -3526,29 +3578,29 @@ function validateRequired(required) {
|
|
|
3526
3578
|
booleanPredicate.parse(required);
|
|
3527
3579
|
}
|
|
3528
3580
|
__name(validateRequired, "validateRequired");
|
|
3529
|
-
var choicesLengthPredicate =
|
|
3581
|
+
var choicesLengthPredicate = import_shapeshift11.s.number().lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
|
3530
3582
|
function validateChoicesLength(amountAdding, choices) {
|
|
3531
3583
|
choicesLengthPredicate.parse((choices?.length ?? 0) + amountAdding);
|
|
3532
3584
|
}
|
|
3533
3585
|
__name(validateChoicesLength, "validateChoicesLength");
|
|
3534
3586
|
function assertReturnOfBuilder2(input, ExpectedInstanceOf) {
|
|
3535
|
-
|
|
3587
|
+
import_shapeshift11.s.instance(ExpectedInstanceOf).parse(input);
|
|
3536
3588
|
}
|
|
3537
3589
|
__name(assertReturnOfBuilder2, "assertReturnOfBuilder");
|
|
3538
|
-
var localizationMapPredicate =
|
|
3590
|
+
var localizationMapPredicate = import_shapeshift11.s.object(Object.fromEntries(Object.values(import_v1030.Locale).map((locale) => [locale, import_shapeshift11.s.string().nullish()]))).strict().nullish().setValidationEnabled(isValidationEnabled);
|
|
3539
3591
|
function validateLocalizationMap(value) {
|
|
3540
3592
|
localizationMapPredicate.parse(value);
|
|
3541
3593
|
}
|
|
3542
3594
|
__name(validateLocalizationMap, "validateLocalizationMap");
|
|
3543
|
-
var dmPermissionPredicate =
|
|
3595
|
+
var dmPermissionPredicate = import_shapeshift11.s.boolean().nullish();
|
|
3544
3596
|
function validateDMPermission(value) {
|
|
3545
3597
|
dmPermissionPredicate.parse(value);
|
|
3546
3598
|
}
|
|
3547
3599
|
__name(validateDMPermission, "validateDMPermission");
|
|
3548
|
-
var memberPermissionPredicate =
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3600
|
+
var memberPermissionPredicate = import_shapeshift11.s.union([
|
|
3601
|
+
import_shapeshift11.s.bigint().transform((value) => value.toString()),
|
|
3602
|
+
import_shapeshift11.s.number().safeInt().transform((value) => value.toString()),
|
|
3603
|
+
import_shapeshift11.s.string().regex(/^\d+$/)
|
|
3552
3604
|
]).nullish();
|
|
3553
3605
|
function validateDefaultMemberPermissions(permissions) {
|
|
3554
3606
|
return memberPermissionPredicate.parse(permissions);
|
|
@@ -3558,11 +3610,11 @@ function validateNSFW(value) {
|
|
|
3558
3610
|
booleanPredicate.parse(value);
|
|
3559
3611
|
}
|
|
3560
3612
|
__name(validateNSFW, "validateNSFW");
|
|
3561
|
-
var contextsPredicate =
|
|
3562
|
-
|
|
3613
|
+
var contextsPredicate = import_shapeshift11.s.array(
|
|
3614
|
+
import_shapeshift11.s.nativeEnum(import_v1030.InteractionContextType).setValidationEnabled(isValidationEnabled)
|
|
3563
3615
|
);
|
|
3564
|
-
var integrationTypesPredicate =
|
|
3565
|
-
|
|
3616
|
+
var integrationTypesPredicate = import_shapeshift11.s.array(
|
|
3617
|
+
import_shapeshift11.s.nativeEnum(import_v1030.ApplicationIntegrationType).setValidationEnabled(isValidationEnabled)
|
|
3566
3618
|
);
|
|
3567
3619
|
|
|
3568
3620
|
// src/interactions/slashCommands/SlashCommandBuilder.ts
|
|
@@ -3837,6 +3889,48 @@ var SlashCommandAttachmentOption = class extends ApplicationCommandOptionBase {
|
|
|
3837
3889
|
* The type of this option.
|
|
3838
3890
|
*/
|
|
3839
3891
|
type = import_v1032.ApplicationCommandOptionType.Attachment;
|
|
3892
|
+
/**
|
|
3893
|
+
* The file types allowed for this attachment option.
|
|
3894
|
+
*/
|
|
3895
|
+
file_types;
|
|
3896
|
+
/**
|
|
3897
|
+
* Adds file types allowed for this attachment option.
|
|
3898
|
+
*
|
|
3899
|
+
* @remarks
|
|
3900
|
+
* When specifying only extensions, include `.jpg` for image uploads and both `.mp4` and `.mov`
|
|
3901
|
+
* for video uploads due to mobile platform limitations.
|
|
3902
|
+
* @param fileTypes - The file groups or dot-prefixed extensions to allow
|
|
3903
|
+
*/
|
|
3904
|
+
addFileTypes(...fileTypes) {
|
|
3905
|
+
const normalizedFileTypes = normalizeArray(fileTypes);
|
|
3906
|
+
fileUploadTypesValidator.parse([...this.file_types ?? [], ...normalizedFileTypes]);
|
|
3907
|
+
if (this.file_types === void 0) {
|
|
3908
|
+
Reflect.set(this, "file_types", []);
|
|
3909
|
+
}
|
|
3910
|
+
this.file_types.push(...normalizedFileTypes);
|
|
3911
|
+
return this;
|
|
3912
|
+
}
|
|
3913
|
+
/**
|
|
3914
|
+
* Sets the file types allowed for this attachment option.
|
|
3915
|
+
*
|
|
3916
|
+
* @remarks
|
|
3917
|
+
* When specifying only extensions, include `.jpg` for image uploads and both `.mp4` and `.mov`
|
|
3918
|
+
* for video uploads due to mobile platform limitations.
|
|
3919
|
+
* @param fileTypes - The file groups or dot-prefixed extensions to allow
|
|
3920
|
+
*/
|
|
3921
|
+
setFileTypes(...fileTypes) {
|
|
3922
|
+
const normalizedFileTypes = normalizeArray(fileTypes);
|
|
3923
|
+
fileUploadTypesValidator.parse(normalizedFileTypes);
|
|
3924
|
+
Reflect.set(this, "file_types", normalizedFileTypes);
|
|
3925
|
+
return this;
|
|
3926
|
+
}
|
|
3927
|
+
/**
|
|
3928
|
+
* Clears the file types allowed for this attachment option.
|
|
3929
|
+
*/
|
|
3930
|
+
clearFileTypes() {
|
|
3931
|
+
Reflect.set(this, "file_types", void 0);
|
|
3932
|
+
return this;
|
|
3933
|
+
}
|
|
3840
3934
|
/**
|
|
3841
3935
|
* {@inheritDoc ApplicationCommandOptionBase.toJSON}
|
|
3842
3936
|
*/
|
|
@@ -3870,7 +3964,7 @@ var import_v1035 = require("discord-api-types/v10");
|
|
|
3870
3964
|
var import_ts_mixer = require("ts-mixer");
|
|
3871
3965
|
|
|
3872
3966
|
// src/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.ts
|
|
3873
|
-
var
|
|
3967
|
+
var import_shapeshift12 = require("@sapphire/shapeshift");
|
|
3874
3968
|
var import_v1034 = require("discord-api-types/v10");
|
|
3875
3969
|
var allowedChannelTypes = [
|
|
3876
3970
|
import_v1034.ChannelType.GuildText,
|
|
@@ -3884,7 +3978,7 @@ var allowedChannelTypes = [
|
|
|
3884
3978
|
import_v1034.ChannelType.GuildForum,
|
|
3885
3979
|
import_v1034.ChannelType.GuildMedia
|
|
3886
3980
|
];
|
|
3887
|
-
var channelTypesPredicate =
|
|
3981
|
+
var channelTypesPredicate = import_shapeshift12.s.array(import_shapeshift12.s.union(allowedChannelTypes.map((type) => import_shapeshift12.s.literal(type))));
|
|
3888
3982
|
var ApplicationCommandOptionChannelTypesMixin = class {
|
|
3889
3983
|
static {
|
|
3890
3984
|
__name(this, "ApplicationCommandOptionChannelTypesMixin");
|
|
@@ -3927,7 +4021,7 @@ SlashCommandChannelOption = __decorateClass([
|
|
|
3927
4021
|
], SlashCommandChannelOption);
|
|
3928
4022
|
|
|
3929
4023
|
// src/interactions/slashCommands/options/integer.ts
|
|
3930
|
-
var
|
|
4024
|
+
var import_shapeshift15 = require("@sapphire/shapeshift");
|
|
3931
4025
|
var import_v1037 = require("discord-api-types/v10");
|
|
3932
4026
|
var import_ts_mixer2 = require("ts-mixer");
|
|
3933
4027
|
|
|
@@ -3947,8 +4041,8 @@ var ApplicationCommandNumericOptionMinMaxValueMixin = class {
|
|
|
3947
4041
|
};
|
|
3948
4042
|
|
|
3949
4043
|
// src/interactions/slashCommands/mixins/ApplicationCommandOptionWithAutocompleteMixin.ts
|
|
3950
|
-
var
|
|
3951
|
-
var booleanPredicate2 =
|
|
4044
|
+
var import_shapeshift13 = require("@sapphire/shapeshift");
|
|
4045
|
+
var booleanPredicate2 = import_shapeshift13.s.boolean();
|
|
3952
4046
|
var ApplicationCommandOptionWithAutocompleteMixin = class {
|
|
3953
4047
|
static {
|
|
3954
4048
|
__name(this, "ApplicationCommandOptionWithAutocompleteMixin");
|
|
@@ -3979,14 +4073,14 @@ var ApplicationCommandOptionWithAutocompleteMixin = class {
|
|
|
3979
4073
|
};
|
|
3980
4074
|
|
|
3981
4075
|
// src/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesMixin.ts
|
|
3982
|
-
var
|
|
4076
|
+
var import_shapeshift14 = require("@sapphire/shapeshift");
|
|
3983
4077
|
var import_v1036 = require("discord-api-types/v10");
|
|
3984
|
-
var stringPredicate =
|
|
3985
|
-
var numberPredicate =
|
|
3986
|
-
var choicesPredicate =
|
|
4078
|
+
var stringPredicate = import_shapeshift14.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);
|
|
4079
|
+
var numberPredicate = import_shapeshift14.s.number().greaterThan(Number.NEGATIVE_INFINITY).lessThan(Number.POSITIVE_INFINITY);
|
|
4080
|
+
var choicesPredicate = import_shapeshift14.s.object({
|
|
3987
4081
|
name: stringPredicate,
|
|
3988
4082
|
name_localizations: localizationMapPredicate,
|
|
3989
|
-
value:
|
|
4083
|
+
value: import_shapeshift14.s.union([stringPredicate, numberPredicate])
|
|
3990
4084
|
}).array();
|
|
3991
4085
|
var ApplicationCommandOptionWithChoicesMixin = class {
|
|
3992
4086
|
static {
|
|
@@ -4045,7 +4139,7 @@ var ApplicationCommandOptionWithChoicesMixin = class {
|
|
|
4045
4139
|
};
|
|
4046
4140
|
|
|
4047
4141
|
// src/interactions/slashCommands/options/integer.ts
|
|
4048
|
-
var numberValidator =
|
|
4142
|
+
var numberValidator = import_shapeshift15.s.number().int();
|
|
4049
4143
|
var SlashCommandIntegerOption = class extends ApplicationCommandOptionBase {
|
|
4050
4144
|
/**
|
|
4051
4145
|
* The type of this option.
|
|
@@ -4107,10 +4201,10 @@ var SlashCommandMentionableOption = class extends ApplicationCommandOptionBase {
|
|
|
4107
4201
|
};
|
|
4108
4202
|
|
|
4109
4203
|
// src/interactions/slashCommands/options/number.ts
|
|
4110
|
-
var
|
|
4204
|
+
var import_shapeshift16 = require("@sapphire/shapeshift");
|
|
4111
4205
|
var import_v1039 = require("discord-api-types/v10");
|
|
4112
4206
|
var import_ts_mixer3 = require("ts-mixer");
|
|
4113
|
-
var numberValidator2 =
|
|
4207
|
+
var numberValidator2 = import_shapeshift16.s.number();
|
|
4114
4208
|
var SlashCommandNumberOption = class extends ApplicationCommandOptionBase {
|
|
4115
4209
|
/**
|
|
4116
4210
|
* The type of this option.
|
|
@@ -4172,11 +4266,11 @@ var SlashCommandRoleOption = class extends ApplicationCommandOptionBase {
|
|
|
4172
4266
|
};
|
|
4173
4267
|
|
|
4174
4268
|
// src/interactions/slashCommands/options/string.ts
|
|
4175
|
-
var
|
|
4269
|
+
var import_shapeshift17 = require("@sapphire/shapeshift");
|
|
4176
4270
|
var import_v1041 = require("discord-api-types/v10");
|
|
4177
4271
|
var import_ts_mixer4 = require("ts-mixer");
|
|
4178
|
-
var minLengthValidator2 =
|
|
4179
|
-
var maxLengthValidator2 =
|
|
4272
|
+
var minLengthValidator2 = import_shapeshift17.s.number().greaterThanOrEqual(0).lessThanOrEqual(6e3);
|
|
4273
|
+
var maxLengthValidator2 = import_shapeshift17.s.number().greaterThanOrEqual(1).lessThanOrEqual(6e3);
|
|
4180
4274
|
var SlashCommandStringOption = class extends ApplicationCommandOptionBase {
|
|
4181
4275
|
/**
|
|
4182
4276
|
* The type of this option.
|
|
@@ -4534,11 +4628,11 @@ __export(Assertions_exports11, {
|
|
|
4534
4628
|
validateRequiredParameters: () => validateRequiredParameters4,
|
|
4535
4629
|
validateType: () => validateType
|
|
4536
4630
|
});
|
|
4537
|
-
var
|
|
4631
|
+
var import_shapeshift18 = require("@sapphire/shapeshift");
|
|
4538
4632
|
var import_v1044 = require("discord-api-types/v10");
|
|
4539
|
-
var namePredicate2 =
|
|
4540
|
-
var typePredicate =
|
|
4541
|
-
var booleanPredicate3 =
|
|
4633
|
+
var namePredicate2 = import_shapeshift18.s.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/\S/).setValidationEnabled(isValidationEnabled);
|
|
4634
|
+
var typePredicate = import_shapeshift18.s.union([import_shapeshift18.s.literal(import_v1044.ApplicationCommandType.User), import_shapeshift18.s.literal(import_v1044.ApplicationCommandType.Message)]).setValidationEnabled(isValidationEnabled);
|
|
4635
|
+
var booleanPredicate3 = import_shapeshift18.s.boolean();
|
|
4542
4636
|
function validateDefaultPermission2(value) {
|
|
4543
4637
|
booleanPredicate3.parse(value);
|
|
4544
4638
|
}
|
|
@@ -4556,25 +4650,25 @@ function validateRequiredParameters4(name, type) {
|
|
|
4556
4650
|
validateType(type);
|
|
4557
4651
|
}
|
|
4558
4652
|
__name(validateRequiredParameters4, "validateRequiredParameters");
|
|
4559
|
-
var dmPermissionPredicate2 =
|
|
4653
|
+
var dmPermissionPredicate2 = import_shapeshift18.s.boolean().nullish();
|
|
4560
4654
|
function validateDMPermission2(value) {
|
|
4561
4655
|
dmPermissionPredicate2.parse(value);
|
|
4562
4656
|
}
|
|
4563
4657
|
__name(validateDMPermission2, "validateDMPermission");
|
|
4564
|
-
var memberPermissionPredicate2 =
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4658
|
+
var memberPermissionPredicate2 = import_shapeshift18.s.union([
|
|
4659
|
+
import_shapeshift18.s.bigint().transform((value) => value.toString()),
|
|
4660
|
+
import_shapeshift18.s.number().safeInt().transform((value) => value.toString()),
|
|
4661
|
+
import_shapeshift18.s.string().regex(/^\d+$/)
|
|
4568
4662
|
]).nullish();
|
|
4569
4663
|
function validateDefaultMemberPermissions2(permissions) {
|
|
4570
4664
|
return memberPermissionPredicate2.parse(permissions);
|
|
4571
4665
|
}
|
|
4572
4666
|
__name(validateDefaultMemberPermissions2, "validateDefaultMemberPermissions");
|
|
4573
|
-
var contextsPredicate2 =
|
|
4574
|
-
|
|
4667
|
+
var contextsPredicate2 = import_shapeshift18.s.array(
|
|
4668
|
+
import_shapeshift18.s.nativeEnum(import_v1044.InteractionContextType).setValidationEnabled(isValidationEnabled)
|
|
4575
4669
|
);
|
|
4576
|
-
var integrationTypesPredicate2 =
|
|
4577
|
-
|
|
4670
|
+
var integrationTypesPredicate2 = import_shapeshift18.s.array(
|
|
4671
|
+
import_shapeshift18.s.nativeEnum(import_v1044.ApplicationIntegrationType).setValidationEnabled(isValidationEnabled)
|
|
4578
4672
|
);
|
|
4579
4673
|
|
|
4580
4674
|
// src/interactions/contextMenuCommands/ContextMenuCommandBuilder.ts
|
|
@@ -4755,7 +4849,7 @@ function embedLength(data) {
|
|
|
4755
4849
|
__name(embedLength, "embedLength");
|
|
4756
4850
|
|
|
4757
4851
|
// src/index.ts
|
|
4758
|
-
var version = "1.
|
|
4852
|
+
var version = "1.15.0";
|
|
4759
4853
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4760
4854
|
0 && (module.exports = {
|
|
4761
4855
|
ActionRowBuilder,
|