@discordjs/builders 1.14.1 → 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 +57 -2
- package/dist/index.d.ts +57 -2
- package/dist/index.js +207 -113
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +207 -111
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
|
@@ -369,6 +369,7 @@ var StringSelectMenuOptionBuilder = class {
|
|
|
369
369
|
constructor(data = {}) {
|
|
370
370
|
this.data = data;
|
|
371
371
|
}
|
|
372
|
+
data;
|
|
372
373
|
static {
|
|
373
374
|
__name(this, "StringSelectMenuOptionBuilder");
|
|
374
375
|
}
|
|
@@ -828,6 +829,7 @@ var CheckboxGroupOptionBuilder = class {
|
|
|
828
829
|
constructor(data = {}) {
|
|
829
830
|
this.data = data;
|
|
830
831
|
}
|
|
832
|
+
data;
|
|
831
833
|
static {
|
|
832
834
|
__name(this, "CheckboxGroupOptionBuilder");
|
|
833
835
|
}
|
|
@@ -1049,6 +1051,7 @@ var RadioGroupOptionBuilder = class {
|
|
|
1049
1051
|
constructor(data = {}) {
|
|
1050
1052
|
this.data = data;
|
|
1051
1053
|
}
|
|
1054
|
+
data;
|
|
1052
1055
|
static {
|
|
1053
1056
|
__name(this, "RadioGroupOptionBuilder");
|
|
1054
1057
|
}
|
|
@@ -1230,15 +1233,29 @@ var Assertions_exports4 = {};
|
|
|
1230
1233
|
__export(Assertions_exports4, {
|
|
1231
1234
|
fileUploadPredicate: () => fileUploadPredicate
|
|
1232
1235
|
});
|
|
1233
|
-
import { s as
|
|
1236
|
+
import { s as s5 } from "@sapphire/shapeshift";
|
|
1234
1237
|
import { ComponentType as ComponentType6 } from "discord-api-types/v10";
|
|
1235
|
-
|
|
1236
|
-
|
|
1238
|
+
|
|
1239
|
+
// src/util/fileUpload.ts
|
|
1240
|
+
import { s as s4 } from "@sapphire/shapeshift";
|
|
1241
|
+
var fileUploadTypesValidator = s4.array(
|
|
1242
|
+
s4.union([
|
|
1243
|
+
s4.literal("audio"),
|
|
1244
|
+
s4.literal("image"),
|
|
1245
|
+
s4.literal("video"),
|
|
1246
|
+
s4.string().lengthGreaterThanOrEqual(2).regex(/^\./)
|
|
1247
|
+
])
|
|
1248
|
+
).lengthLessThanOrEqual(10).setValidationEnabled(isValidationEnabled);
|
|
1249
|
+
|
|
1250
|
+
// src/components/fileUpload/Assertions.ts
|
|
1251
|
+
var fileUploadPredicate = s5.object({
|
|
1252
|
+
type: s5.literal(ComponentType6.FileUpload),
|
|
1237
1253
|
id: idValidator.optional(),
|
|
1238
1254
|
custom_id: customIdValidator,
|
|
1239
|
-
min_values:
|
|
1240
|
-
max_values:
|
|
1241
|
-
|
|
1255
|
+
min_values: s5.number().greaterThanOrEqual(0).lessThanOrEqual(10).optional(),
|
|
1256
|
+
max_values: s5.number().greaterThanOrEqual(1).lessThanOrEqual(10).optional(),
|
|
1257
|
+
file_types: fileUploadTypesValidator.optional(),
|
|
1258
|
+
required: s5.boolean().optional()
|
|
1242
1259
|
});
|
|
1243
1260
|
|
|
1244
1261
|
// src/components/fileUpload/FileUpload.ts
|
|
@@ -1257,6 +1274,7 @@ var FileUploadBuilder = class extends ComponentBuilder {
|
|
|
1257
1274
|
* custom_id: "file_upload",
|
|
1258
1275
|
* min_values: 2,
|
|
1259
1276
|
* max_values: 5,
|
|
1277
|
+
* file_types: ["image", ".pdf"],
|
|
1260
1278
|
* });
|
|
1261
1279
|
* ```
|
|
1262
1280
|
* @example
|
|
@@ -1266,7 +1284,9 @@ var FileUploadBuilder = class extends ComponentBuilder {
|
|
|
1266
1284
|
* custom_id: "file_upload",
|
|
1267
1285
|
* min_values: 2,
|
|
1268
1286
|
* max_values: 5,
|
|
1269
|
-
* })
|
|
1287
|
+
* })
|
|
1288
|
+
* .setFileTypes("image", ".pdf")
|
|
1289
|
+
* .setRequired();
|
|
1270
1290
|
* ```
|
|
1271
1291
|
*/
|
|
1272
1292
|
constructor(data = {}) {
|
|
@@ -1313,6 +1333,38 @@ var FileUploadBuilder = class extends ComponentBuilder {
|
|
|
1313
1333
|
this.data.max_values = void 0;
|
|
1314
1334
|
return this;
|
|
1315
1335
|
}
|
|
1336
|
+
/**
|
|
1337
|
+
* Adds file types allowed in this file upload.
|
|
1338
|
+
*
|
|
1339
|
+
* @remarks
|
|
1340
|
+
* When specifying only extensions, include `.jpg` for image uploads and both `.mp4` and `.mov`
|
|
1341
|
+
* for video uploads due to mobile platform limitations.
|
|
1342
|
+
* @param fileTypes - The file groups or dot-prefixed extensions to allow
|
|
1343
|
+
*/
|
|
1344
|
+
addFileTypes(...fileTypes) {
|
|
1345
|
+
this.data.file_types ??= [];
|
|
1346
|
+
this.data.file_types.push(...normalizeArray(fileTypes));
|
|
1347
|
+
return this;
|
|
1348
|
+
}
|
|
1349
|
+
/**
|
|
1350
|
+
* Sets the file types allowed in this file upload.
|
|
1351
|
+
*
|
|
1352
|
+
* @remarks
|
|
1353
|
+
* When specifying only extensions, include `.jpg` for image uploads and both `.mp4` and `.mov`
|
|
1354
|
+
* for video uploads due to mobile platform limitations.
|
|
1355
|
+
* @param fileTypes - The file groups or dot-prefixed extensions to allow
|
|
1356
|
+
*/
|
|
1357
|
+
setFileTypes(...fileTypes) {
|
|
1358
|
+
this.data.file_types = normalizeArray(fileTypes);
|
|
1359
|
+
return this;
|
|
1360
|
+
}
|
|
1361
|
+
/**
|
|
1362
|
+
* Clears the file types allowed in this file upload.
|
|
1363
|
+
*/
|
|
1364
|
+
clearFileTypes() {
|
|
1365
|
+
this.data.file_types = void 0;
|
|
1366
|
+
return this;
|
|
1367
|
+
}
|
|
1316
1368
|
/**
|
|
1317
1369
|
* Sets whether this file upload is required.
|
|
1318
1370
|
*
|
|
@@ -1353,17 +1405,17 @@ __export(Assertions_exports5, {
|
|
|
1353
1405
|
validateRequiredParameters: () => validateRequiredParameters,
|
|
1354
1406
|
valueValidator: () => valueValidator
|
|
1355
1407
|
});
|
|
1356
|
-
import { s as
|
|
1408
|
+
import { s as s6 } from "@sapphire/shapeshift";
|
|
1357
1409
|
import { ComponentType as ComponentType8, TextInputStyle } from "discord-api-types/v10";
|
|
1358
|
-
var textInputStyleValidator =
|
|
1359
|
-
var minLengthValidator =
|
|
1360
|
-
var maxLengthValidator =
|
|
1361
|
-
var requiredValidator =
|
|
1362
|
-
var valueValidator =
|
|
1363
|
-
var placeholderValidator2 =
|
|
1364
|
-
var labelValidator =
|
|
1365
|
-
var textInputPredicate =
|
|
1366
|
-
type:
|
|
1410
|
+
var textInputStyleValidator = s6.nativeEnum(TextInputStyle).setValidationEnabled(isValidationEnabled);
|
|
1411
|
+
var minLengthValidator = s6.number().int().greaterThanOrEqual(0).lessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
1412
|
+
var maxLengthValidator = s6.number().int().greaterThanOrEqual(1).lessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
1413
|
+
var requiredValidator = s6.boolean().setValidationEnabled(isValidationEnabled);
|
|
1414
|
+
var valueValidator = s6.string().lengthLessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
1415
|
+
var placeholderValidator2 = s6.string().lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled);
|
|
1416
|
+
var labelValidator = s6.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45).setValidationEnabled(isValidationEnabled);
|
|
1417
|
+
var textInputPredicate = s6.object({
|
|
1418
|
+
type: s6.literal(ComponentType8.TextInput),
|
|
1367
1419
|
custom_id: customIdValidator,
|
|
1368
1420
|
style: textInputStyleValidator,
|
|
1369
1421
|
id: idValidator.optional(),
|
|
@@ -1718,45 +1770,45 @@ __export(Assertions_exports6, {
|
|
|
1718
1770
|
selectMenuStringPredicate: () => selectMenuStringPredicate,
|
|
1719
1771
|
selectMenuUserPredicate: () => selectMenuUserPredicate
|
|
1720
1772
|
});
|
|
1721
|
-
import { Result as Result2, s as
|
|
1773
|
+
import { Result as Result2, s as s7 } from "@sapphire/shapeshift";
|
|
1722
1774
|
import { ChannelType as ChannelType2, ComponentType as ComponentType12, SelectMenuDefaultValueType as SelectMenuDefaultValueType4 } from "discord-api-types/v10";
|
|
1723
|
-
var selectMenuBasePredicate =
|
|
1775
|
+
var selectMenuBasePredicate = s7.object({
|
|
1724
1776
|
id: idValidator.optional(),
|
|
1725
|
-
placeholder:
|
|
1726
|
-
min_values:
|
|
1727
|
-
max_values:
|
|
1777
|
+
placeholder: s7.string().lengthLessThanOrEqual(150).optional(),
|
|
1778
|
+
min_values: s7.number().greaterThanOrEqual(0).lessThanOrEqual(25).optional(),
|
|
1779
|
+
max_values: s7.number().greaterThanOrEqual(0).lessThanOrEqual(25).optional(),
|
|
1728
1780
|
custom_id: customIdValidator,
|
|
1729
|
-
disabled:
|
|
1781
|
+
disabled: s7.boolean().optional()
|
|
1730
1782
|
});
|
|
1731
1783
|
var selectMenuChannelPredicate = selectMenuBasePredicate.extend({
|
|
1732
|
-
type:
|
|
1733
|
-
channel_types:
|
|
1734
|
-
default_values:
|
|
1784
|
+
type: s7.literal(ComponentType12.ChannelSelect),
|
|
1785
|
+
channel_types: s7.nativeEnum(ChannelType2).array().optional(),
|
|
1786
|
+
default_values: s7.object({ id: s7.string(), type: s7.literal(SelectMenuDefaultValueType4.Channel) }).array().lengthLessThanOrEqual(25).optional()
|
|
1735
1787
|
}).setValidationEnabled(isValidationEnabled);
|
|
1736
1788
|
var selectMenuMentionablePredicate = selectMenuBasePredicate.extend({
|
|
1737
|
-
type:
|
|
1738
|
-
default_values:
|
|
1739
|
-
id:
|
|
1740
|
-
type:
|
|
1789
|
+
type: s7.literal(ComponentType12.MentionableSelect),
|
|
1790
|
+
default_values: s7.object({
|
|
1791
|
+
id: s7.string(),
|
|
1792
|
+
type: s7.union([s7.literal(SelectMenuDefaultValueType4.Role), s7.literal(SelectMenuDefaultValueType4.User)])
|
|
1741
1793
|
}).array().lengthLessThanOrEqual(25).optional()
|
|
1742
1794
|
}).setValidationEnabled(isValidationEnabled);
|
|
1743
1795
|
var selectMenuRolePredicate = selectMenuBasePredicate.extend({
|
|
1744
|
-
type:
|
|
1745
|
-
default_values:
|
|
1796
|
+
type: s7.literal(ComponentType12.RoleSelect),
|
|
1797
|
+
default_values: s7.object({ id: s7.string(), type: s7.literal(SelectMenuDefaultValueType4.Role) }).array().lengthLessThanOrEqual(25).optional()
|
|
1746
1798
|
}).setValidationEnabled(isValidationEnabled);
|
|
1747
1799
|
var selectMenuUserPredicate = selectMenuBasePredicate.extend({
|
|
1748
|
-
type:
|
|
1749
|
-
default_values:
|
|
1800
|
+
type: s7.literal(ComponentType12.UserSelect),
|
|
1801
|
+
default_values: s7.object({ id: s7.string(), type: s7.literal(SelectMenuDefaultValueType4.User) }).array().lengthLessThanOrEqual(25).optional()
|
|
1750
1802
|
}).setValidationEnabled(isValidationEnabled);
|
|
1751
|
-
var selectMenuStringOptionPredicate =
|
|
1752
|
-
label:
|
|
1753
|
-
value:
|
|
1754
|
-
description:
|
|
1803
|
+
var selectMenuStringOptionPredicate = s7.object({
|
|
1804
|
+
label: s7.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
|
|
1805
|
+
value: s7.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100),
|
|
1806
|
+
description: s7.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).optional(),
|
|
1755
1807
|
emoji: emojiValidator.optional(),
|
|
1756
|
-
default:
|
|
1808
|
+
default: s7.boolean().optional()
|
|
1757
1809
|
}).setValidationEnabled(isValidationEnabled);
|
|
1758
1810
|
var selectMenuStringPredicate = selectMenuBasePredicate.extend({
|
|
1759
|
-
type:
|
|
1811
|
+
type: s7.literal(ComponentType12.StringSelect),
|
|
1760
1812
|
options: selectMenuStringOptionPredicate.array().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(25)
|
|
1761
1813
|
}).reshape((value) => {
|
|
1762
1814
|
if (value.min_values !== void 0 && value.options.length < value.min_values) {
|
|
@@ -2090,14 +2142,14 @@ var Assertions_exports7 = {};
|
|
|
2090
2142
|
__export(Assertions_exports7, {
|
|
2091
2143
|
labelPredicate: () => labelPredicate
|
|
2092
2144
|
});
|
|
2093
|
-
import { s as
|
|
2145
|
+
import { s as s8 } from "@sapphire/shapeshift";
|
|
2094
2146
|
import { ComponentType as ComponentType16 } from "discord-api-types/v10";
|
|
2095
|
-
var labelPredicate =
|
|
2147
|
+
var labelPredicate = s8.object({
|
|
2096
2148
|
id: idValidator.optional(),
|
|
2097
|
-
type:
|
|
2098
|
-
label:
|
|
2099
|
-
description:
|
|
2100
|
-
component:
|
|
2149
|
+
type: s8.literal(ComponentType16.Label),
|
|
2150
|
+
label: s8.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45),
|
|
2151
|
+
description: s8.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).optional(),
|
|
2152
|
+
component: s8.union([
|
|
2101
2153
|
textInputPredicate,
|
|
2102
2154
|
selectMenuUserPredicate,
|
|
2103
2155
|
selectMenuRolePredicate,
|
|
@@ -2298,7 +2350,7 @@ __export(Assertions_exports8, {
|
|
|
2298
2350
|
unfurledMediaItemPredicate: () => unfurledMediaItemPredicate,
|
|
2299
2351
|
validateComponentArray: () => validateComponentArray
|
|
2300
2352
|
});
|
|
2301
|
-
import { s as
|
|
2353
|
+
import { s as s9 } from "@sapphire/shapeshift";
|
|
2302
2354
|
import { SeparatorSpacingSize } from "discord-api-types/v10";
|
|
2303
2355
|
|
|
2304
2356
|
// src/components/v2/Thumbnail.ts
|
|
@@ -2383,28 +2435,28 @@ var ThumbnailBuilder = class extends ComponentBuilder {
|
|
|
2383
2435
|
};
|
|
2384
2436
|
|
|
2385
2437
|
// src/components/v2/Assertions.ts
|
|
2386
|
-
var unfurledMediaItemPredicate =
|
|
2387
|
-
url:
|
|
2438
|
+
var unfurledMediaItemPredicate = s9.object({
|
|
2439
|
+
url: s9.string().url(
|
|
2388
2440
|
{ allowedProtocols: ["http:", "https:", "attachment:"] },
|
|
2389
2441
|
{ message: "Invalid protocol for media URL. Must be http:, https:, or attachment:" }
|
|
2390
2442
|
)
|
|
2391
2443
|
}).setValidationEnabled(isValidationEnabled);
|
|
2392
|
-
var descriptionPredicate2 =
|
|
2393
|
-
var filePredicate =
|
|
2394
|
-
url:
|
|
2444
|
+
var descriptionPredicate2 = s9.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(1024).setValidationEnabled(isValidationEnabled);
|
|
2445
|
+
var filePredicate = s9.object({
|
|
2446
|
+
url: s9.string().url({ allowedProtocols: ["attachment:"] }, { message: "Invalid protocol for file URL. Must be attachment:" })
|
|
2395
2447
|
}).setValidationEnabled(isValidationEnabled);
|
|
2396
|
-
var spoilerPredicate =
|
|
2397
|
-
var dividerPredicate =
|
|
2398
|
-
var spacingPredicate =
|
|
2399
|
-
var textDisplayContentPredicate =
|
|
2400
|
-
var accessoryPredicate =
|
|
2448
|
+
var spoilerPredicate = s9.boolean();
|
|
2449
|
+
var dividerPredicate = s9.boolean();
|
|
2450
|
+
var spacingPredicate = s9.nativeEnum(SeparatorSpacingSize);
|
|
2451
|
+
var textDisplayContentPredicate = s9.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(4e3).setValidationEnabled(isValidationEnabled);
|
|
2452
|
+
var accessoryPredicate = s9.instance(ButtonBuilder).or(s9.instance(ThumbnailBuilder)).setValidationEnabled(isValidationEnabled);
|
|
2401
2453
|
var containerColorPredicate = colorPredicate.nullish();
|
|
2402
2454
|
function assertReturnOfBuilder(input, ExpectedInstanceOf) {
|
|
2403
|
-
|
|
2455
|
+
s9.instance(ExpectedInstanceOf).setValidationEnabled(isValidationEnabled).parse(input);
|
|
2404
2456
|
}
|
|
2405
2457
|
__name(assertReturnOfBuilder, "assertReturnOfBuilder");
|
|
2406
2458
|
function validateComponentArray(input, min, max, ExpectedInstanceOf) {
|
|
2407
|
-
(ExpectedInstanceOf ?
|
|
2459
|
+
(ExpectedInstanceOf ? s9.instance(ExpectedInstanceOf) : s9.instance(ComponentBuilder)).array().lengthGreaterThanOrEqual(min).lengthLessThanOrEqual(max).setValidationEnabled(isValidationEnabled).parse(input);
|
|
2408
2460
|
}
|
|
2409
2461
|
__name(validateComponentArray, "validateComponentArray");
|
|
2410
2462
|
|
|
@@ -3199,9 +3251,9 @@ __export(Assertions_exports9, {
|
|
|
3199
3251
|
titleValidator: () => titleValidator,
|
|
3200
3252
|
validateRequiredParameters: () => validateRequiredParameters2
|
|
3201
3253
|
});
|
|
3202
|
-
import { s as
|
|
3203
|
-
var titleValidator =
|
|
3204
|
-
var componentsValidator =
|
|
3254
|
+
import { s as s10 } from "@sapphire/shapeshift";
|
|
3255
|
+
var titleValidator = s10.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45).setValidationEnabled(isValidationEnabled);
|
|
3256
|
+
var componentsValidator = s10.union([s10.instance(ActionRowBuilder), s10.instance(LabelBuilder), s10.instance(TextDisplayBuilder)]).array().lengthGreaterThanOrEqual(1).setValidationEnabled(isValidationEnabled);
|
|
3205
3257
|
function validateRequiredParameters2(customId, title, components) {
|
|
3206
3258
|
customIdValidator.parse(customId);
|
|
3207
3259
|
titleValidator.parse(title);
|
|
@@ -3405,24 +3457,24 @@ __export(Assertions_exports10, {
|
|
|
3405
3457
|
validateRequired: () => validateRequired,
|
|
3406
3458
|
validateRequiredParameters: () => validateRequiredParameters3
|
|
3407
3459
|
});
|
|
3408
|
-
import { s as
|
|
3460
|
+
import { s as s11 } from "@sapphire/shapeshift";
|
|
3409
3461
|
import {
|
|
3410
3462
|
ApplicationIntegrationType,
|
|
3411
3463
|
InteractionContextType,
|
|
3412
3464
|
Locale
|
|
3413
3465
|
} from "discord-api-types/v10";
|
|
3414
|
-
var namePredicate =
|
|
3466
|
+
var namePredicate = s11.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u).setValidationEnabled(isValidationEnabled);
|
|
3415
3467
|
function validateName(name) {
|
|
3416
3468
|
namePredicate.parse(name);
|
|
3417
3469
|
}
|
|
3418
3470
|
__name(validateName, "validateName");
|
|
3419
|
-
var descriptionPredicate3 =
|
|
3420
|
-
var localePredicate =
|
|
3471
|
+
var descriptionPredicate3 = s11.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100).setValidationEnabled(isValidationEnabled);
|
|
3472
|
+
var localePredicate = s11.nativeEnum(Locale);
|
|
3421
3473
|
function validateDescription(description) {
|
|
3422
3474
|
descriptionPredicate3.parse(description);
|
|
3423
3475
|
}
|
|
3424
3476
|
__name(validateDescription, "validateDescription");
|
|
3425
|
-
var maxArrayLengthPredicate =
|
|
3477
|
+
var maxArrayLengthPredicate = s11.unknown().array().lengthLessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
|
3426
3478
|
function validateLocale(locale) {
|
|
3427
3479
|
return localePredicate.parse(locale);
|
|
3428
3480
|
}
|
|
@@ -3437,7 +3489,7 @@ function validateRequiredParameters3(name, description, options) {
|
|
|
3437
3489
|
validateMaxOptionsLength(options);
|
|
3438
3490
|
}
|
|
3439
3491
|
__name(validateRequiredParameters3, "validateRequiredParameters");
|
|
3440
|
-
var booleanPredicate =
|
|
3492
|
+
var booleanPredicate = s11.boolean();
|
|
3441
3493
|
function validateDefaultPermission(value) {
|
|
3442
3494
|
booleanPredicate.parse(value);
|
|
3443
3495
|
}
|
|
@@ -3446,29 +3498,29 @@ function validateRequired(required) {
|
|
|
3446
3498
|
booleanPredicate.parse(required);
|
|
3447
3499
|
}
|
|
3448
3500
|
__name(validateRequired, "validateRequired");
|
|
3449
|
-
var choicesLengthPredicate =
|
|
3501
|
+
var choicesLengthPredicate = s11.number().lessThanOrEqual(25).setValidationEnabled(isValidationEnabled);
|
|
3450
3502
|
function validateChoicesLength(amountAdding, choices) {
|
|
3451
3503
|
choicesLengthPredicate.parse((choices?.length ?? 0) + amountAdding);
|
|
3452
3504
|
}
|
|
3453
3505
|
__name(validateChoicesLength, "validateChoicesLength");
|
|
3454
3506
|
function assertReturnOfBuilder2(input, ExpectedInstanceOf) {
|
|
3455
|
-
|
|
3507
|
+
s11.instance(ExpectedInstanceOf).parse(input);
|
|
3456
3508
|
}
|
|
3457
3509
|
__name(assertReturnOfBuilder2, "assertReturnOfBuilder");
|
|
3458
|
-
var localizationMapPredicate =
|
|
3510
|
+
var localizationMapPredicate = s11.object(Object.fromEntries(Object.values(Locale).map((locale) => [locale, s11.string().nullish()]))).strict().nullish().setValidationEnabled(isValidationEnabled);
|
|
3459
3511
|
function validateLocalizationMap(value) {
|
|
3460
3512
|
localizationMapPredicate.parse(value);
|
|
3461
3513
|
}
|
|
3462
3514
|
__name(validateLocalizationMap, "validateLocalizationMap");
|
|
3463
|
-
var dmPermissionPredicate =
|
|
3515
|
+
var dmPermissionPredicate = s11.boolean().nullish();
|
|
3464
3516
|
function validateDMPermission(value) {
|
|
3465
3517
|
dmPermissionPredicate.parse(value);
|
|
3466
3518
|
}
|
|
3467
3519
|
__name(validateDMPermission, "validateDMPermission");
|
|
3468
|
-
var memberPermissionPredicate =
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3520
|
+
var memberPermissionPredicate = s11.union([
|
|
3521
|
+
s11.bigint().transform((value) => value.toString()),
|
|
3522
|
+
s11.number().safeInt().transform((value) => value.toString()),
|
|
3523
|
+
s11.string().regex(/^\d+$/)
|
|
3472
3524
|
]).nullish();
|
|
3473
3525
|
function validateDefaultMemberPermissions(permissions) {
|
|
3474
3526
|
return memberPermissionPredicate.parse(permissions);
|
|
@@ -3478,11 +3530,11 @@ function validateNSFW(value) {
|
|
|
3478
3530
|
booleanPredicate.parse(value);
|
|
3479
3531
|
}
|
|
3480
3532
|
__name(validateNSFW, "validateNSFW");
|
|
3481
|
-
var contextsPredicate =
|
|
3482
|
-
|
|
3533
|
+
var contextsPredicate = s11.array(
|
|
3534
|
+
s11.nativeEnum(InteractionContextType).setValidationEnabled(isValidationEnabled)
|
|
3483
3535
|
);
|
|
3484
|
-
var integrationTypesPredicate =
|
|
3485
|
-
|
|
3536
|
+
var integrationTypesPredicate = s11.array(
|
|
3537
|
+
s11.nativeEnum(ApplicationIntegrationType).setValidationEnabled(isValidationEnabled)
|
|
3486
3538
|
);
|
|
3487
3539
|
|
|
3488
3540
|
// src/interactions/slashCommands/SlashCommandBuilder.ts
|
|
@@ -3716,7 +3768,9 @@ var SharedSlashCommand = class {
|
|
|
3716
3768
|
};
|
|
3717
3769
|
|
|
3718
3770
|
// src/interactions/slashCommands/options/attachment.ts
|
|
3719
|
-
import {
|
|
3771
|
+
import {
|
|
3772
|
+
ApplicationCommandOptionType
|
|
3773
|
+
} from "discord-api-types/v10";
|
|
3720
3774
|
|
|
3721
3775
|
// src/interactions/slashCommands/mixins/ApplicationCommandOptionBase.ts
|
|
3722
3776
|
var ApplicationCommandOptionBase = class extends SharedNameAndDescription {
|
|
@@ -3759,6 +3813,48 @@ var SlashCommandAttachmentOption = class extends ApplicationCommandOptionBase {
|
|
|
3759
3813
|
* The type of this option.
|
|
3760
3814
|
*/
|
|
3761
3815
|
type = ApplicationCommandOptionType.Attachment;
|
|
3816
|
+
/**
|
|
3817
|
+
* The file types allowed for this attachment option.
|
|
3818
|
+
*/
|
|
3819
|
+
file_types;
|
|
3820
|
+
/**
|
|
3821
|
+
* Adds file types allowed for this attachment option.
|
|
3822
|
+
*
|
|
3823
|
+
* @remarks
|
|
3824
|
+
* When specifying only extensions, include `.jpg` for image uploads and both `.mp4` and `.mov`
|
|
3825
|
+
* for video uploads due to mobile platform limitations.
|
|
3826
|
+
* @param fileTypes - The file groups or dot-prefixed extensions to allow
|
|
3827
|
+
*/
|
|
3828
|
+
addFileTypes(...fileTypes) {
|
|
3829
|
+
const normalizedFileTypes = normalizeArray(fileTypes);
|
|
3830
|
+
fileUploadTypesValidator.parse([...this.file_types ?? [], ...normalizedFileTypes]);
|
|
3831
|
+
if (this.file_types === void 0) {
|
|
3832
|
+
Reflect.set(this, "file_types", []);
|
|
3833
|
+
}
|
|
3834
|
+
this.file_types.push(...normalizedFileTypes);
|
|
3835
|
+
return this;
|
|
3836
|
+
}
|
|
3837
|
+
/**
|
|
3838
|
+
* Sets the file types allowed for this attachment option.
|
|
3839
|
+
*
|
|
3840
|
+
* @remarks
|
|
3841
|
+
* When specifying only extensions, include `.jpg` for image uploads and both `.mp4` and `.mov`
|
|
3842
|
+
* for video uploads due to mobile platform limitations.
|
|
3843
|
+
* @param fileTypes - The file groups or dot-prefixed extensions to allow
|
|
3844
|
+
*/
|
|
3845
|
+
setFileTypes(...fileTypes) {
|
|
3846
|
+
const normalizedFileTypes = normalizeArray(fileTypes);
|
|
3847
|
+
fileUploadTypesValidator.parse(normalizedFileTypes);
|
|
3848
|
+
Reflect.set(this, "file_types", normalizedFileTypes);
|
|
3849
|
+
return this;
|
|
3850
|
+
}
|
|
3851
|
+
/**
|
|
3852
|
+
* Clears the file types allowed for this attachment option.
|
|
3853
|
+
*/
|
|
3854
|
+
clearFileTypes() {
|
|
3855
|
+
Reflect.set(this, "file_types", void 0);
|
|
3856
|
+
return this;
|
|
3857
|
+
}
|
|
3762
3858
|
/**
|
|
3763
3859
|
* {@inheritDoc ApplicationCommandOptionBase.toJSON}
|
|
3764
3860
|
*/
|
|
@@ -3792,7 +3888,7 @@ import { ApplicationCommandOptionType as ApplicationCommandOptionType3 } from "d
|
|
|
3792
3888
|
import { mix } from "ts-mixer";
|
|
3793
3889
|
|
|
3794
3890
|
// src/interactions/slashCommands/mixins/ApplicationCommandOptionChannelTypesMixin.ts
|
|
3795
|
-
import { s as
|
|
3891
|
+
import { s as s12 } from "@sapphire/shapeshift";
|
|
3796
3892
|
import { ChannelType as ChannelType3 } from "discord-api-types/v10";
|
|
3797
3893
|
var allowedChannelTypes = [
|
|
3798
3894
|
ChannelType3.GuildText,
|
|
@@ -3806,7 +3902,7 @@ var allowedChannelTypes = [
|
|
|
3806
3902
|
ChannelType3.GuildForum,
|
|
3807
3903
|
ChannelType3.GuildMedia
|
|
3808
3904
|
];
|
|
3809
|
-
var channelTypesPredicate =
|
|
3905
|
+
var channelTypesPredicate = s12.array(s12.union(allowedChannelTypes.map((type) => s12.literal(type))));
|
|
3810
3906
|
var ApplicationCommandOptionChannelTypesMixin = class {
|
|
3811
3907
|
static {
|
|
3812
3908
|
__name(this, "ApplicationCommandOptionChannelTypesMixin");
|
|
@@ -3849,7 +3945,7 @@ SlashCommandChannelOption = __decorateClass([
|
|
|
3849
3945
|
], SlashCommandChannelOption);
|
|
3850
3946
|
|
|
3851
3947
|
// src/interactions/slashCommands/options/integer.ts
|
|
3852
|
-
import { s as
|
|
3948
|
+
import { s as s15 } from "@sapphire/shapeshift";
|
|
3853
3949
|
import { ApplicationCommandOptionType as ApplicationCommandOptionType5 } from "discord-api-types/v10";
|
|
3854
3950
|
import { mix as mix2 } from "ts-mixer";
|
|
3855
3951
|
|
|
@@ -3869,8 +3965,8 @@ var ApplicationCommandNumericOptionMinMaxValueMixin = class {
|
|
|
3869
3965
|
};
|
|
3870
3966
|
|
|
3871
3967
|
// src/interactions/slashCommands/mixins/ApplicationCommandOptionWithAutocompleteMixin.ts
|
|
3872
|
-
import { s as
|
|
3873
|
-
var booleanPredicate2 =
|
|
3968
|
+
import { s as s13 } from "@sapphire/shapeshift";
|
|
3969
|
+
var booleanPredicate2 = s13.boolean();
|
|
3874
3970
|
var ApplicationCommandOptionWithAutocompleteMixin = class {
|
|
3875
3971
|
static {
|
|
3876
3972
|
__name(this, "ApplicationCommandOptionWithAutocompleteMixin");
|
|
@@ -3901,14 +3997,14 @@ var ApplicationCommandOptionWithAutocompleteMixin = class {
|
|
|
3901
3997
|
};
|
|
3902
3998
|
|
|
3903
3999
|
// src/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesMixin.ts
|
|
3904
|
-
import { s as
|
|
4000
|
+
import { s as s14 } from "@sapphire/shapeshift";
|
|
3905
4001
|
import { ApplicationCommandOptionType as ApplicationCommandOptionType4 } from "discord-api-types/v10";
|
|
3906
|
-
var stringPredicate =
|
|
3907
|
-
var numberPredicate =
|
|
3908
|
-
var choicesPredicate =
|
|
4002
|
+
var stringPredicate = s14.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);
|
|
4003
|
+
var numberPredicate = s14.number().greaterThan(Number.NEGATIVE_INFINITY).lessThan(Number.POSITIVE_INFINITY);
|
|
4004
|
+
var choicesPredicate = s14.object({
|
|
3909
4005
|
name: stringPredicate,
|
|
3910
4006
|
name_localizations: localizationMapPredicate,
|
|
3911
|
-
value:
|
|
4007
|
+
value: s14.union([stringPredicate, numberPredicate])
|
|
3912
4008
|
}).array();
|
|
3913
4009
|
var ApplicationCommandOptionWithChoicesMixin = class {
|
|
3914
4010
|
static {
|
|
@@ -3967,7 +4063,7 @@ var ApplicationCommandOptionWithChoicesMixin = class {
|
|
|
3967
4063
|
};
|
|
3968
4064
|
|
|
3969
4065
|
// src/interactions/slashCommands/options/integer.ts
|
|
3970
|
-
var numberValidator =
|
|
4066
|
+
var numberValidator = s15.number().int();
|
|
3971
4067
|
var SlashCommandIntegerOption = class extends ApplicationCommandOptionBase {
|
|
3972
4068
|
/**
|
|
3973
4069
|
* The type of this option.
|
|
@@ -4029,10 +4125,10 @@ var SlashCommandMentionableOption = class extends ApplicationCommandOptionBase {
|
|
|
4029
4125
|
};
|
|
4030
4126
|
|
|
4031
4127
|
// src/interactions/slashCommands/options/number.ts
|
|
4032
|
-
import { s as
|
|
4128
|
+
import { s as s16 } from "@sapphire/shapeshift";
|
|
4033
4129
|
import { ApplicationCommandOptionType as ApplicationCommandOptionType7 } from "discord-api-types/v10";
|
|
4034
4130
|
import { mix as mix3 } from "ts-mixer";
|
|
4035
|
-
var numberValidator2 =
|
|
4131
|
+
var numberValidator2 = s16.number();
|
|
4036
4132
|
var SlashCommandNumberOption = class extends ApplicationCommandOptionBase {
|
|
4037
4133
|
/**
|
|
4038
4134
|
* The type of this option.
|
|
@@ -4094,11 +4190,11 @@ var SlashCommandRoleOption = class extends ApplicationCommandOptionBase {
|
|
|
4094
4190
|
};
|
|
4095
4191
|
|
|
4096
4192
|
// src/interactions/slashCommands/options/string.ts
|
|
4097
|
-
import { s as
|
|
4193
|
+
import { s as s17 } from "@sapphire/shapeshift";
|
|
4098
4194
|
import { ApplicationCommandOptionType as ApplicationCommandOptionType9 } from "discord-api-types/v10";
|
|
4099
4195
|
import { mix as mix4 } from "ts-mixer";
|
|
4100
|
-
var minLengthValidator2 =
|
|
4101
|
-
var maxLengthValidator2 =
|
|
4196
|
+
var minLengthValidator2 = s17.number().greaterThanOrEqual(0).lessThanOrEqual(6e3);
|
|
4197
|
+
var maxLengthValidator2 = s17.number().greaterThanOrEqual(1).lessThanOrEqual(6e3);
|
|
4102
4198
|
var SlashCommandStringOption = class extends ApplicationCommandOptionBase {
|
|
4103
4199
|
/**
|
|
4104
4200
|
* The type of this option.
|
|
@@ -4458,11 +4554,11 @@ __export(Assertions_exports11, {
|
|
|
4458
4554
|
validateRequiredParameters: () => validateRequiredParameters4,
|
|
4459
4555
|
validateType: () => validateType
|
|
4460
4556
|
});
|
|
4461
|
-
import { s as
|
|
4557
|
+
import { s as s18 } from "@sapphire/shapeshift";
|
|
4462
4558
|
import { ApplicationCommandType as ApplicationCommandType2, ApplicationIntegrationType as ApplicationIntegrationType2, InteractionContextType as InteractionContextType2 } from "discord-api-types/v10";
|
|
4463
|
-
var namePredicate2 =
|
|
4464
|
-
var typePredicate =
|
|
4465
|
-
var booleanPredicate3 =
|
|
4559
|
+
var namePredicate2 = s18.string().lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/\S/).setValidationEnabled(isValidationEnabled);
|
|
4560
|
+
var typePredicate = s18.union([s18.literal(ApplicationCommandType2.User), s18.literal(ApplicationCommandType2.Message)]).setValidationEnabled(isValidationEnabled);
|
|
4561
|
+
var booleanPredicate3 = s18.boolean();
|
|
4466
4562
|
function validateDefaultPermission2(value) {
|
|
4467
4563
|
booleanPredicate3.parse(value);
|
|
4468
4564
|
}
|
|
@@ -4480,25 +4576,25 @@ function validateRequiredParameters4(name, type) {
|
|
|
4480
4576
|
validateType(type);
|
|
4481
4577
|
}
|
|
4482
4578
|
__name(validateRequiredParameters4, "validateRequiredParameters");
|
|
4483
|
-
var dmPermissionPredicate2 =
|
|
4579
|
+
var dmPermissionPredicate2 = s18.boolean().nullish();
|
|
4484
4580
|
function validateDMPermission2(value) {
|
|
4485
4581
|
dmPermissionPredicate2.parse(value);
|
|
4486
4582
|
}
|
|
4487
4583
|
__name(validateDMPermission2, "validateDMPermission");
|
|
4488
|
-
var memberPermissionPredicate2 =
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4584
|
+
var memberPermissionPredicate2 = s18.union([
|
|
4585
|
+
s18.bigint().transform((value) => value.toString()),
|
|
4586
|
+
s18.number().safeInt().transform((value) => value.toString()),
|
|
4587
|
+
s18.string().regex(/^\d+$/)
|
|
4492
4588
|
]).nullish();
|
|
4493
4589
|
function validateDefaultMemberPermissions2(permissions) {
|
|
4494
4590
|
return memberPermissionPredicate2.parse(permissions);
|
|
4495
4591
|
}
|
|
4496
4592
|
__name(validateDefaultMemberPermissions2, "validateDefaultMemberPermissions");
|
|
4497
|
-
var contextsPredicate2 =
|
|
4498
|
-
|
|
4593
|
+
var contextsPredicate2 = s18.array(
|
|
4594
|
+
s18.nativeEnum(InteractionContextType2).setValidationEnabled(isValidationEnabled)
|
|
4499
4595
|
);
|
|
4500
|
-
var integrationTypesPredicate2 =
|
|
4501
|
-
|
|
4596
|
+
var integrationTypesPredicate2 = s18.array(
|
|
4597
|
+
s18.nativeEnum(ApplicationIntegrationType2).setValidationEnabled(isValidationEnabled)
|
|
4502
4598
|
);
|
|
4503
4599
|
|
|
4504
4600
|
// src/interactions/contextMenuCommands/ContextMenuCommandBuilder.ts
|
|
@@ -4679,7 +4775,7 @@ function embedLength(data) {
|
|
|
4679
4775
|
__name(embedLength, "embedLength");
|
|
4680
4776
|
|
|
4681
4777
|
// src/index.ts
|
|
4682
|
-
var version = "1.
|
|
4778
|
+
var version = "1.15.0";
|
|
4683
4779
|
export {
|
|
4684
4780
|
ActionRowBuilder,
|
|
4685
4781
|
ApplicationCommandNumericOptionMinMaxValueMixin,
|