@discordjs/builders 2.0.0-dev.1751371559-02fbb706a → 2.0.0-dev.1751544354-e6d59eaf9
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 +357 -7583
- package/dist/index.d.ts +357 -7583
- package/dist/index.js +285 -272
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +284 -271
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -5
package/dist/index.js
CHANGED
|
@@ -88,6 +88,7 @@ __export(index_exports, {
|
|
|
88
88
|
ThumbnailBuilder: () => ThumbnailBuilder,
|
|
89
89
|
UserContextCommandBuilder: () => UserContextCommandBuilder,
|
|
90
90
|
UserSelectMenuBuilder: () => UserSelectMenuBuilder,
|
|
91
|
+
ValidationError: () => ValidationError,
|
|
91
92
|
actionRowPredicate: () => actionRowPredicate,
|
|
92
93
|
allowedMentionPredicate: () => allowedMentionPredicate,
|
|
93
94
|
attachmentPredicate: () => attachmentPredicate,
|
|
@@ -125,7 +126,6 @@ __export(index_exports, {
|
|
|
125
126
|
pollAnswerPredicate: () => pollAnswerPredicate,
|
|
126
127
|
pollPredicate: () => pollPredicate,
|
|
127
128
|
pollQuestionPredicate: () => pollQuestionPredicate,
|
|
128
|
-
refineURLPredicate: () => refineURLPredicate,
|
|
129
129
|
resolveAccessoryComponent: () => resolveAccessoryComponent,
|
|
130
130
|
resolveBuilder: () => resolveBuilder,
|
|
131
131
|
sectionPredicate: () => sectionPredicate,
|
|
@@ -184,8 +184,27 @@ var EmojiOrLabelButtonMixin = class {
|
|
|
184
184
|
}
|
|
185
185
|
};
|
|
186
186
|
|
|
187
|
+
// src/util/ValidationError.ts
|
|
188
|
+
var import_v4 = require("zod/v4");
|
|
189
|
+
var ValidationError = class extends Error {
|
|
190
|
+
static {
|
|
191
|
+
__name(this, "ValidationError");
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* The underlying cause of the validation error.
|
|
195
|
+
*/
|
|
196
|
+
cause;
|
|
197
|
+
/**
|
|
198
|
+
* @internal
|
|
199
|
+
*/
|
|
200
|
+
constructor(error) {
|
|
201
|
+
super(import_v4.z.prettifyError(error));
|
|
202
|
+
this.name = "ValidationError";
|
|
203
|
+
this.cause = error;
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
|
|
187
207
|
// src/util/validation.ts
|
|
188
|
-
var import_zod_validation_error = require("zod-validation-error");
|
|
189
208
|
var validationEnabled = true;
|
|
190
209
|
function enableValidators() {
|
|
191
210
|
return validationEnabled = true;
|
|
@@ -200,12 +219,12 @@ function isValidationEnabled() {
|
|
|
200
219
|
}
|
|
201
220
|
__name(isValidationEnabled, "isValidationEnabled");
|
|
202
221
|
function validate(validator, value, validationOverride) {
|
|
203
|
-
if (validationOverride === false || !isValidationEnabled()) {
|
|
222
|
+
if (validationOverride === false || validationOverride === void 0 && !isValidationEnabled()) {
|
|
204
223
|
return value;
|
|
205
224
|
}
|
|
206
225
|
const result = validator.safeParse(value);
|
|
207
226
|
if (!result.success) {
|
|
208
|
-
throw
|
|
227
|
+
throw new ValidationError(result.error);
|
|
209
228
|
}
|
|
210
229
|
return result.data;
|
|
211
230
|
}
|
|
@@ -213,54 +232,50 @@ __name(validate, "validate");
|
|
|
213
232
|
|
|
214
233
|
// src/components/Assertions.ts
|
|
215
234
|
var import_v102 = require("discord-api-types/v10");
|
|
216
|
-
var
|
|
235
|
+
var import_v43 = require("zod/v4");
|
|
217
236
|
|
|
218
237
|
// src/Assertions.ts
|
|
219
238
|
var import_v10 = require("discord-api-types/v10");
|
|
220
|
-
var
|
|
221
|
-
var customIdPredicate =
|
|
222
|
-
var memberPermissionsPredicate =
|
|
223
|
-
var localeMapPredicate =
|
|
224
|
-
Object.fromEntries(Object.values(import_v10.Locale).map((loc) => [loc,
|
|
225
|
-
)
|
|
226
|
-
var refineURLPredicate = /* @__PURE__ */ __name((allowedProtocols) => (value) => {
|
|
227
|
-
const url = new URL(value);
|
|
228
|
-
return allowedProtocols.includes(url.protocol);
|
|
229
|
-
}, "refineURLPredicate");
|
|
239
|
+
var import_v42 = require("zod/v4");
|
|
240
|
+
var customIdPredicate = import_v42.z.string().min(1).max(100);
|
|
241
|
+
var memberPermissionsPredicate = import_v42.z.coerce.bigint();
|
|
242
|
+
var localeMapPredicate = import_v42.z.strictObject(
|
|
243
|
+
Object.fromEntries(Object.values(import_v10.Locale).map((loc) => [loc, import_v42.z.string().optional()]))
|
|
244
|
+
);
|
|
230
245
|
|
|
231
246
|
// src/components/Assertions.ts
|
|
232
|
-
var labelPredicate =
|
|
233
|
-
var emojiPredicate =
|
|
234
|
-
id:
|
|
235
|
-
name:
|
|
236
|
-
animated:
|
|
237
|
-
}).
|
|
238
|
-
|
|
247
|
+
var labelPredicate = import_v43.z.string().min(1).max(80);
|
|
248
|
+
var emojiPredicate = import_v43.z.strictObject({
|
|
249
|
+
id: import_v43.z.string().optional(),
|
|
250
|
+
name: import_v43.z.string().min(2).max(32).optional(),
|
|
251
|
+
animated: import_v43.z.boolean().optional()
|
|
252
|
+
}).refine((data) => data.id !== void 0 || data.name !== void 0, {
|
|
253
|
+
error: "Either 'id' or 'name' must be provided"
|
|
239
254
|
});
|
|
240
|
-
var buttonPredicateBase =
|
|
241
|
-
type:
|
|
242
|
-
disabled:
|
|
255
|
+
var buttonPredicateBase = import_v43.z.strictObject({
|
|
256
|
+
type: import_v43.z.literal(import_v102.ComponentType.Button),
|
|
257
|
+
disabled: import_v43.z.boolean().optional()
|
|
243
258
|
});
|
|
244
259
|
var buttonCustomIdPredicateBase = buttonPredicateBase.extend({
|
|
245
260
|
custom_id: customIdPredicate,
|
|
246
261
|
emoji: emojiPredicate.optional(),
|
|
247
262
|
label: labelPredicate
|
|
248
263
|
});
|
|
249
|
-
var buttonPrimaryPredicate = buttonCustomIdPredicateBase.extend({ style:
|
|
250
|
-
var buttonSecondaryPredicate = buttonCustomIdPredicateBase.extend({ style:
|
|
251
|
-
var buttonSuccessPredicate = buttonCustomIdPredicateBase.extend({ style:
|
|
252
|
-
var buttonDangerPredicate = buttonCustomIdPredicateBase.extend({ style:
|
|
264
|
+
var buttonPrimaryPredicate = buttonCustomIdPredicateBase.extend({ style: import_v43.z.literal(import_v102.ButtonStyle.Primary) });
|
|
265
|
+
var buttonSecondaryPredicate = buttonCustomIdPredicateBase.extend({ style: import_v43.z.literal(import_v102.ButtonStyle.Secondary) });
|
|
266
|
+
var buttonSuccessPredicate = buttonCustomIdPredicateBase.extend({ style: import_v43.z.literal(import_v102.ButtonStyle.Success) });
|
|
267
|
+
var buttonDangerPredicate = buttonCustomIdPredicateBase.extend({ style: import_v43.z.literal(import_v102.ButtonStyle.Danger) });
|
|
253
268
|
var buttonLinkPredicate = buttonPredicateBase.extend({
|
|
254
|
-
style:
|
|
255
|
-
url:
|
|
269
|
+
style: import_v43.z.literal(import_v102.ButtonStyle.Link),
|
|
270
|
+
url: import_v43.z.url({ protocol: /^(?:https?|discord)$/ }),
|
|
256
271
|
emoji: emojiPredicate.optional(),
|
|
257
272
|
label: labelPredicate
|
|
258
|
-
})
|
|
273
|
+
});
|
|
259
274
|
var buttonPremiumPredicate = buttonPredicateBase.extend({
|
|
260
|
-
style:
|
|
261
|
-
sku_id:
|
|
262
|
-
})
|
|
263
|
-
var buttonPredicate =
|
|
275
|
+
style: import_v43.z.literal(import_v102.ButtonStyle.Premium),
|
|
276
|
+
sku_id: import_v43.z.string()
|
|
277
|
+
});
|
|
278
|
+
var buttonPredicate = import_v43.z.discriminatedUnion("style", [
|
|
264
279
|
buttonLinkPredicate,
|
|
265
280
|
buttonPrimaryPredicate,
|
|
266
281
|
buttonSecondaryPredicate,
|
|
@@ -268,72 +283,73 @@ var buttonPredicate = import_zod2.z.discriminatedUnion("style", [
|
|
|
268
283
|
buttonDangerPredicate,
|
|
269
284
|
buttonPremiumPredicate
|
|
270
285
|
]);
|
|
271
|
-
var selectMenuBasePredicate =
|
|
272
|
-
placeholder:
|
|
273
|
-
min_values:
|
|
274
|
-
max_values:
|
|
286
|
+
var selectMenuBasePredicate = import_v43.z.object({
|
|
287
|
+
placeholder: import_v43.z.string().max(150).optional(),
|
|
288
|
+
min_values: import_v43.z.number().min(0).max(25).optional(),
|
|
289
|
+
max_values: import_v43.z.number().min(0).max(25).optional(),
|
|
275
290
|
custom_id: customIdPredicate,
|
|
276
|
-
disabled:
|
|
291
|
+
disabled: import_v43.z.boolean().optional()
|
|
277
292
|
});
|
|
278
293
|
var selectMenuChannelPredicate = selectMenuBasePredicate.extend({
|
|
279
|
-
type:
|
|
280
|
-
channel_types:
|
|
281
|
-
default_values:
|
|
294
|
+
type: import_v43.z.literal(import_v102.ComponentType.ChannelSelect),
|
|
295
|
+
channel_types: import_v43.z.enum(import_v102.ChannelType).array().optional(),
|
|
296
|
+
default_values: import_v43.z.object({ id: import_v43.z.string(), type: import_v43.z.literal(import_v102.SelectMenuDefaultValueType.Channel) }).array().max(25).optional()
|
|
282
297
|
});
|
|
283
298
|
var selectMenuMentionablePredicate = selectMenuBasePredicate.extend({
|
|
284
|
-
type:
|
|
285
|
-
default_values:
|
|
286
|
-
id:
|
|
287
|
-
type:
|
|
299
|
+
type: import_v43.z.literal(import_v102.ComponentType.MentionableSelect),
|
|
300
|
+
default_values: import_v43.z.object({
|
|
301
|
+
id: import_v43.z.string(),
|
|
302
|
+
type: import_v43.z.literal([import_v102.SelectMenuDefaultValueType.Role, import_v102.SelectMenuDefaultValueType.User])
|
|
288
303
|
}).array().max(25).optional()
|
|
289
304
|
});
|
|
290
305
|
var selectMenuRolePredicate = selectMenuBasePredicate.extend({
|
|
291
|
-
type:
|
|
292
|
-
default_values:
|
|
306
|
+
type: import_v43.z.literal(import_v102.ComponentType.RoleSelect),
|
|
307
|
+
default_values: import_v43.z.object({ id: import_v43.z.string(), type: import_v43.z.literal(import_v102.SelectMenuDefaultValueType.Role) }).array().max(25).optional()
|
|
293
308
|
});
|
|
294
|
-
var selectMenuStringOptionPredicate =
|
|
309
|
+
var selectMenuStringOptionPredicate = import_v43.z.object({
|
|
295
310
|
label: labelPredicate,
|
|
296
|
-
value:
|
|
297
|
-
description:
|
|
311
|
+
value: import_v43.z.string().min(1).max(100),
|
|
312
|
+
description: import_v43.z.string().min(1).max(100).optional(),
|
|
298
313
|
emoji: emojiPredicate.optional(),
|
|
299
|
-
default:
|
|
314
|
+
default: import_v43.z.boolean().optional()
|
|
300
315
|
});
|
|
301
316
|
var selectMenuStringPredicate = selectMenuBasePredicate.extend({
|
|
302
|
-
type:
|
|
317
|
+
type: import_v43.z.literal(import_v102.ComponentType.StringSelect),
|
|
303
318
|
options: selectMenuStringOptionPredicate.array().min(1).max(25)
|
|
304
|
-
}).
|
|
305
|
-
const addIssue = /* @__PURE__ */ __name((name, minimum) => ctx.
|
|
319
|
+
}).check((ctx) => {
|
|
320
|
+
const addIssue = /* @__PURE__ */ __name((name, minimum) => ctx.issues.push({
|
|
306
321
|
code: "too_small",
|
|
307
322
|
message: `The number of options must be greater than or equal to ${name}`,
|
|
308
323
|
inclusive: true,
|
|
309
324
|
minimum,
|
|
310
325
|
type: "number",
|
|
311
|
-
path: ["options"]
|
|
326
|
+
path: ["options"],
|
|
327
|
+
origin: "number",
|
|
328
|
+
input: minimum
|
|
312
329
|
}), "addIssue");
|
|
313
|
-
if (
|
|
314
|
-
addIssue("max_values",
|
|
330
|
+
if (ctx.value.max_values !== void 0 && ctx.value.options.length < ctx.value.max_values) {
|
|
331
|
+
addIssue("max_values", ctx.value.max_values);
|
|
315
332
|
}
|
|
316
|
-
if (
|
|
317
|
-
addIssue("min_values",
|
|
333
|
+
if (ctx.value.min_values !== void 0 && ctx.value.options.length < ctx.value.min_values) {
|
|
334
|
+
addIssue("min_values", ctx.value.min_values);
|
|
318
335
|
}
|
|
319
336
|
});
|
|
320
337
|
var selectMenuUserPredicate = selectMenuBasePredicate.extend({
|
|
321
|
-
type:
|
|
322
|
-
default_values:
|
|
338
|
+
type: import_v43.z.literal(import_v102.ComponentType.UserSelect),
|
|
339
|
+
default_values: import_v43.z.object({ id: import_v43.z.string(), type: import_v43.z.literal(import_v102.SelectMenuDefaultValueType.User) }).array().max(25).optional()
|
|
323
340
|
});
|
|
324
|
-
var actionRowPredicate =
|
|
325
|
-
type:
|
|
326
|
-
components:
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
type:
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
import_zod2.z.literal(import_v102.ComponentType.TextInput)
|
|
341
|
+
var actionRowPredicate = import_v43.z.object({
|
|
342
|
+
type: import_v43.z.literal(import_v102.ComponentType.ActionRow),
|
|
343
|
+
components: import_v43.z.union([
|
|
344
|
+
import_v43.z.object({ type: import_v43.z.literal(import_v102.ComponentType.Button) }).array().min(1).max(5),
|
|
345
|
+
import_v43.z.object({
|
|
346
|
+
type: import_v43.z.literal([
|
|
347
|
+
import_v102.ComponentType.ChannelSelect,
|
|
348
|
+
import_v102.ComponentType.MentionableSelect,
|
|
349
|
+
import_v102.ComponentType.StringSelect,
|
|
350
|
+
import_v102.ComponentType.RoleSelect,
|
|
351
|
+
import_v102.ComponentType.TextInput,
|
|
352
|
+
import_v102.ComponentType.UserSelect
|
|
337
353
|
])
|
|
338
354
|
}).array().length(1)
|
|
339
355
|
])
|
|
@@ -1141,17 +1157,17 @@ var import_v1012 = require("discord-api-types/v10");
|
|
|
1141
1157
|
|
|
1142
1158
|
// src/components/textInput/Assertions.ts
|
|
1143
1159
|
var import_v1011 = require("discord-api-types/v10");
|
|
1144
|
-
var
|
|
1145
|
-
var textInputPredicate =
|
|
1146
|
-
type:
|
|
1160
|
+
var import_v44 = require("zod/v4");
|
|
1161
|
+
var textInputPredicate = import_v44.z.object({
|
|
1162
|
+
type: import_v44.z.literal(import_v1011.ComponentType.TextInput),
|
|
1147
1163
|
custom_id: customIdPredicate,
|
|
1148
|
-
label:
|
|
1149
|
-
style:
|
|
1150
|
-
min_length:
|
|
1151
|
-
max_length:
|
|
1152
|
-
placeholder:
|
|
1153
|
-
value:
|
|
1154
|
-
required:
|
|
1164
|
+
label: import_v44.z.string().min(1).max(45),
|
|
1165
|
+
style: import_v44.z.enum(import_v1011.TextInputStyle),
|
|
1166
|
+
min_length: import_v44.z.number().min(0).max(4e3).optional(),
|
|
1167
|
+
max_length: import_v44.z.number().min(1).max(4e3).optional(),
|
|
1168
|
+
placeholder: import_v44.z.string().max(100).optional(),
|
|
1169
|
+
value: import_v44.z.string().min(1).max(4e3).optional(),
|
|
1170
|
+
required: import_v44.z.boolean().optional()
|
|
1155
1171
|
});
|
|
1156
1172
|
|
|
1157
1173
|
// src/components/textInput/TextInput.ts
|
|
@@ -1311,51 +1327,47 @@ var import_v1020 = require("discord-api-types/v10");
|
|
|
1311
1327
|
|
|
1312
1328
|
// src/components/v2/Assertions.ts
|
|
1313
1329
|
var import_v1013 = require("discord-api-types/v10");
|
|
1314
|
-
var
|
|
1315
|
-
var unfurledMediaItemPredicate =
|
|
1316
|
-
url:
|
|
1317
|
-
message: "Invalid protocol for media URL. Must be http:, https:, or attachment:"
|
|
1318
|
-
})
|
|
1330
|
+
var import_v45 = require("zod/v4");
|
|
1331
|
+
var unfurledMediaItemPredicate = import_v45.z.object({
|
|
1332
|
+
url: import_v45.z.url({ protocol: /^(?:https?|attachment)$/ })
|
|
1319
1333
|
});
|
|
1320
|
-
var thumbnailPredicate =
|
|
1334
|
+
var thumbnailPredicate = import_v45.z.object({
|
|
1321
1335
|
media: unfurledMediaItemPredicate,
|
|
1322
|
-
description:
|
|
1323
|
-
spoiler:
|
|
1336
|
+
description: import_v45.z.string().min(1).max(1024).nullish(),
|
|
1337
|
+
spoiler: import_v45.z.boolean().optional()
|
|
1324
1338
|
});
|
|
1325
|
-
var unfurledMediaItemAttachmentOnlyPredicate =
|
|
1326
|
-
url:
|
|
1327
|
-
message: "Invalid protocol for file URL. Must be attachment:"
|
|
1328
|
-
})
|
|
1339
|
+
var unfurledMediaItemAttachmentOnlyPredicate = import_v45.z.object({
|
|
1340
|
+
url: import_v45.z.url({ protocol: /^attachment$/ })
|
|
1329
1341
|
});
|
|
1330
|
-
var filePredicate =
|
|
1342
|
+
var filePredicate = import_v45.z.object({
|
|
1331
1343
|
file: unfurledMediaItemAttachmentOnlyPredicate,
|
|
1332
|
-
spoiler:
|
|
1344
|
+
spoiler: import_v45.z.boolean().optional()
|
|
1333
1345
|
});
|
|
1334
|
-
var separatorPredicate =
|
|
1335
|
-
divider:
|
|
1336
|
-
spacing:
|
|
1346
|
+
var separatorPredicate = import_v45.z.object({
|
|
1347
|
+
divider: import_v45.z.boolean().optional(),
|
|
1348
|
+
spacing: import_v45.z.enum(import_v1013.SeparatorSpacingSize).optional()
|
|
1337
1349
|
});
|
|
1338
|
-
var textDisplayPredicate =
|
|
1339
|
-
content:
|
|
1350
|
+
var textDisplayPredicate = import_v45.z.object({
|
|
1351
|
+
content: import_v45.z.string().min(1).max(4e3)
|
|
1340
1352
|
});
|
|
1341
|
-
var mediaGalleryItemPredicate =
|
|
1353
|
+
var mediaGalleryItemPredicate = import_v45.z.object({
|
|
1342
1354
|
media: unfurledMediaItemPredicate,
|
|
1343
|
-
description:
|
|
1344
|
-
spoiler:
|
|
1355
|
+
description: import_v45.z.string().min(1).max(1024).nullish(),
|
|
1356
|
+
spoiler: import_v45.z.boolean().optional()
|
|
1345
1357
|
});
|
|
1346
|
-
var mediaGalleryPredicate =
|
|
1347
|
-
items:
|
|
1358
|
+
var mediaGalleryPredicate = import_v45.z.object({
|
|
1359
|
+
items: import_v45.z.array(mediaGalleryItemPredicate).min(1).max(10)
|
|
1348
1360
|
});
|
|
1349
|
-
var sectionPredicate =
|
|
1350
|
-
components:
|
|
1351
|
-
accessory:
|
|
1352
|
-
|
|
1353
|
-
|
|
1361
|
+
var sectionPredicate = import_v45.z.object({
|
|
1362
|
+
components: import_v45.z.array(textDisplayPredicate).min(1).max(3),
|
|
1363
|
+
accessory: import_v45.z.union([
|
|
1364
|
+
import_v45.z.object({ type: import_v45.z.literal(import_v1013.ComponentType.Button) }),
|
|
1365
|
+
import_v45.z.object({ type: import_v45.z.literal(import_v1013.ComponentType.Thumbnail) })
|
|
1354
1366
|
])
|
|
1355
1367
|
});
|
|
1356
|
-
var containerPredicate =
|
|
1357
|
-
components:
|
|
1358
|
-
|
|
1368
|
+
var containerPredicate = import_v45.z.object({
|
|
1369
|
+
components: import_v45.z.array(
|
|
1370
|
+
import_v45.z.union([
|
|
1359
1371
|
actionRowPredicate,
|
|
1360
1372
|
filePredicate,
|
|
1361
1373
|
mediaGalleryPredicate,
|
|
@@ -1364,8 +1376,8 @@ var containerPredicate = import_zod4.z.object({
|
|
|
1364
1376
|
textDisplayPredicate
|
|
1365
1377
|
])
|
|
1366
1378
|
).min(1),
|
|
1367
|
-
spoiler:
|
|
1368
|
-
accent_color:
|
|
1379
|
+
spoiler: import_v45.z.boolean().optional(),
|
|
1380
|
+
accent_color: import_v45.z.int().min(0).max(16777215).nullish()
|
|
1369
1381
|
});
|
|
1370
1382
|
|
|
1371
1383
|
// src/components/v2/File.ts
|
|
@@ -2718,35 +2730,33 @@ var SharedNameAndDescription = class extends SharedName {
|
|
|
2718
2730
|
|
|
2719
2731
|
// src/interactions/commands/chatInput/Assertions.ts
|
|
2720
2732
|
var import_v1024 = require("discord-api-types/v10");
|
|
2721
|
-
var
|
|
2722
|
-
var namePredicate =
|
|
2723
|
-
var descriptionPredicate =
|
|
2724
|
-
var sharedNameAndDescriptionPredicate =
|
|
2733
|
+
var import_v46 = require("zod/v4");
|
|
2734
|
+
var namePredicate = import_v46.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_v46.z.string().min(1).max(100);
|
|
2736
|
+
var sharedNameAndDescriptionPredicate = import_v46.z.object({
|
|
2725
2737
|
name: namePredicate,
|
|
2726
2738
|
name_localizations: localeMapPredicate.optional(),
|
|
2727
2739
|
description: descriptionPredicate,
|
|
2728
2740
|
description_localizations: localeMapPredicate.optional()
|
|
2729
2741
|
});
|
|
2730
|
-
var numericMixinNumberOptionPredicate =
|
|
2731
|
-
max_value:
|
|
2732
|
-
min_value:
|
|
2742
|
+
var numericMixinNumberOptionPredicate = import_v46.z.object({
|
|
2743
|
+
max_value: import_v46.z.float32().optional(),
|
|
2744
|
+
min_value: import_v46.z.float32().optional()
|
|
2733
2745
|
});
|
|
2734
|
-
var numericMixinIntegerOptionPredicate =
|
|
2735
|
-
max_value:
|
|
2736
|
-
min_value:
|
|
2746
|
+
var numericMixinIntegerOptionPredicate = import_v46.z.object({
|
|
2747
|
+
max_value: import_v46.z.int().optional(),
|
|
2748
|
+
min_value: import_v46.z.int().optional()
|
|
2737
2749
|
});
|
|
2738
|
-
var channelMixinOptionPredicate =
|
|
2739
|
-
channel_types:
|
|
2740
|
-
ApplicationCommandOptionAllowedChannelTypes.map((type) => import_zod5.z.literal(type))
|
|
2741
|
-
).array().optional()
|
|
2750
|
+
var channelMixinOptionPredicate = import_v46.z.object({
|
|
2751
|
+
channel_types: import_v46.z.literal(ApplicationCommandOptionAllowedChannelTypes).array().optional()
|
|
2742
2752
|
});
|
|
2743
|
-
var autocompleteMixinOptionPredicate =
|
|
2744
|
-
autocomplete:
|
|
2745
|
-
choices:
|
|
2753
|
+
var autocompleteMixinOptionPredicate = import_v46.z.object({
|
|
2754
|
+
autocomplete: import_v46.z.literal(true),
|
|
2755
|
+
choices: import_v46.z.union([import_v46.z.never(), import_v46.z.never().array(), import_v46.z.undefined()])
|
|
2746
2756
|
});
|
|
2747
|
-
var choiceValueStringPredicate =
|
|
2748
|
-
var choiceValueNumberPredicate =
|
|
2749
|
-
var choiceBasePredicate =
|
|
2757
|
+
var choiceValueStringPredicate = import_v46.z.string().min(1).max(100);
|
|
2758
|
+
var choiceValueNumberPredicate = import_v46.z.number();
|
|
2759
|
+
var choiceBasePredicate = import_v46.z.object({
|
|
2750
2760
|
name: choiceValueStringPredicate,
|
|
2751
2761
|
name_localizations: localeMapPredicate.optional()
|
|
2752
2762
|
});
|
|
@@ -2756,8 +2766,8 @@ var choiceStringPredicate = choiceBasePredicate.extend({
|
|
|
2756
2766
|
var choiceNumberPredicate = choiceBasePredicate.extend({
|
|
2757
2767
|
value: choiceValueNumberPredicate
|
|
2758
2768
|
});
|
|
2759
|
-
var choiceBaseMixinPredicate =
|
|
2760
|
-
autocomplete:
|
|
2769
|
+
var choiceBaseMixinPredicate = import_v46.z.object({
|
|
2770
|
+
autocomplete: import_v46.z.literal(false).optional()
|
|
2761
2771
|
});
|
|
2762
2772
|
var choiceStringMixinPredicate = choiceBaseMixinPredicate.extend({
|
|
2763
2773
|
choices: choiceStringPredicate.array().max(25).optional()
|
|
@@ -2765,7 +2775,7 @@ var choiceStringMixinPredicate = choiceBaseMixinPredicate.extend({
|
|
|
2765
2775
|
var choiceNumberMixinPredicate = choiceBaseMixinPredicate.extend({
|
|
2766
2776
|
choices: choiceNumberPredicate.array().max(25).optional()
|
|
2767
2777
|
});
|
|
2768
|
-
var
|
|
2778
|
+
var basicOptionTypesPredicate = import_v46.z.literal([
|
|
2769
2779
|
import_v1024.ApplicationCommandOptionType.Attachment,
|
|
2770
2780
|
import_v1024.ApplicationCommandOptionType.Boolean,
|
|
2771
2781
|
import_v1024.ApplicationCommandOptionType.Channel,
|
|
@@ -2775,50 +2785,56 @@ var basicOptionTypes = [
|
|
|
2775
2785
|
import_v1024.ApplicationCommandOptionType.Role,
|
|
2776
2786
|
import_v1024.ApplicationCommandOptionType.String,
|
|
2777
2787
|
import_v1024.ApplicationCommandOptionType.User
|
|
2778
|
-
];
|
|
2779
|
-
var basicOptionTypesPredicate = import_zod5.z.union(
|
|
2780
|
-
basicOptionTypes.map((type) => import_zod5.z.literal(type))
|
|
2781
|
-
);
|
|
2788
|
+
]);
|
|
2782
2789
|
var basicOptionPredicate = sharedNameAndDescriptionPredicate.extend({
|
|
2783
|
-
required:
|
|
2790
|
+
required: import_v46.z.boolean().optional(),
|
|
2784
2791
|
type: basicOptionTypesPredicate
|
|
2785
2792
|
});
|
|
2786
|
-
var autocompleteOrStringChoicesMixinOptionPredicate =
|
|
2793
|
+
var autocompleteOrStringChoicesMixinOptionPredicate = import_v46.z.discriminatedUnion("autocomplete", [
|
|
2787
2794
|
autocompleteMixinOptionPredicate,
|
|
2788
2795
|
choiceStringMixinPredicate
|
|
2789
2796
|
]);
|
|
2790
|
-
var autocompleteOrNumberChoicesMixinOptionPredicate =
|
|
2797
|
+
var autocompleteOrNumberChoicesMixinOptionPredicate = import_v46.z.discriminatedUnion("autocomplete", [
|
|
2791
2798
|
autocompleteMixinOptionPredicate,
|
|
2792
2799
|
choiceNumberMixinPredicate
|
|
2793
2800
|
]);
|
|
2794
|
-
var channelOptionPredicate =
|
|
2795
|
-
|
|
2796
|
-
|
|
2801
|
+
var channelOptionPredicate = import_v46.z.object({
|
|
2802
|
+
...basicOptionPredicate.shape,
|
|
2803
|
+
...channelMixinOptionPredicate.shape
|
|
2804
|
+
});
|
|
2805
|
+
var integerOptionPredicate = import_v46.z.object({
|
|
2806
|
+
...basicOptionPredicate.shape,
|
|
2807
|
+
...numericMixinIntegerOptionPredicate.shape
|
|
2808
|
+
}).and(autocompleteOrNumberChoicesMixinOptionPredicate);
|
|
2809
|
+
var numberOptionPredicate = import_v46.z.object({
|
|
2810
|
+
...basicOptionPredicate.shape,
|
|
2811
|
+
...numericMixinNumberOptionPredicate.shape
|
|
2812
|
+
}).and(autocompleteOrNumberChoicesMixinOptionPredicate);
|
|
2797
2813
|
var stringOptionPredicate = basicOptionPredicate.extend({
|
|
2798
|
-
max_length:
|
|
2799
|
-
min_length:
|
|
2814
|
+
max_length: import_v46.z.number().min(0).max(6e3).optional(),
|
|
2815
|
+
min_length: import_v46.z.number().min(1).max(6e3).optional()
|
|
2800
2816
|
}).and(autocompleteOrStringChoicesMixinOptionPredicate);
|
|
2801
2817
|
var baseChatInputCommandPredicate = sharedNameAndDescriptionPredicate.extend({
|
|
2802
|
-
contexts:
|
|
2818
|
+
contexts: import_v46.z.array(import_v46.z.enum(import_v1024.InteractionContextType)).optional(),
|
|
2803
2819
|
default_member_permissions: memberPermissionsPredicate.optional(),
|
|
2804
|
-
integration_types:
|
|
2805
|
-
nsfw:
|
|
2820
|
+
integration_types: import_v46.z.array(import_v46.z.enum(import_v1024.ApplicationIntegrationType)).optional(),
|
|
2821
|
+
nsfw: import_v46.z.boolean().optional()
|
|
2806
2822
|
});
|
|
2807
|
-
var chatInputCommandOptionsPredicate =
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2823
|
+
var chatInputCommandOptionsPredicate = import_v46.z.union([
|
|
2824
|
+
import_v46.z.object({ type: basicOptionTypesPredicate }).array(),
|
|
2825
|
+
import_v46.z.object({ type: import_v46.z.literal(import_v1024.ApplicationCommandOptionType.Subcommand) }).array(),
|
|
2826
|
+
import_v46.z.object({ type: import_v46.z.literal(import_v1024.ApplicationCommandOptionType.SubcommandGroup) }).array()
|
|
2811
2827
|
]);
|
|
2812
2828
|
var chatInputCommandPredicate = baseChatInputCommandPredicate.extend({
|
|
2813
2829
|
options: chatInputCommandOptionsPredicate.optional()
|
|
2814
2830
|
});
|
|
2815
2831
|
var chatInputCommandSubcommandGroupPredicate = sharedNameAndDescriptionPredicate.extend({
|
|
2816
|
-
type:
|
|
2817
|
-
options:
|
|
2832
|
+
type: import_v46.z.literal(import_v1024.ApplicationCommandOptionType.SubcommandGroup),
|
|
2833
|
+
options: import_v46.z.array(import_v46.z.object({ type: import_v46.z.literal(import_v1024.ApplicationCommandOptionType.Subcommand) })).min(1).max(25)
|
|
2818
2834
|
});
|
|
2819
2835
|
var chatInputCommandSubcommandPredicate = sharedNameAndDescriptionPredicate.extend({
|
|
2820
|
-
type:
|
|
2821
|
-
options:
|
|
2836
|
+
type: import_v46.z.literal(import_v1024.ApplicationCommandOptionType.Subcommand),
|
|
2837
|
+
options: import_v46.z.array(import_v46.z.object({ type: basicOptionTypesPredicate })).max(25)
|
|
2822
2838
|
});
|
|
2823
2839
|
|
|
2824
2840
|
// src/interactions/commands/chatInput/options/ApplicationCommandOptionBase.ts
|
|
@@ -3367,23 +3383,23 @@ var ChatInputCommandBuilder = class extends (0, import_ts_mixer8.Mixin)(
|
|
|
3367
3383
|
|
|
3368
3384
|
// src/interactions/commands/contextMenu/Assertions.ts
|
|
3369
3385
|
var import_v1036 = require("discord-api-types/v10");
|
|
3370
|
-
var
|
|
3371
|
-
var namePredicate2 =
|
|
3372
|
-
var contextsPredicate =
|
|
3373
|
-
var integrationTypesPredicate =
|
|
3374
|
-
var baseContextMenuCommandPredicate =
|
|
3386
|
+
var import_v47 = require("zod/v4");
|
|
3387
|
+
var namePredicate2 = import_v47.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_v47.z.array(import_v47.z.enum(import_v1036.InteractionContextType));
|
|
3389
|
+
var integrationTypesPredicate = import_v47.z.array(import_v47.z.enum(import_v1036.ApplicationIntegrationType));
|
|
3390
|
+
var baseContextMenuCommandPredicate = import_v47.z.object({
|
|
3375
3391
|
contexts: contextsPredicate.optional(),
|
|
3376
3392
|
default_member_permissions: memberPermissionsPredicate.optional(),
|
|
3377
3393
|
name: namePredicate2,
|
|
3378
3394
|
name_localizations: localeMapPredicate.optional(),
|
|
3379
3395
|
integration_types: integrationTypesPredicate.optional(),
|
|
3380
|
-
nsfw:
|
|
3396
|
+
nsfw: import_v47.z.boolean().optional()
|
|
3381
3397
|
});
|
|
3382
3398
|
var userCommandPredicate = baseContextMenuCommandPredicate.extend({
|
|
3383
|
-
type:
|
|
3399
|
+
type: import_v47.z.literal(import_v1036.ApplicationCommandType.User)
|
|
3384
3400
|
});
|
|
3385
3401
|
var messageCommandPredicate = baseContextMenuCommandPredicate.extend({
|
|
3386
|
-
type:
|
|
3402
|
+
type: import_v47.z.literal(import_v1036.ApplicationCommandType.Message)
|
|
3387
3403
|
});
|
|
3388
3404
|
|
|
3389
3405
|
// src/interactions/commands/contextMenu/ContextMenuCommand.ts
|
|
@@ -3446,14 +3462,14 @@ var UserContextCommandBuilder = class extends ContextMenuCommandBuilder {
|
|
|
3446
3462
|
|
|
3447
3463
|
// src/interactions/modals/Assertions.ts
|
|
3448
3464
|
var import_v1039 = require("discord-api-types/v10");
|
|
3449
|
-
var
|
|
3450
|
-
var titlePredicate =
|
|
3451
|
-
var modalPredicate =
|
|
3465
|
+
var import_v48 = require("zod/v4");
|
|
3466
|
+
var titlePredicate = import_v48.z.string().min(1).max(45);
|
|
3467
|
+
var modalPredicate = import_v48.z.object({
|
|
3452
3468
|
title: titlePredicate,
|
|
3453
3469
|
custom_id: customIdPredicate,
|
|
3454
|
-
components:
|
|
3455
|
-
type:
|
|
3456
|
-
components:
|
|
3470
|
+
components: import_v48.z.object({
|
|
3471
|
+
type: import_v48.z.literal(import_v1039.ComponentType.ActionRow),
|
|
3472
|
+
components: import_v48.z.object({ type: import_v48.z.literal(import_v1039.ComponentType.TextInput) }).array().length(1)
|
|
3457
3473
|
}).array().min(1).max(5)
|
|
3458
3474
|
});
|
|
3459
3475
|
|
|
@@ -3576,7 +3592,7 @@ var ModalBuilder = class {
|
|
|
3576
3592
|
};
|
|
3577
3593
|
|
|
3578
3594
|
// src/messages/embed/Assertions.ts
|
|
3579
|
-
var
|
|
3595
|
+
var import_v49 = require("zod/v4");
|
|
3580
3596
|
|
|
3581
3597
|
// src/util/componentUtil.ts
|
|
3582
3598
|
function embedLength(data) {
|
|
@@ -3585,42 +3601,40 @@ function embedLength(data) {
|
|
|
3585
3601
|
__name(embedLength, "embedLength");
|
|
3586
3602
|
|
|
3587
3603
|
// src/messages/embed/Assertions.ts
|
|
3588
|
-
var namePredicate3 =
|
|
3589
|
-
var URLPredicate =
|
|
3590
|
-
var URLWithAttachmentProtocolPredicate =
|
|
3591
|
-
|
|
3592
|
-
});
|
|
3593
|
-
var embedFieldPredicate = import_zod8.z.object({
|
|
3604
|
+
var namePredicate3 = import_v49.z.string().max(256);
|
|
3605
|
+
var URLPredicate = import_v49.z.url({ protocol: /^https?$/ });
|
|
3606
|
+
var URLWithAttachmentProtocolPredicate = import_v49.z.url({ protocol: /^(?:https?|attachment)$/ });
|
|
3607
|
+
var embedFieldPredicate = import_v49.z.object({
|
|
3594
3608
|
name: namePredicate3,
|
|
3595
|
-
value:
|
|
3596
|
-
inline:
|
|
3609
|
+
value: import_v49.z.string().max(1024),
|
|
3610
|
+
inline: import_v49.z.boolean().optional()
|
|
3597
3611
|
});
|
|
3598
|
-
var embedAuthorPredicate =
|
|
3612
|
+
var embedAuthorPredicate = import_v49.z.object({
|
|
3599
3613
|
name: namePredicate3.min(1),
|
|
3600
3614
|
icon_url: URLWithAttachmentProtocolPredicate.optional(),
|
|
3601
3615
|
url: URLPredicate.optional()
|
|
3602
3616
|
});
|
|
3603
|
-
var embedFooterPredicate =
|
|
3604
|
-
text:
|
|
3617
|
+
var embedFooterPredicate = import_v49.z.object({
|
|
3618
|
+
text: import_v49.z.string().min(1).max(2048),
|
|
3605
3619
|
icon_url: URLWithAttachmentProtocolPredicate.optional()
|
|
3606
3620
|
});
|
|
3607
|
-
var embedPredicate =
|
|
3621
|
+
var embedPredicate = import_v49.z.object({
|
|
3608
3622
|
title: namePredicate3.min(1).optional(),
|
|
3609
|
-
description:
|
|
3623
|
+
description: import_v49.z.string().min(1).max(4096).optional(),
|
|
3610
3624
|
url: URLPredicate.optional(),
|
|
3611
|
-
timestamp:
|
|
3612
|
-
color:
|
|
3625
|
+
timestamp: import_v49.z.string().optional(),
|
|
3626
|
+
color: import_v49.z.int().min(0).max(16777215).optional(),
|
|
3613
3627
|
footer: embedFooterPredicate.optional(),
|
|
3614
|
-
image:
|
|
3615
|
-
thumbnail:
|
|
3628
|
+
image: import_v49.z.object({ url: URLWithAttachmentProtocolPredicate }).optional(),
|
|
3629
|
+
thumbnail: import_v49.z.object({ url: URLWithAttachmentProtocolPredicate }).optional(),
|
|
3616
3630
|
author: embedAuthorPredicate.optional(),
|
|
3617
|
-
fields:
|
|
3631
|
+
fields: import_v49.z.array(embedFieldPredicate).max(25).optional()
|
|
3618
3632
|
}).refine(
|
|
3619
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,
|
|
3620
3634
|
{
|
|
3621
|
-
|
|
3635
|
+
error: "Embed must have at least a title, description, a field, a footer, an author, an image, OR a thumbnail."
|
|
3622
3636
|
}
|
|
3623
|
-
).refine((embed) => embedLength(embed) <= 6e3, {
|
|
3637
|
+
).refine((embed) => embedLength(embed) <= 6e3, { error: "Embeds must not exceed 6000 characters in total." });
|
|
3624
3638
|
|
|
3625
3639
|
// src/messages/embed/EmbedAuthor.ts
|
|
3626
3640
|
var EmbedAuthorBuilder = class {
|
|
@@ -4100,19 +4114,19 @@ var EmbedBuilder = class {
|
|
|
4100
4114
|
|
|
4101
4115
|
// src/messages/poll/Assertions.ts
|
|
4102
4116
|
var import_v1040 = require("discord-api-types/v10");
|
|
4103
|
-
var
|
|
4104
|
-
var pollQuestionPredicate =
|
|
4105
|
-
var pollAnswerMediaPredicate =
|
|
4106
|
-
text:
|
|
4117
|
+
var import_v410 = require("zod/v4");
|
|
4118
|
+
var pollQuestionPredicate = import_v410.z.object({ text: import_v410.z.string().min(1).max(300) });
|
|
4119
|
+
var pollAnswerMediaPredicate = import_v410.z.object({
|
|
4120
|
+
text: import_v410.z.string().min(1).max(55),
|
|
4107
4121
|
emoji: emojiPredicate.optional()
|
|
4108
4122
|
});
|
|
4109
|
-
var pollAnswerPredicate =
|
|
4110
|
-
var pollPredicate =
|
|
4123
|
+
var pollAnswerPredicate = import_v410.z.object({ poll_media: pollAnswerMediaPredicate });
|
|
4124
|
+
var pollPredicate = import_v410.z.object({
|
|
4111
4125
|
question: pollQuestionPredicate,
|
|
4112
|
-
answers:
|
|
4113
|
-
duration:
|
|
4114
|
-
allow_multiselect:
|
|
4115
|
-
layout_type:
|
|
4126
|
+
answers: import_v410.z.array(pollAnswerPredicate).min(1).max(10),
|
|
4127
|
+
duration: import_v410.z.number().min(1).max(768).optional(),
|
|
4128
|
+
allow_multiselect: import_v410.z.boolean().optional(),
|
|
4129
|
+
layout_type: import_v410.z.enum(import_v1040.PollLayoutType).optional()
|
|
4116
4130
|
});
|
|
4117
4131
|
|
|
4118
4132
|
// src/messages/poll/PollMedia.ts
|
|
@@ -4442,95 +4456,94 @@ var PollBuilder = class {
|
|
|
4442
4456
|
|
|
4443
4457
|
// src/messages/Assertions.ts
|
|
4444
4458
|
var import_v1041 = require("discord-api-types/v10");
|
|
4445
|
-
var
|
|
4446
|
-
var attachmentPredicate =
|
|
4447
|
-
id:
|
|
4448
|
-
description:
|
|
4449
|
-
duration_secs:
|
|
4450
|
-
filename:
|
|
4451
|
-
title:
|
|
4452
|
-
waveform:
|
|
4459
|
+
var import_v411 = require("zod/v4");
|
|
4460
|
+
var attachmentPredicate = import_v411.z.object({
|
|
4461
|
+
id: import_v411.z.union([import_v411.z.string(), import_v411.z.number()]),
|
|
4462
|
+
description: import_v411.z.string().max(1024).optional(),
|
|
4463
|
+
duration_secs: import_v411.z.number().max(2 ** 31 - 1).optional(),
|
|
4464
|
+
filename: import_v411.z.string().max(1024).optional(),
|
|
4465
|
+
title: import_v411.z.string().max(1024).optional(),
|
|
4466
|
+
waveform: import_v411.z.string().max(400).optional()
|
|
4453
4467
|
});
|
|
4454
|
-
var allowedMentionPredicate =
|
|
4455
|
-
parse:
|
|
4456
|
-
roles:
|
|
4457
|
-
users:
|
|
4458
|
-
replied_user:
|
|
4468
|
+
var allowedMentionPredicate = import_v411.z.object({
|
|
4469
|
+
parse: import_v411.z.enum(import_v1041.AllowedMentionsTypes).array().optional(),
|
|
4470
|
+
roles: import_v411.z.string().array().max(100).optional(),
|
|
4471
|
+
users: import_v411.z.string().array().max(100).optional(),
|
|
4472
|
+
replied_user: import_v411.z.boolean().optional()
|
|
4459
4473
|
}).refine(
|
|
4460
4474
|
(data) => !(data.parse?.includes(import_v1041.AllowedMentionsTypes.User) && data.users?.length || data.parse?.includes(import_v1041.AllowedMentionsTypes.Role) && data.roles?.length),
|
|
4461
4475
|
{
|
|
4462
|
-
|
|
4476
|
+
error: 'Cannot specify both parse: ["users"] and non-empty users array, or parse: ["roles"] and non-empty roles array. These are mutually exclusive'
|
|
4463
4477
|
}
|
|
4464
4478
|
);
|
|
4465
|
-
var messageReferencePredicate =
|
|
4466
|
-
channel_id:
|
|
4467
|
-
fail_if_not_exists:
|
|
4468
|
-
guild_id:
|
|
4469
|
-
message_id:
|
|
4470
|
-
type:
|
|
4479
|
+
var messageReferencePredicate = import_v411.z.object({
|
|
4480
|
+
channel_id: import_v411.z.string().optional(),
|
|
4481
|
+
fail_if_not_exists: import_v411.z.boolean().optional(),
|
|
4482
|
+
guild_id: import_v411.z.string().optional(),
|
|
4483
|
+
message_id: import_v411.z.string(),
|
|
4484
|
+
type: import_v411.z.enum(import_v1041.MessageReferenceType).optional()
|
|
4471
4485
|
});
|
|
4472
|
-
var baseMessagePredicate =
|
|
4473
|
-
nonce:
|
|
4474
|
-
tts:
|
|
4486
|
+
var baseMessagePredicate = import_v411.z.object({
|
|
4487
|
+
nonce: import_v411.z.union([import_v411.z.string().max(25), import_v411.z.number()]).optional(),
|
|
4488
|
+
tts: import_v411.z.boolean().optional(),
|
|
4475
4489
|
allowed_mentions: allowedMentionPredicate.optional(),
|
|
4476
4490
|
message_reference: messageReferencePredicate.optional(),
|
|
4477
4491
|
attachments: attachmentPredicate.array().max(10).optional(),
|
|
4478
|
-
enforce_nonce:
|
|
4492
|
+
enforce_nonce: import_v411.z.boolean().optional()
|
|
4479
4493
|
});
|
|
4480
|
-
var basicActionRowPredicate =
|
|
4481
|
-
type:
|
|
4482
|
-
components:
|
|
4483
|
-
type:
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4494
|
+
var basicActionRowPredicate = import_v411.z.object({
|
|
4495
|
+
type: import_v411.z.literal(import_v1041.ComponentType.ActionRow),
|
|
4496
|
+
components: import_v411.z.object({
|
|
4497
|
+
type: import_v411.z.literal([
|
|
4498
|
+
import_v1041.ComponentType.Button,
|
|
4499
|
+
import_v1041.ComponentType.ChannelSelect,
|
|
4500
|
+
import_v1041.ComponentType.MentionableSelect,
|
|
4501
|
+
import_v1041.ComponentType.RoleSelect,
|
|
4502
|
+
import_v1041.ComponentType.StringSelect,
|
|
4503
|
+
import_v1041.ComponentType.UserSelect
|
|
4490
4504
|
])
|
|
4491
4505
|
}).array()
|
|
4492
4506
|
});
|
|
4493
4507
|
var messageNoComponentsV2Predicate = baseMessagePredicate.extend({
|
|
4494
|
-
content:
|
|
4508
|
+
content: import_v411.z.string().max(2e3).optional(),
|
|
4495
4509
|
embeds: embedPredicate.array().max(10).optional(),
|
|
4496
|
-
sticker_ids:
|
|
4510
|
+
sticker_ids: import_v411.z.array(import_v411.z.string()).max(3).optional(),
|
|
4497
4511
|
poll: pollPredicate.optional(),
|
|
4498
4512
|
components: basicActionRowPredicate.array().max(5).optional(),
|
|
4499
|
-
flags:
|
|
4500
|
-
|
|
4501
|
-
return (flags & import_v1041.MessageFlags.IsComponentsV2) === 0;
|
|
4502
|
-
}
|
|
4503
|
-
return true;
|
|
4513
|
+
flags: import_v411.z.int().optional().refine((flags) => !flags || (flags & import_v1041.MessageFlags.IsComponentsV2) === 0, {
|
|
4514
|
+
error: "Cannot set content, embeds, stickers, or poll with IsComponentsV2 flag set"
|
|
4504
4515
|
})
|
|
4505
4516
|
}).refine(
|
|
4506
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,
|
|
4507
|
-
{
|
|
4518
|
+
{ error: "Messages must have content, embeds, a poll, attachments, components or stickers" }
|
|
4508
4519
|
);
|
|
4509
|
-
var allTopLevelComponentsPredicate =
|
|
4520
|
+
var allTopLevelComponentsPredicate = import_v411.z.union([
|
|
4510
4521
|
basicActionRowPredicate,
|
|
4511
|
-
|
|
4512
|
-
type:
|
|
4522
|
+
import_v411.z.object({
|
|
4523
|
+
type: import_v411.z.literal([
|
|
4513
4524
|
// Components v2
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4525
|
+
import_v1041.ComponentType.Container,
|
|
4526
|
+
import_v1041.ComponentType.File,
|
|
4527
|
+
import_v1041.ComponentType.MediaGallery,
|
|
4528
|
+
import_v1041.ComponentType.Section,
|
|
4529
|
+
import_v1041.ComponentType.Separator,
|
|
4530
|
+
import_v1041.ComponentType.TextDisplay,
|
|
4531
|
+
import_v1041.ComponentType.Thumbnail
|
|
4521
4532
|
])
|
|
4522
4533
|
})
|
|
4523
4534
|
]).array().min(1).max(10);
|
|
4524
4535
|
var messageComponentsV2Predicate = baseMessagePredicate.extend({
|
|
4525
4536
|
components: allTopLevelComponentsPredicate,
|
|
4526
|
-
flags:
|
|
4537
|
+
flags: import_v411.z.int().refine((flags) => (flags & import_v1041.MessageFlags.IsComponentsV2) === import_v1041.MessageFlags.IsComponentsV2, {
|
|
4538
|
+
error: "Must set IsComponentsV2 flag to use Components V2"
|
|
4539
|
+
}),
|
|
4527
4540
|
// These fields cannot be set
|
|
4528
|
-
content:
|
|
4529
|
-
embeds:
|
|
4530
|
-
sticker_ids:
|
|
4531
|
-
poll:
|
|
4541
|
+
content: import_v411.z.string().length(0).nullish(),
|
|
4542
|
+
embeds: import_v411.z.array(import_v411.z.never()).nullish(),
|
|
4543
|
+
sticker_ids: import_v411.z.array(import_v411.z.never()).nullish(),
|
|
4544
|
+
poll: import_v411.z.null().optional()
|
|
4532
4545
|
});
|
|
4533
|
-
var messagePredicate =
|
|
4546
|
+
var messagePredicate = import_v411.z.union([messageNoComponentsV2Predicate, messageComponentsV2Predicate]);
|
|
4534
4547
|
|
|
4535
4548
|
// src/messages/AllowedMentions.ts
|
|
4536
4549
|
var AllowedMentionsBuilder = class {
|
|
@@ -5420,7 +5433,7 @@ var MessageBuilder = class {
|
|
|
5420
5433
|
};
|
|
5421
5434
|
|
|
5422
5435
|
// src/index.ts
|
|
5423
|
-
var version = "2.0.0-dev.
|
|
5436
|
+
var version = "2.0.0-dev.1751544354-e6d59eaf9";
|
|
5424
5437
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5425
5438
|
0 && (module.exports = {
|
|
5426
5439
|
ActionRowBuilder,
|
|
@@ -5490,6 +5503,7 @@ var version = "2.0.0-dev.1751371559-02fbb706a";
|
|
|
5490
5503
|
ThumbnailBuilder,
|
|
5491
5504
|
UserContextCommandBuilder,
|
|
5492
5505
|
UserSelectMenuBuilder,
|
|
5506
|
+
ValidationError,
|
|
5493
5507
|
actionRowPredicate,
|
|
5494
5508
|
allowedMentionPredicate,
|
|
5495
5509
|
attachmentPredicate,
|
|
@@ -5527,7 +5541,6 @@ var version = "2.0.0-dev.1751371559-02fbb706a";
|
|
|
5527
5541
|
pollAnswerPredicate,
|
|
5528
5542
|
pollPredicate,
|
|
5529
5543
|
pollQuestionPredicate,
|
|
5530
|
-
refineURLPredicate,
|
|
5531
5544
|
resolveAccessoryComponent,
|
|
5532
5545
|
resolveBuilder,
|
|
5533
5546
|
sectionPredicate,
|