@discordjs/builders 2.0.0-dev.1752365784-3cff4d741 → 2.0.0-dev.1752452146-7e3d4e536
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.mts +64 -64
- package/dist/index.d.ts +64 -64
- package/dist/index.js +213 -213
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -185,7 +185,7 @@ var EmojiOrLabelButtonMixin = class {
|
|
|
185
185
|
};
|
|
186
186
|
|
|
187
187
|
// src/util/ValidationError.ts
|
|
188
|
-
var
|
|
188
|
+
var import_zod = require("zod");
|
|
189
189
|
var ValidationError = class extends Error {
|
|
190
190
|
static {
|
|
191
191
|
__name(this, "ValidationError");
|
|
@@ -198,7 +198,7 @@ var ValidationError = class extends Error {
|
|
|
198
198
|
* @internal
|
|
199
199
|
*/
|
|
200
200
|
constructor(error) {
|
|
201
|
-
super(
|
|
201
|
+
super(import_zod.z.prettifyError(error));
|
|
202
202
|
this.name = "ValidationError";
|
|
203
203
|
this.cause = error;
|
|
204
204
|
}
|
|
@@ -232,50 +232,50 @@ __name(validate, "validate");
|
|
|
232
232
|
|
|
233
233
|
// src/components/Assertions.ts
|
|
234
234
|
var import_v102 = require("discord-api-types/v10");
|
|
235
|
-
var
|
|
235
|
+
var import_zod3 = require("zod");
|
|
236
236
|
|
|
237
237
|
// src/Assertions.ts
|
|
238
238
|
var import_v10 = require("discord-api-types/v10");
|
|
239
|
-
var
|
|
240
|
-
var customIdPredicate =
|
|
241
|
-
var memberPermissionsPredicate =
|
|
242
|
-
var localeMapPredicate =
|
|
243
|
-
Object.fromEntries(Object.values(import_v10.Locale).map((loc) => [loc,
|
|
239
|
+
var import_zod2 = require("zod");
|
|
240
|
+
var customIdPredicate = import_zod2.z.string().min(1).max(100);
|
|
241
|
+
var memberPermissionsPredicate = import_zod2.z.coerce.bigint();
|
|
242
|
+
var localeMapPredicate = import_zod2.z.strictObject(
|
|
243
|
+
Object.fromEntries(Object.values(import_v10.Locale).map((loc) => [loc, import_zod2.z.string().optional()]))
|
|
244
244
|
);
|
|
245
245
|
|
|
246
246
|
// src/components/Assertions.ts
|
|
247
|
-
var labelPredicate =
|
|
248
|
-
var emojiPredicate =
|
|
249
|
-
id:
|
|
250
|
-
name:
|
|
251
|
-
animated:
|
|
247
|
+
var labelPredicate = import_zod3.z.string().min(1).max(80);
|
|
248
|
+
var emojiPredicate = import_zod3.z.strictObject({
|
|
249
|
+
id: import_zod3.z.string().optional(),
|
|
250
|
+
name: import_zod3.z.string().min(2).max(32).optional(),
|
|
251
|
+
animated: import_zod3.z.boolean().optional()
|
|
252
252
|
}).refine((data) => data.id !== void 0 || data.name !== void 0, {
|
|
253
253
|
error: "Either 'id' or 'name' must be provided"
|
|
254
254
|
});
|
|
255
|
-
var buttonPredicateBase =
|
|
256
|
-
type:
|
|
257
|
-
disabled:
|
|
255
|
+
var buttonPredicateBase = import_zod3.z.strictObject({
|
|
256
|
+
type: import_zod3.z.literal(import_v102.ComponentType.Button),
|
|
257
|
+
disabled: import_zod3.z.boolean().optional()
|
|
258
258
|
});
|
|
259
259
|
var buttonCustomIdPredicateBase = buttonPredicateBase.extend({
|
|
260
260
|
custom_id: customIdPredicate,
|
|
261
261
|
emoji: emojiPredicate.optional(),
|
|
262
262
|
label: labelPredicate
|
|
263
263
|
});
|
|
264
|
-
var buttonPrimaryPredicate = buttonCustomIdPredicateBase.extend({ style:
|
|
265
|
-
var buttonSecondaryPredicate = buttonCustomIdPredicateBase.extend({ style:
|
|
266
|
-
var buttonSuccessPredicate = buttonCustomIdPredicateBase.extend({ style:
|
|
267
|
-
var buttonDangerPredicate = buttonCustomIdPredicateBase.extend({ style:
|
|
264
|
+
var buttonPrimaryPredicate = buttonCustomIdPredicateBase.extend({ style: import_zod3.z.literal(import_v102.ButtonStyle.Primary) });
|
|
265
|
+
var buttonSecondaryPredicate = buttonCustomIdPredicateBase.extend({ style: import_zod3.z.literal(import_v102.ButtonStyle.Secondary) });
|
|
266
|
+
var buttonSuccessPredicate = buttonCustomIdPredicateBase.extend({ style: import_zod3.z.literal(import_v102.ButtonStyle.Success) });
|
|
267
|
+
var buttonDangerPredicate = buttonCustomIdPredicateBase.extend({ style: import_zod3.z.literal(import_v102.ButtonStyle.Danger) });
|
|
268
268
|
var buttonLinkPredicate = buttonPredicateBase.extend({
|
|
269
|
-
style:
|
|
270
|
-
url:
|
|
269
|
+
style: import_zod3.z.literal(import_v102.ButtonStyle.Link),
|
|
270
|
+
url: import_zod3.z.url({ protocol: /^(?:https?|discord)$/ }),
|
|
271
271
|
emoji: emojiPredicate.optional(),
|
|
272
272
|
label: labelPredicate
|
|
273
273
|
});
|
|
274
274
|
var buttonPremiumPredicate = buttonPredicateBase.extend({
|
|
275
|
-
style:
|
|
276
|
-
sku_id:
|
|
275
|
+
style: import_zod3.z.literal(import_v102.ButtonStyle.Premium),
|
|
276
|
+
sku_id: import_zod3.z.string()
|
|
277
277
|
});
|
|
278
|
-
var buttonPredicate =
|
|
278
|
+
var buttonPredicate = import_zod3.z.discriminatedUnion("style", [
|
|
279
279
|
buttonLinkPredicate,
|
|
280
280
|
buttonPrimaryPredicate,
|
|
281
281
|
buttonSecondaryPredicate,
|
|
@@ -283,38 +283,38 @@ var buttonPredicate = import_v43.z.discriminatedUnion("style", [
|
|
|
283
283
|
buttonDangerPredicate,
|
|
284
284
|
buttonPremiumPredicate
|
|
285
285
|
]);
|
|
286
|
-
var selectMenuBasePredicate =
|
|
287
|
-
placeholder:
|
|
288
|
-
min_values:
|
|
289
|
-
max_values:
|
|
286
|
+
var selectMenuBasePredicate = import_zod3.z.object({
|
|
287
|
+
placeholder: import_zod3.z.string().max(150).optional(),
|
|
288
|
+
min_values: import_zod3.z.number().min(0).max(25).optional(),
|
|
289
|
+
max_values: import_zod3.z.number().min(0).max(25).optional(),
|
|
290
290
|
custom_id: customIdPredicate,
|
|
291
|
-
disabled:
|
|
291
|
+
disabled: import_zod3.z.boolean().optional()
|
|
292
292
|
});
|
|
293
293
|
var selectMenuChannelPredicate = selectMenuBasePredicate.extend({
|
|
294
|
-
type:
|
|
295
|
-
channel_types:
|
|
296
|
-
default_values:
|
|
294
|
+
type: import_zod3.z.literal(import_v102.ComponentType.ChannelSelect),
|
|
295
|
+
channel_types: import_zod3.z.enum(import_v102.ChannelType).array().optional(),
|
|
296
|
+
default_values: import_zod3.z.object({ id: import_zod3.z.string(), type: import_zod3.z.literal(import_v102.SelectMenuDefaultValueType.Channel) }).array().max(25).optional()
|
|
297
297
|
});
|
|
298
298
|
var selectMenuMentionablePredicate = selectMenuBasePredicate.extend({
|
|
299
|
-
type:
|
|
300
|
-
default_values:
|
|
301
|
-
id:
|
|
302
|
-
type:
|
|
299
|
+
type: import_zod3.z.literal(import_v102.ComponentType.MentionableSelect),
|
|
300
|
+
default_values: import_zod3.z.object({
|
|
301
|
+
id: import_zod3.z.string(),
|
|
302
|
+
type: import_zod3.z.literal([import_v102.SelectMenuDefaultValueType.Role, import_v102.SelectMenuDefaultValueType.User])
|
|
303
303
|
}).array().max(25).optional()
|
|
304
304
|
});
|
|
305
305
|
var selectMenuRolePredicate = selectMenuBasePredicate.extend({
|
|
306
|
-
type:
|
|
307
|
-
default_values:
|
|
306
|
+
type: import_zod3.z.literal(import_v102.ComponentType.RoleSelect),
|
|
307
|
+
default_values: import_zod3.z.object({ id: import_zod3.z.string(), type: import_zod3.z.literal(import_v102.SelectMenuDefaultValueType.Role) }).array().max(25).optional()
|
|
308
308
|
});
|
|
309
|
-
var selectMenuStringOptionPredicate =
|
|
309
|
+
var selectMenuStringOptionPredicate = import_zod3.z.object({
|
|
310
310
|
label: labelPredicate,
|
|
311
|
-
value:
|
|
312
|
-
description:
|
|
311
|
+
value: import_zod3.z.string().min(1).max(100),
|
|
312
|
+
description: import_zod3.z.string().min(1).max(100).optional(),
|
|
313
313
|
emoji: emojiPredicate.optional(),
|
|
314
|
-
default:
|
|
314
|
+
default: import_zod3.z.boolean().optional()
|
|
315
315
|
});
|
|
316
316
|
var selectMenuStringPredicate = selectMenuBasePredicate.extend({
|
|
317
|
-
type:
|
|
317
|
+
type: import_zod3.z.literal(import_v102.ComponentType.StringSelect),
|
|
318
318
|
options: selectMenuStringOptionPredicate.array().min(1).max(25)
|
|
319
319
|
}).check((ctx) => {
|
|
320
320
|
const addIssue = /* @__PURE__ */ __name((name, minimum) => ctx.issues.push({
|
|
@@ -335,15 +335,15 @@ var selectMenuStringPredicate = selectMenuBasePredicate.extend({
|
|
|
335
335
|
}
|
|
336
336
|
});
|
|
337
337
|
var selectMenuUserPredicate = selectMenuBasePredicate.extend({
|
|
338
|
-
type:
|
|
339
|
-
default_values:
|
|
338
|
+
type: import_zod3.z.literal(import_v102.ComponentType.UserSelect),
|
|
339
|
+
default_values: import_zod3.z.object({ id: import_zod3.z.string(), type: import_zod3.z.literal(import_v102.SelectMenuDefaultValueType.User) }).array().max(25).optional()
|
|
340
340
|
});
|
|
341
|
-
var actionRowPredicate =
|
|
342
|
-
type:
|
|
343
|
-
components:
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
type:
|
|
341
|
+
var actionRowPredicate = import_zod3.z.object({
|
|
342
|
+
type: import_zod3.z.literal(import_v102.ComponentType.ActionRow),
|
|
343
|
+
components: import_zod3.z.union([
|
|
344
|
+
import_zod3.z.object({ type: import_zod3.z.literal(import_v102.ComponentType.Button) }).array().min(1).max(5),
|
|
345
|
+
import_zod3.z.object({
|
|
346
|
+
type: import_zod3.z.literal([
|
|
347
347
|
import_v102.ComponentType.ChannelSelect,
|
|
348
348
|
import_v102.ComponentType.MentionableSelect,
|
|
349
349
|
import_v102.ComponentType.StringSelect,
|
|
@@ -1157,17 +1157,17 @@ var import_v1012 = require("discord-api-types/v10");
|
|
|
1157
1157
|
|
|
1158
1158
|
// src/components/textInput/Assertions.ts
|
|
1159
1159
|
var import_v1011 = require("discord-api-types/v10");
|
|
1160
|
-
var
|
|
1161
|
-
var textInputPredicate =
|
|
1162
|
-
type:
|
|
1160
|
+
var import_zod4 = require("zod");
|
|
1161
|
+
var textInputPredicate = import_zod4.z.object({
|
|
1162
|
+
type: import_zod4.z.literal(import_v1011.ComponentType.TextInput),
|
|
1163
1163
|
custom_id: customIdPredicate,
|
|
1164
|
-
label:
|
|
1165
|
-
style:
|
|
1166
|
-
min_length:
|
|
1167
|
-
max_length:
|
|
1168
|
-
placeholder:
|
|
1169
|
-
value:
|
|
1170
|
-
required:
|
|
1164
|
+
label: import_zod4.z.string().min(1).max(45),
|
|
1165
|
+
style: import_zod4.z.enum(import_v1011.TextInputStyle),
|
|
1166
|
+
min_length: import_zod4.z.number().min(0).max(4e3).optional(),
|
|
1167
|
+
max_length: import_zod4.z.number().min(1).max(4e3).optional(),
|
|
1168
|
+
placeholder: import_zod4.z.string().max(100).optional(),
|
|
1169
|
+
value: import_zod4.z.string().min(1).max(4e3).optional(),
|
|
1170
|
+
required: import_zod4.z.boolean().optional()
|
|
1171
1171
|
});
|
|
1172
1172
|
|
|
1173
1173
|
// src/components/textInput/TextInput.ts
|
|
@@ -1327,47 +1327,47 @@ var import_v1020 = require("discord-api-types/v10");
|
|
|
1327
1327
|
|
|
1328
1328
|
// src/components/v2/Assertions.ts
|
|
1329
1329
|
var import_v1013 = require("discord-api-types/v10");
|
|
1330
|
-
var
|
|
1331
|
-
var unfurledMediaItemPredicate =
|
|
1332
|
-
url:
|
|
1330
|
+
var import_zod5 = require("zod");
|
|
1331
|
+
var unfurledMediaItemPredicate = import_zod5.z.object({
|
|
1332
|
+
url: import_zod5.z.url({ protocol: /^(?:https?|attachment)$/ })
|
|
1333
1333
|
});
|
|
1334
|
-
var thumbnailPredicate =
|
|
1334
|
+
var thumbnailPredicate = import_zod5.z.object({
|
|
1335
1335
|
media: unfurledMediaItemPredicate,
|
|
1336
|
-
description:
|
|
1337
|
-
spoiler:
|
|
1336
|
+
description: import_zod5.z.string().min(1).max(1024).nullish(),
|
|
1337
|
+
spoiler: import_zod5.z.boolean().optional()
|
|
1338
1338
|
});
|
|
1339
|
-
var unfurledMediaItemAttachmentOnlyPredicate =
|
|
1340
|
-
url:
|
|
1339
|
+
var unfurledMediaItemAttachmentOnlyPredicate = import_zod5.z.object({
|
|
1340
|
+
url: import_zod5.z.url({ protocol: /^attachment$/ })
|
|
1341
1341
|
});
|
|
1342
|
-
var filePredicate =
|
|
1342
|
+
var filePredicate = import_zod5.z.object({
|
|
1343
1343
|
file: unfurledMediaItemAttachmentOnlyPredicate,
|
|
1344
|
-
spoiler:
|
|
1344
|
+
spoiler: import_zod5.z.boolean().optional()
|
|
1345
1345
|
});
|
|
1346
|
-
var separatorPredicate =
|
|
1347
|
-
divider:
|
|
1348
|
-
spacing:
|
|
1346
|
+
var separatorPredicate = import_zod5.z.object({
|
|
1347
|
+
divider: import_zod5.z.boolean().optional(),
|
|
1348
|
+
spacing: import_zod5.z.enum(import_v1013.SeparatorSpacingSize).optional()
|
|
1349
1349
|
});
|
|
1350
|
-
var textDisplayPredicate =
|
|
1351
|
-
content:
|
|
1350
|
+
var textDisplayPredicate = import_zod5.z.object({
|
|
1351
|
+
content: import_zod5.z.string().min(1).max(4e3)
|
|
1352
1352
|
});
|
|
1353
|
-
var mediaGalleryItemPredicate =
|
|
1353
|
+
var mediaGalleryItemPredicate = import_zod5.z.object({
|
|
1354
1354
|
media: unfurledMediaItemPredicate,
|
|
1355
|
-
description:
|
|
1356
|
-
spoiler:
|
|
1355
|
+
description: import_zod5.z.string().min(1).max(1024).nullish(),
|
|
1356
|
+
spoiler: import_zod5.z.boolean().optional()
|
|
1357
1357
|
});
|
|
1358
|
-
var mediaGalleryPredicate =
|
|
1359
|
-
items:
|
|
1358
|
+
var mediaGalleryPredicate = import_zod5.z.object({
|
|
1359
|
+
items: import_zod5.z.array(mediaGalleryItemPredicate).min(1).max(10)
|
|
1360
1360
|
});
|
|
1361
|
-
var sectionPredicate =
|
|
1362
|
-
components:
|
|
1363
|
-
accessory:
|
|
1364
|
-
|
|
1365
|
-
|
|
1361
|
+
var sectionPredicate = import_zod5.z.object({
|
|
1362
|
+
components: import_zod5.z.array(textDisplayPredicate).min(1).max(3),
|
|
1363
|
+
accessory: import_zod5.z.union([
|
|
1364
|
+
import_zod5.z.object({ type: import_zod5.z.literal(import_v1013.ComponentType.Button) }),
|
|
1365
|
+
import_zod5.z.object({ type: import_zod5.z.literal(import_v1013.ComponentType.Thumbnail) })
|
|
1366
1366
|
])
|
|
1367
1367
|
});
|
|
1368
|
-
var containerPredicate =
|
|
1369
|
-
components:
|
|
1370
|
-
|
|
1368
|
+
var containerPredicate = import_zod5.z.object({
|
|
1369
|
+
components: import_zod5.z.array(
|
|
1370
|
+
import_zod5.z.union([
|
|
1371
1371
|
actionRowPredicate,
|
|
1372
1372
|
filePredicate,
|
|
1373
1373
|
mediaGalleryPredicate,
|
|
@@ -1376,8 +1376,8 @@ var containerPredicate = import_v45.z.object({
|
|
|
1376
1376
|
textDisplayPredicate
|
|
1377
1377
|
])
|
|
1378
1378
|
).min(1),
|
|
1379
|
-
spoiler:
|
|
1380
|
-
accent_color:
|
|
1379
|
+
spoiler: import_zod5.z.boolean().optional(),
|
|
1380
|
+
accent_color: import_zod5.z.int().min(0).max(16777215).nullish()
|
|
1381
1381
|
});
|
|
1382
1382
|
|
|
1383
1383
|
// src/components/v2/File.ts
|
|
@@ -2730,33 +2730,33 @@ var SharedNameAndDescription = class extends SharedName {
|
|
|
2730
2730
|
|
|
2731
2731
|
// src/interactions/commands/chatInput/Assertions.ts
|
|
2732
2732
|
var import_v1024 = require("discord-api-types/v10");
|
|
2733
|
-
var
|
|
2734
|
-
var namePredicate =
|
|
2735
|
-
var descriptionPredicate =
|
|
2736
|
-
var sharedNameAndDescriptionPredicate =
|
|
2733
|
+
var import_zod6 = require("zod");
|
|
2734
|
+
var namePredicate = import_zod6.z.string().min(1).max(32).regex(/^[\p{Ll}\p{Lm}\p{Lo}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u);
|
|
2735
|
+
var descriptionPredicate = import_zod6.z.string().min(1).max(100);
|
|
2736
|
+
var sharedNameAndDescriptionPredicate = import_zod6.z.object({
|
|
2737
2737
|
name: namePredicate,
|
|
2738
2738
|
name_localizations: localeMapPredicate.optional(),
|
|
2739
2739
|
description: descriptionPredicate,
|
|
2740
2740
|
description_localizations: localeMapPredicate.optional()
|
|
2741
2741
|
});
|
|
2742
|
-
var numericMixinNumberOptionPredicate =
|
|
2743
|
-
max_value:
|
|
2744
|
-
min_value:
|
|
2742
|
+
var numericMixinNumberOptionPredicate = import_zod6.z.object({
|
|
2743
|
+
max_value: import_zod6.z.float32().optional(),
|
|
2744
|
+
min_value: import_zod6.z.float32().optional()
|
|
2745
2745
|
});
|
|
2746
|
-
var numericMixinIntegerOptionPredicate =
|
|
2747
|
-
max_value:
|
|
2748
|
-
min_value:
|
|
2746
|
+
var numericMixinIntegerOptionPredicate = import_zod6.z.object({
|
|
2747
|
+
max_value: import_zod6.z.int().optional(),
|
|
2748
|
+
min_value: import_zod6.z.int().optional()
|
|
2749
2749
|
});
|
|
2750
|
-
var channelMixinOptionPredicate =
|
|
2751
|
-
channel_types:
|
|
2750
|
+
var channelMixinOptionPredicate = import_zod6.z.object({
|
|
2751
|
+
channel_types: import_zod6.z.literal(ApplicationCommandOptionAllowedChannelTypes).array().optional()
|
|
2752
2752
|
});
|
|
2753
|
-
var autocompleteMixinOptionPredicate =
|
|
2754
|
-
autocomplete:
|
|
2755
|
-
choices:
|
|
2753
|
+
var autocompleteMixinOptionPredicate = import_zod6.z.object({
|
|
2754
|
+
autocomplete: import_zod6.z.literal(true),
|
|
2755
|
+
choices: import_zod6.z.union([import_zod6.z.never(), import_zod6.z.never().array(), import_zod6.z.undefined()])
|
|
2756
2756
|
});
|
|
2757
|
-
var choiceValueStringPredicate =
|
|
2758
|
-
var choiceValueNumberPredicate =
|
|
2759
|
-
var choiceBasePredicate =
|
|
2757
|
+
var choiceValueStringPredicate = import_zod6.z.string().min(1).max(100);
|
|
2758
|
+
var choiceValueNumberPredicate = import_zod6.z.number();
|
|
2759
|
+
var choiceBasePredicate = import_zod6.z.object({
|
|
2760
2760
|
name: choiceValueStringPredicate,
|
|
2761
2761
|
name_localizations: localeMapPredicate.optional()
|
|
2762
2762
|
});
|
|
@@ -2766,8 +2766,8 @@ var choiceStringPredicate = choiceBasePredicate.extend({
|
|
|
2766
2766
|
var choiceNumberPredicate = choiceBasePredicate.extend({
|
|
2767
2767
|
value: choiceValueNumberPredicate
|
|
2768
2768
|
});
|
|
2769
|
-
var choiceBaseMixinPredicate =
|
|
2770
|
-
autocomplete:
|
|
2769
|
+
var choiceBaseMixinPredicate = import_zod6.z.object({
|
|
2770
|
+
autocomplete: import_zod6.z.literal(false).optional()
|
|
2771
2771
|
});
|
|
2772
2772
|
var choiceStringMixinPredicate = choiceBaseMixinPredicate.extend({
|
|
2773
2773
|
choices: choiceStringPredicate.array().max(25).optional()
|
|
@@ -2775,7 +2775,7 @@ var choiceStringMixinPredicate = choiceBaseMixinPredicate.extend({
|
|
|
2775
2775
|
var choiceNumberMixinPredicate = choiceBaseMixinPredicate.extend({
|
|
2776
2776
|
choices: choiceNumberPredicate.array().max(25).optional()
|
|
2777
2777
|
});
|
|
2778
|
-
var basicOptionTypesPredicate =
|
|
2778
|
+
var basicOptionTypesPredicate = import_zod6.z.literal([
|
|
2779
2779
|
import_v1024.ApplicationCommandOptionType.Attachment,
|
|
2780
2780
|
import_v1024.ApplicationCommandOptionType.Boolean,
|
|
2781
2781
|
import_v1024.ApplicationCommandOptionType.Channel,
|
|
@@ -2787,54 +2787,54 @@ var basicOptionTypesPredicate = import_v46.z.literal([
|
|
|
2787
2787
|
import_v1024.ApplicationCommandOptionType.User
|
|
2788
2788
|
]);
|
|
2789
2789
|
var basicOptionPredicate = sharedNameAndDescriptionPredicate.extend({
|
|
2790
|
-
required:
|
|
2790
|
+
required: import_zod6.z.boolean().optional(),
|
|
2791
2791
|
type: basicOptionTypesPredicate
|
|
2792
2792
|
});
|
|
2793
|
-
var autocompleteOrStringChoicesMixinOptionPredicate =
|
|
2793
|
+
var autocompleteOrStringChoicesMixinOptionPredicate = import_zod6.z.discriminatedUnion("autocomplete", [
|
|
2794
2794
|
autocompleteMixinOptionPredicate,
|
|
2795
2795
|
choiceStringMixinPredicate
|
|
2796
2796
|
]);
|
|
2797
|
-
var autocompleteOrNumberChoicesMixinOptionPredicate =
|
|
2797
|
+
var autocompleteOrNumberChoicesMixinOptionPredicate = import_zod6.z.discriminatedUnion("autocomplete", [
|
|
2798
2798
|
autocompleteMixinOptionPredicate,
|
|
2799
2799
|
choiceNumberMixinPredicate
|
|
2800
2800
|
]);
|
|
2801
|
-
var channelOptionPredicate =
|
|
2801
|
+
var channelOptionPredicate = import_zod6.z.object({
|
|
2802
2802
|
...basicOptionPredicate.shape,
|
|
2803
2803
|
...channelMixinOptionPredicate.shape
|
|
2804
2804
|
});
|
|
2805
|
-
var integerOptionPredicate =
|
|
2805
|
+
var integerOptionPredicate = import_zod6.z.object({
|
|
2806
2806
|
...basicOptionPredicate.shape,
|
|
2807
2807
|
...numericMixinIntegerOptionPredicate.shape
|
|
2808
2808
|
}).and(autocompleteOrNumberChoicesMixinOptionPredicate);
|
|
2809
|
-
var numberOptionPredicate =
|
|
2809
|
+
var numberOptionPredicate = import_zod6.z.object({
|
|
2810
2810
|
...basicOptionPredicate.shape,
|
|
2811
2811
|
...numericMixinNumberOptionPredicate.shape
|
|
2812
2812
|
}).and(autocompleteOrNumberChoicesMixinOptionPredicate);
|
|
2813
2813
|
var stringOptionPredicate = basicOptionPredicate.extend({
|
|
2814
|
-
max_length:
|
|
2815
|
-
min_length:
|
|
2814
|
+
max_length: import_zod6.z.number().min(0).max(6e3).optional(),
|
|
2815
|
+
min_length: import_zod6.z.number().min(1).max(6e3).optional()
|
|
2816
2816
|
}).and(autocompleteOrStringChoicesMixinOptionPredicate);
|
|
2817
2817
|
var baseChatInputCommandPredicate = sharedNameAndDescriptionPredicate.extend({
|
|
2818
|
-
contexts:
|
|
2818
|
+
contexts: import_zod6.z.array(import_zod6.z.enum(import_v1024.InteractionContextType)).optional(),
|
|
2819
2819
|
default_member_permissions: memberPermissionsPredicate.optional(),
|
|
2820
|
-
integration_types:
|
|
2821
|
-
nsfw:
|
|
2820
|
+
integration_types: import_zod6.z.array(import_zod6.z.enum(import_v1024.ApplicationIntegrationType)).optional(),
|
|
2821
|
+
nsfw: import_zod6.z.boolean().optional()
|
|
2822
2822
|
});
|
|
2823
|
-
var chatInputCommandOptionsPredicate =
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2823
|
+
var chatInputCommandOptionsPredicate = import_zod6.z.union([
|
|
2824
|
+
import_zod6.z.object({ type: basicOptionTypesPredicate }).array(),
|
|
2825
|
+
import_zod6.z.object({ type: import_zod6.z.literal(import_v1024.ApplicationCommandOptionType.Subcommand) }).array(),
|
|
2826
|
+
import_zod6.z.object({ type: import_zod6.z.literal(import_v1024.ApplicationCommandOptionType.SubcommandGroup) }).array()
|
|
2827
2827
|
]);
|
|
2828
2828
|
var chatInputCommandPredicate = baseChatInputCommandPredicate.extend({
|
|
2829
2829
|
options: chatInputCommandOptionsPredicate.optional()
|
|
2830
2830
|
});
|
|
2831
2831
|
var chatInputCommandSubcommandGroupPredicate = sharedNameAndDescriptionPredicate.extend({
|
|
2832
|
-
type:
|
|
2833
|
-
options:
|
|
2832
|
+
type: import_zod6.z.literal(import_v1024.ApplicationCommandOptionType.SubcommandGroup),
|
|
2833
|
+
options: import_zod6.z.array(import_zod6.z.object({ type: import_zod6.z.literal(import_v1024.ApplicationCommandOptionType.Subcommand) })).min(1).max(25)
|
|
2834
2834
|
});
|
|
2835
2835
|
var chatInputCommandSubcommandPredicate = sharedNameAndDescriptionPredicate.extend({
|
|
2836
|
-
type:
|
|
2837
|
-
options:
|
|
2836
|
+
type: import_zod6.z.literal(import_v1024.ApplicationCommandOptionType.Subcommand),
|
|
2837
|
+
options: import_zod6.z.array(import_zod6.z.object({ type: basicOptionTypesPredicate })).max(25)
|
|
2838
2838
|
});
|
|
2839
2839
|
|
|
2840
2840
|
// src/interactions/commands/chatInput/options/ApplicationCommandOptionBase.ts
|
|
@@ -3383,23 +3383,23 @@ var ChatInputCommandBuilder = class extends (0, import_ts_mixer8.Mixin)(
|
|
|
3383
3383
|
|
|
3384
3384
|
// src/interactions/commands/contextMenu/Assertions.ts
|
|
3385
3385
|
var import_v1036 = require("discord-api-types/v10");
|
|
3386
|
-
var
|
|
3387
|
-
var namePredicate2 =
|
|
3388
|
-
var contextsPredicate =
|
|
3389
|
-
var integrationTypesPredicate =
|
|
3390
|
-
var baseContextMenuCommandPredicate =
|
|
3386
|
+
var import_zod7 = require("zod");
|
|
3387
|
+
var namePredicate2 = import_zod7.z.string().min(1).max(32).regex(/^(?:(?: *[\p{P}\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}\p{Extended_Pictographic}\p{Emoji_Component}]) *)+$/u);
|
|
3388
|
+
var contextsPredicate = import_zod7.z.array(import_zod7.z.enum(import_v1036.InteractionContextType));
|
|
3389
|
+
var integrationTypesPredicate = import_zod7.z.array(import_zod7.z.enum(import_v1036.ApplicationIntegrationType));
|
|
3390
|
+
var baseContextMenuCommandPredicate = import_zod7.z.object({
|
|
3391
3391
|
contexts: contextsPredicate.optional(),
|
|
3392
3392
|
default_member_permissions: memberPermissionsPredicate.optional(),
|
|
3393
3393
|
name: namePredicate2,
|
|
3394
3394
|
name_localizations: localeMapPredicate.optional(),
|
|
3395
3395
|
integration_types: integrationTypesPredicate.optional(),
|
|
3396
|
-
nsfw:
|
|
3396
|
+
nsfw: import_zod7.z.boolean().optional()
|
|
3397
3397
|
});
|
|
3398
3398
|
var userCommandPredicate = baseContextMenuCommandPredicate.extend({
|
|
3399
|
-
type:
|
|
3399
|
+
type: import_zod7.z.literal(import_v1036.ApplicationCommandType.User)
|
|
3400
3400
|
});
|
|
3401
3401
|
var messageCommandPredicate = baseContextMenuCommandPredicate.extend({
|
|
3402
|
-
type:
|
|
3402
|
+
type: import_zod7.z.literal(import_v1036.ApplicationCommandType.Message)
|
|
3403
3403
|
});
|
|
3404
3404
|
|
|
3405
3405
|
// src/interactions/commands/contextMenu/ContextMenuCommand.ts
|
|
@@ -3462,14 +3462,14 @@ var UserContextCommandBuilder = class extends ContextMenuCommandBuilder {
|
|
|
3462
3462
|
|
|
3463
3463
|
// src/interactions/modals/Assertions.ts
|
|
3464
3464
|
var import_v1039 = require("discord-api-types/v10");
|
|
3465
|
-
var
|
|
3466
|
-
var titlePredicate =
|
|
3467
|
-
var modalPredicate =
|
|
3465
|
+
var import_zod8 = require("zod");
|
|
3466
|
+
var titlePredicate = import_zod8.z.string().min(1).max(45);
|
|
3467
|
+
var modalPredicate = import_zod8.z.object({
|
|
3468
3468
|
title: titlePredicate,
|
|
3469
3469
|
custom_id: customIdPredicate,
|
|
3470
|
-
components:
|
|
3471
|
-
type:
|
|
3472
|
-
components:
|
|
3470
|
+
components: import_zod8.z.object({
|
|
3471
|
+
type: import_zod8.z.literal(import_v1039.ComponentType.ActionRow),
|
|
3472
|
+
components: import_zod8.z.object({ type: import_zod8.z.literal(import_v1039.ComponentType.TextInput) }).array().length(1)
|
|
3473
3473
|
}).array().min(1).max(5)
|
|
3474
3474
|
});
|
|
3475
3475
|
|
|
@@ -3592,7 +3592,7 @@ var ModalBuilder = class {
|
|
|
3592
3592
|
};
|
|
3593
3593
|
|
|
3594
3594
|
// src/messages/embed/Assertions.ts
|
|
3595
|
-
var
|
|
3595
|
+
var import_zod9 = require("zod");
|
|
3596
3596
|
|
|
3597
3597
|
// src/util/componentUtil.ts
|
|
3598
3598
|
function embedLength(data) {
|
|
@@ -3601,34 +3601,34 @@ function embedLength(data) {
|
|
|
3601
3601
|
__name(embedLength, "embedLength");
|
|
3602
3602
|
|
|
3603
3603
|
// src/messages/embed/Assertions.ts
|
|
3604
|
-
var namePredicate3 =
|
|
3605
|
-
var URLPredicate =
|
|
3606
|
-
var URLWithAttachmentProtocolPredicate =
|
|
3607
|
-
var embedFieldPredicate =
|
|
3604
|
+
var namePredicate3 = import_zod9.z.string().max(256);
|
|
3605
|
+
var URLPredicate = import_zod9.z.url({ protocol: /^https?$/ });
|
|
3606
|
+
var URLWithAttachmentProtocolPredicate = import_zod9.z.url({ protocol: /^(?:https?|attachment)$/ });
|
|
3607
|
+
var embedFieldPredicate = import_zod9.z.object({
|
|
3608
3608
|
name: namePredicate3,
|
|
3609
|
-
value:
|
|
3610
|
-
inline:
|
|
3609
|
+
value: import_zod9.z.string().max(1024),
|
|
3610
|
+
inline: import_zod9.z.boolean().optional()
|
|
3611
3611
|
});
|
|
3612
|
-
var embedAuthorPredicate =
|
|
3612
|
+
var embedAuthorPredicate = import_zod9.z.object({
|
|
3613
3613
|
name: namePredicate3.min(1),
|
|
3614
3614
|
icon_url: URLWithAttachmentProtocolPredicate.optional(),
|
|
3615
3615
|
url: URLPredicate.optional()
|
|
3616
3616
|
});
|
|
3617
|
-
var embedFooterPredicate =
|
|
3618
|
-
text:
|
|
3617
|
+
var embedFooterPredicate = import_zod9.z.object({
|
|
3618
|
+
text: import_zod9.z.string().min(1).max(2048),
|
|
3619
3619
|
icon_url: URLWithAttachmentProtocolPredicate.optional()
|
|
3620
3620
|
});
|
|
3621
|
-
var embedPredicate =
|
|
3621
|
+
var embedPredicate = import_zod9.z.object({
|
|
3622
3622
|
title: namePredicate3.min(1).optional(),
|
|
3623
|
-
description:
|
|
3623
|
+
description: import_zod9.z.string().min(1).max(4096).optional(),
|
|
3624
3624
|
url: URLPredicate.optional(),
|
|
3625
|
-
timestamp:
|
|
3626
|
-
color:
|
|
3625
|
+
timestamp: import_zod9.z.string().optional(),
|
|
3626
|
+
color: import_zod9.z.int().min(0).max(16777215).optional(),
|
|
3627
3627
|
footer: embedFooterPredicate.optional(),
|
|
3628
|
-
image:
|
|
3629
|
-
thumbnail:
|
|
3628
|
+
image: import_zod9.z.object({ url: URLWithAttachmentProtocolPredicate }).optional(),
|
|
3629
|
+
thumbnail: import_zod9.z.object({ url: URLWithAttachmentProtocolPredicate }).optional(),
|
|
3630
3630
|
author: embedAuthorPredicate.optional(),
|
|
3631
|
-
fields:
|
|
3631
|
+
fields: import_zod9.z.array(embedFieldPredicate).max(25).optional()
|
|
3632
3632
|
}).refine(
|
|
3633
3633
|
(embed) => embed.title !== void 0 || embed.description !== void 0 || embed.fields !== void 0 && embed.fields.length > 0 || embed.footer !== void 0 || embed.author !== void 0 || embed.image !== void 0 || embed.thumbnail !== void 0,
|
|
3634
3634
|
{
|
|
@@ -4114,19 +4114,19 @@ var EmbedBuilder = class {
|
|
|
4114
4114
|
|
|
4115
4115
|
// src/messages/poll/Assertions.ts
|
|
4116
4116
|
var import_v1040 = require("discord-api-types/v10");
|
|
4117
|
-
var
|
|
4118
|
-
var pollQuestionPredicate =
|
|
4119
|
-
var pollAnswerMediaPredicate =
|
|
4120
|
-
text:
|
|
4117
|
+
var import_zod10 = require("zod");
|
|
4118
|
+
var pollQuestionPredicate = import_zod10.z.object({ text: import_zod10.z.string().min(1).max(300) });
|
|
4119
|
+
var pollAnswerMediaPredicate = import_zod10.z.object({
|
|
4120
|
+
text: import_zod10.z.string().min(1).max(55),
|
|
4121
4121
|
emoji: emojiPredicate.optional()
|
|
4122
4122
|
});
|
|
4123
|
-
var pollAnswerPredicate =
|
|
4124
|
-
var pollPredicate =
|
|
4123
|
+
var pollAnswerPredicate = import_zod10.z.object({ poll_media: pollAnswerMediaPredicate });
|
|
4124
|
+
var pollPredicate = import_zod10.z.object({
|
|
4125
4125
|
question: pollQuestionPredicate,
|
|
4126
|
-
answers:
|
|
4127
|
-
duration:
|
|
4128
|
-
allow_multiselect:
|
|
4129
|
-
layout_type:
|
|
4126
|
+
answers: import_zod10.z.array(pollAnswerPredicate).min(1).max(10),
|
|
4127
|
+
duration: import_zod10.z.number().min(1).max(768).optional(),
|
|
4128
|
+
allow_multiselect: import_zod10.z.boolean().optional(),
|
|
4129
|
+
layout_type: import_zod10.z.enum(import_v1040.PollLayoutType).optional()
|
|
4130
4130
|
});
|
|
4131
4131
|
|
|
4132
4132
|
// src/messages/poll/PollMedia.ts
|
|
@@ -4456,45 +4456,45 @@ var PollBuilder = class {
|
|
|
4456
4456
|
|
|
4457
4457
|
// src/messages/Assertions.ts
|
|
4458
4458
|
var import_v1041 = require("discord-api-types/v10");
|
|
4459
|
-
var
|
|
4460
|
-
var attachmentPredicate =
|
|
4461
|
-
id:
|
|
4462
|
-
description:
|
|
4463
|
-
duration_secs:
|
|
4464
|
-
filename:
|
|
4465
|
-
title:
|
|
4466
|
-
waveform:
|
|
4459
|
+
var import_zod11 = require("zod");
|
|
4460
|
+
var attachmentPredicate = import_zod11.z.object({
|
|
4461
|
+
id: import_zod11.z.union([import_zod11.z.string(), import_zod11.z.number()]),
|
|
4462
|
+
description: import_zod11.z.string().max(1024).optional(),
|
|
4463
|
+
duration_secs: import_zod11.z.number().max(2 ** 31 - 1).optional(),
|
|
4464
|
+
filename: import_zod11.z.string().max(1024).optional(),
|
|
4465
|
+
title: import_zod11.z.string().max(1024).optional(),
|
|
4466
|
+
waveform: import_zod11.z.string().max(400).optional()
|
|
4467
4467
|
});
|
|
4468
|
-
var allowedMentionPredicate =
|
|
4469
|
-
parse:
|
|
4470
|
-
roles:
|
|
4471
|
-
users:
|
|
4472
|
-
replied_user:
|
|
4468
|
+
var allowedMentionPredicate = import_zod11.z.object({
|
|
4469
|
+
parse: import_zod11.z.enum(import_v1041.AllowedMentionsTypes).array().optional(),
|
|
4470
|
+
roles: import_zod11.z.string().array().max(100).optional(),
|
|
4471
|
+
users: import_zod11.z.string().array().max(100).optional(),
|
|
4472
|
+
replied_user: import_zod11.z.boolean().optional()
|
|
4473
4473
|
}).refine(
|
|
4474
4474
|
(data) => !(data.parse?.includes(import_v1041.AllowedMentionsTypes.User) && data.users?.length || data.parse?.includes(import_v1041.AllowedMentionsTypes.Role) && data.roles?.length),
|
|
4475
4475
|
{
|
|
4476
4476
|
error: 'Cannot specify both parse: ["users"] and non-empty users array, or parse: ["roles"] and non-empty roles array. These are mutually exclusive'
|
|
4477
4477
|
}
|
|
4478
4478
|
);
|
|
4479
|
-
var messageReferencePredicate =
|
|
4480
|
-
channel_id:
|
|
4481
|
-
fail_if_not_exists:
|
|
4482
|
-
guild_id:
|
|
4483
|
-
message_id:
|
|
4484
|
-
type:
|
|
4479
|
+
var messageReferencePredicate = import_zod11.z.object({
|
|
4480
|
+
channel_id: import_zod11.z.string().optional(),
|
|
4481
|
+
fail_if_not_exists: import_zod11.z.boolean().optional(),
|
|
4482
|
+
guild_id: import_zod11.z.string().optional(),
|
|
4483
|
+
message_id: import_zod11.z.string(),
|
|
4484
|
+
type: import_zod11.z.enum(import_v1041.MessageReferenceType).optional()
|
|
4485
4485
|
});
|
|
4486
|
-
var baseMessagePredicate =
|
|
4487
|
-
nonce:
|
|
4488
|
-
tts:
|
|
4486
|
+
var baseMessagePredicate = import_zod11.z.object({
|
|
4487
|
+
nonce: import_zod11.z.union([import_zod11.z.string().max(25), import_zod11.z.number()]).optional(),
|
|
4488
|
+
tts: import_zod11.z.boolean().optional(),
|
|
4489
4489
|
allowed_mentions: allowedMentionPredicate.optional(),
|
|
4490
4490
|
message_reference: messageReferencePredicate.optional(),
|
|
4491
4491
|
attachments: attachmentPredicate.array().max(10).optional(),
|
|
4492
|
-
enforce_nonce:
|
|
4492
|
+
enforce_nonce: import_zod11.z.boolean().optional()
|
|
4493
4493
|
});
|
|
4494
|
-
var basicActionRowPredicate =
|
|
4495
|
-
type:
|
|
4496
|
-
components:
|
|
4497
|
-
type:
|
|
4494
|
+
var basicActionRowPredicate = import_zod11.z.object({
|
|
4495
|
+
type: import_zod11.z.literal(import_v1041.ComponentType.ActionRow),
|
|
4496
|
+
components: import_zod11.z.object({
|
|
4497
|
+
type: import_zod11.z.literal([
|
|
4498
4498
|
import_v1041.ComponentType.Button,
|
|
4499
4499
|
import_v1041.ComponentType.ChannelSelect,
|
|
4500
4500
|
import_v1041.ComponentType.MentionableSelect,
|
|
@@ -4505,22 +4505,22 @@ var basicActionRowPredicate = import_v411.z.object({
|
|
|
4505
4505
|
}).array()
|
|
4506
4506
|
});
|
|
4507
4507
|
var messageNoComponentsV2Predicate = baseMessagePredicate.extend({
|
|
4508
|
-
content:
|
|
4508
|
+
content: import_zod11.z.string().max(2e3).optional(),
|
|
4509
4509
|
embeds: embedPredicate.array().max(10).optional(),
|
|
4510
|
-
sticker_ids:
|
|
4510
|
+
sticker_ids: import_zod11.z.array(import_zod11.z.string()).max(3).optional(),
|
|
4511
4511
|
poll: pollPredicate.optional(),
|
|
4512
4512
|
components: basicActionRowPredicate.array().max(5).optional(),
|
|
4513
|
-
flags:
|
|
4513
|
+
flags: import_zod11.z.int().optional().refine((flags) => !flags || (flags & import_v1041.MessageFlags.IsComponentsV2) === 0, {
|
|
4514
4514
|
error: "Cannot set content, embeds, stickers, or poll with IsComponentsV2 flag set"
|
|
4515
4515
|
})
|
|
4516
4516
|
}).refine(
|
|
4517
4517
|
(data) => data.content !== void 0 || data.embeds !== void 0 && data.embeds.length > 0 || data.poll !== void 0 || data.attachments !== void 0 && data.attachments.length > 0 || data.components !== void 0 && data.components.length > 0 || data.sticker_ids !== void 0 && data.sticker_ids.length > 0,
|
|
4518
4518
|
{ error: "Messages must have content, embeds, a poll, attachments, components or stickers" }
|
|
4519
4519
|
);
|
|
4520
|
-
var allTopLevelComponentsPredicate =
|
|
4520
|
+
var allTopLevelComponentsPredicate = import_zod11.z.union([
|
|
4521
4521
|
basicActionRowPredicate,
|
|
4522
|
-
|
|
4523
|
-
type:
|
|
4522
|
+
import_zod11.z.object({
|
|
4523
|
+
type: import_zod11.z.literal([
|
|
4524
4524
|
// Components v2
|
|
4525
4525
|
import_v1041.ComponentType.Container,
|
|
4526
4526
|
import_v1041.ComponentType.File,
|
|
@@ -4534,16 +4534,16 @@ var allTopLevelComponentsPredicate = import_v411.z.union([
|
|
|
4534
4534
|
]).array().min(1).max(10);
|
|
4535
4535
|
var messageComponentsV2Predicate = baseMessagePredicate.extend({
|
|
4536
4536
|
components: allTopLevelComponentsPredicate,
|
|
4537
|
-
flags:
|
|
4537
|
+
flags: import_zod11.z.int().refine((flags) => (flags & import_v1041.MessageFlags.IsComponentsV2) === import_v1041.MessageFlags.IsComponentsV2, {
|
|
4538
4538
|
error: "Must set IsComponentsV2 flag to use Components V2"
|
|
4539
4539
|
}),
|
|
4540
4540
|
// These fields cannot be set
|
|
4541
|
-
content:
|
|
4542
|
-
embeds:
|
|
4543
|
-
sticker_ids:
|
|
4544
|
-
poll:
|
|
4541
|
+
content: import_zod11.z.string().length(0).nullish(),
|
|
4542
|
+
embeds: import_zod11.z.array(import_zod11.z.never()).nullish(),
|
|
4543
|
+
sticker_ids: import_zod11.z.array(import_zod11.z.never()).nullish(),
|
|
4544
|
+
poll: import_zod11.z.null().optional()
|
|
4545
4545
|
});
|
|
4546
|
-
var messagePredicate =
|
|
4546
|
+
var messagePredicate = import_zod11.z.union([messageNoComponentsV2Predicate, messageComponentsV2Predicate]);
|
|
4547
4547
|
|
|
4548
4548
|
// src/messages/AllowedMentions.ts
|
|
4549
4549
|
var AllowedMentionsBuilder = class {
|
|
@@ -5433,7 +5433,7 @@ var MessageBuilder = class {
|
|
|
5433
5433
|
};
|
|
5434
5434
|
|
|
5435
5435
|
// src/index.ts
|
|
5436
|
-
var version = "2.0.0-dev.
|
|
5436
|
+
var version = "2.0.0-dev.1752452146-7e3d4e536";
|
|
5437
5437
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5438
5438
|
0 && (module.exports = {
|
|
5439
5439
|
ActionRowBuilder,
|