@discordjs/builders 2.0.0-dev.1740788060-88bfeaab2 → 2.0.0-dev.1741219959-e273afbb9
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 +42 -22
- package/dist/index.d.ts +42 -22
- package/dist/index.js +29 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2263,7 +2263,7 @@ var ChatInputCommandBuilder = class extends Mixin8(
|
|
|
2263
2263
|
// src/interactions/commands/contextMenu/Assertions.ts
|
|
2264
2264
|
import { ApplicationCommandType as ApplicationCommandType2, ApplicationIntegrationType as ApplicationIntegrationType2, InteractionContextType as InteractionContextType2 } from "discord-api-types/v10";
|
|
2265
2265
|
import { z as z5 } from "zod";
|
|
2266
|
-
var namePredicate2 = z5.string().min(1).max(32).regex(/^( *[\p{P}\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}]
|
|
2266
|
+
var namePredicate2 = z5.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);
|
|
2267
2267
|
var contextsPredicate = z5.array(z5.nativeEnum(InteractionContextType2));
|
|
2268
2268
|
var integrationTypesPredicate = z5.array(z5.nativeEnum(ApplicationIntegrationType2));
|
|
2269
2269
|
var baseContextMenuCommandPredicate = z5.object({
|
|
@@ -2985,12 +2985,12 @@ import { z as z8 } from "zod";
|
|
|
2985
2985
|
var pollQuestionPredicate = z8.object({ text: z8.string().min(1).max(300) });
|
|
2986
2986
|
var pollAnswerMediaPredicate = z8.object({
|
|
2987
2987
|
text: z8.string().min(1).max(55),
|
|
2988
|
-
emoji: emojiPredicate.
|
|
2988
|
+
emoji: emojiPredicate.optional()
|
|
2989
2989
|
});
|
|
2990
2990
|
var pollAnswerPredicate = z8.object({ poll_media: pollAnswerMediaPredicate });
|
|
2991
2991
|
var pollPredicate = z8.object({
|
|
2992
2992
|
question: pollQuestionPredicate,
|
|
2993
|
-
answers: z8.array(pollAnswerPredicate).max(10),
|
|
2993
|
+
answers: z8.array(pollAnswerPredicate).min(1).max(10),
|
|
2994
2994
|
duration: z8.number().min(1).max(768).optional(),
|
|
2995
2995
|
allow_multiselect: z8.boolean().optional(),
|
|
2996
2996
|
layout_type: z8.nativeEnum(PollLayoutType).optional()
|
|
@@ -3001,6 +3001,9 @@ var PollMediaBuilder = class {
|
|
|
3001
3001
|
static {
|
|
3002
3002
|
__name(this, "PollMediaBuilder");
|
|
3003
3003
|
}
|
|
3004
|
+
/**
|
|
3005
|
+
* The API data associated with this poll media.
|
|
3006
|
+
*/
|
|
3004
3007
|
data;
|
|
3005
3008
|
/**
|
|
3006
3009
|
* Creates new poll media from API data.
|
|
@@ -3027,7 +3030,7 @@ var PollAnswerMediaBuilder = class extends PollMediaBuilder {
|
|
|
3027
3030
|
__name(this, "PollAnswerMediaBuilder");
|
|
3028
3031
|
}
|
|
3029
3032
|
/**
|
|
3030
|
-
* Sets the emoji for this poll answer.
|
|
3033
|
+
* Sets the emoji for this poll answer media.
|
|
3031
3034
|
*
|
|
3032
3035
|
* @param emoji - The emoji to use
|
|
3033
3036
|
*/
|
|
@@ -3036,12 +3039,15 @@ var PollAnswerMediaBuilder = class extends PollMediaBuilder {
|
|
|
3036
3039
|
return this;
|
|
3037
3040
|
}
|
|
3038
3041
|
/**
|
|
3039
|
-
* Clears the emoji for this poll answer.
|
|
3042
|
+
* Clears the emoji for this poll answer media.
|
|
3040
3043
|
*/
|
|
3041
3044
|
clearEmoji() {
|
|
3042
3045
|
this.data.emoji = void 0;
|
|
3043
3046
|
return this;
|
|
3044
3047
|
}
|
|
3048
|
+
/**
|
|
3049
|
+
* {@inheritDoc PollMediaBuilder.toJSON}
|
|
3050
|
+
*/
|
|
3045
3051
|
toJSON(validationOverride) {
|
|
3046
3052
|
const clone = structuredClone(this.data);
|
|
3047
3053
|
validate(pollAnswerMediaPredicate, clone, validationOverride);
|
|
@@ -3054,7 +3060,15 @@ var PollAnswerBuilder = class {
|
|
|
3054
3060
|
static {
|
|
3055
3061
|
__name(this, "PollAnswerBuilder");
|
|
3056
3062
|
}
|
|
3063
|
+
/**
|
|
3064
|
+
* The API data associated with this poll answer.
|
|
3065
|
+
*/
|
|
3057
3066
|
data;
|
|
3067
|
+
/**
|
|
3068
|
+
* Creates a new poll answer from API data.
|
|
3069
|
+
*
|
|
3070
|
+
* @param data - The API data to create this poll answer with
|
|
3071
|
+
*/
|
|
3058
3072
|
constructor(data = {}) {
|
|
3059
3073
|
this.data = {
|
|
3060
3074
|
...structuredClone(data),
|
|
@@ -3076,7 +3090,8 @@ var PollAnswerBuilder = class {
|
|
|
3076
3090
|
* @param updater - The function to update the media with
|
|
3077
3091
|
*/
|
|
3078
3092
|
updateMedia(updater) {
|
|
3079
|
-
updater(this.data.poll_media
|
|
3093
|
+
updater(this.data.poll_media);
|
|
3094
|
+
return this;
|
|
3080
3095
|
}
|
|
3081
3096
|
/**
|
|
3082
3097
|
* Serializes this builder to API-compatible JSON data.
|
|
@@ -3086,10 +3101,11 @@ var PollAnswerBuilder = class {
|
|
|
3086
3101
|
* @param validationOverride - Force validation to run/not run regardless of your global preference
|
|
3087
3102
|
*/
|
|
3088
3103
|
toJSON(validationOverride) {
|
|
3104
|
+
const { poll_media, ...rest } = this.data;
|
|
3089
3105
|
const data = {
|
|
3090
|
-
...structuredClone(
|
|
3106
|
+
...structuredClone(rest),
|
|
3091
3107
|
// Disable validation because the pollAnswerPredicate below will validate this as well
|
|
3092
|
-
poll_media:
|
|
3108
|
+
poll_media: poll_media.toJSON(false)
|
|
3093
3109
|
};
|
|
3094
3110
|
validate(pollAnswerPredicate, data, validationOverride);
|
|
3095
3111
|
return data;
|
|
@@ -3101,6 +3117,9 @@ var PollQuestionBuilder = class extends PollMediaBuilder {
|
|
|
3101
3117
|
static {
|
|
3102
3118
|
__name(this, "PollQuestionBuilder");
|
|
3103
3119
|
}
|
|
3120
|
+
/**
|
|
3121
|
+
* {@inheritDoc PollMediaBuilder.toJSON}
|
|
3122
|
+
*/
|
|
3104
3123
|
toJSON(validationOverride) {
|
|
3105
3124
|
const clone = structuredClone(this.data);
|
|
3106
3125
|
validate(pollQuestionPredicate, clone, validationOverride);
|
|
@@ -3228,7 +3247,7 @@ var PollBuilder = class {
|
|
|
3228
3247
|
* @param updater - The function to update the question with
|
|
3229
3248
|
*/
|
|
3230
3249
|
updateQuestion(updater) {
|
|
3231
|
-
updater(this.data.question
|
|
3250
|
+
updater(this.data.question);
|
|
3232
3251
|
return this;
|
|
3233
3252
|
}
|
|
3234
3253
|
/**
|
|
@@ -3299,7 +3318,7 @@ var PollBuilder = class {
|
|
|
3299
3318
|
};
|
|
3300
3319
|
|
|
3301
3320
|
// src/index.ts
|
|
3302
|
-
var version = "2.0.0-dev.
|
|
3321
|
+
var version = "2.0.0-dev.1741219959-e273afbb9";
|
|
3303
3322
|
export {
|
|
3304
3323
|
ActionRowBuilder,
|
|
3305
3324
|
ApplicationCommandNumericOptionMinMaxValueMixin,
|