@discordjs/builders 0.14.0-dev.1651147747-679dcda → 0.14.0-dev.1652400688-aed687b

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.ts CHANGED
@@ -1199,6 +1199,39 @@ declare function validateDefaultPermission$1(value: unknown): asserts value is b
1199
1199
  declare function validateRequired(required: unknown): asserts required is boolean;
1200
1200
  declare function validateChoicesLength(amountAdding: number, choices?: APIApplicationCommandOptionChoice[]): void;
1201
1201
  declare function assertReturnOfBuilder<T extends ApplicationCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder>(input: unknown, ExpectedInstanceOf: new () => T): asserts input is T;
1202
+ declare const localizationMapPredicate: _sapphire_shapeshift.UnionValidator<{
1203
+ "en-US": string | null;
1204
+ "en-GB": string | null;
1205
+ bg: string | null;
1206
+ "zh-CN": string | null;
1207
+ "zh-TW": string | null;
1208
+ hr: string | null;
1209
+ cs: string | null;
1210
+ da: string | null;
1211
+ nl: string | null;
1212
+ fi: string | null;
1213
+ fr: string | null;
1214
+ de: string | null;
1215
+ el: string | null;
1216
+ hi: string | null;
1217
+ hu: string | null;
1218
+ it: string | null;
1219
+ ja: string | null;
1220
+ ko: string | null;
1221
+ lt: string | null;
1222
+ no: string | null;
1223
+ pl: string | null;
1224
+ "pt-BR": string | null;
1225
+ ro: string | null;
1226
+ ru: string | null;
1227
+ "es-ES": string | null;
1228
+ "sv-SE": string | null;
1229
+ th: string | null;
1230
+ tr: string | null;
1231
+ uk: string | null;
1232
+ vi: string | null;
1233
+ } | null | undefined>;
1234
+ declare function validateLocalizationMap(value: unknown): asserts value is LocalizationMap;
1202
1235
 
1203
1236
  declare const Assertions$1_validateDescription: typeof validateDescription;
1204
1237
  declare const Assertions$1_validateLocale: typeof validateLocale;
@@ -1206,6 +1239,8 @@ declare const Assertions$1_validateMaxOptionsLength: typeof validateMaxOptionsLe
1206
1239
  declare const Assertions$1_validateRequired: typeof validateRequired;
1207
1240
  declare const Assertions$1_validateChoicesLength: typeof validateChoicesLength;
1208
1241
  declare const Assertions$1_assertReturnOfBuilder: typeof assertReturnOfBuilder;
1242
+ declare const Assertions$1_localizationMapPredicate: typeof localizationMapPredicate;
1243
+ declare const Assertions$1_validateLocalizationMap: typeof validateLocalizationMap;
1209
1244
  declare namespace Assertions$1 {
1210
1245
  export {
1211
1246
  validateName$1 as validateName,
@@ -1217,6 +1252,8 @@ declare namespace Assertions$1 {
1217
1252
  Assertions$1_validateRequired as validateRequired,
1218
1253
  Assertions$1_validateChoicesLength as validateChoicesLength,
1219
1254
  Assertions$1_assertReturnOfBuilder as assertReturnOfBuilder,
1255
+ Assertions$1_localizationMapPredicate as localizationMapPredicate,
1256
+ Assertions$1_validateLocalizationMap as validateLocalizationMap,
1220
1257
  };
1221
1258
  }
1222
1259
 
@@ -1225,6 +1262,10 @@ declare class ContextMenuCommandBuilder {
1225
1262
  * The name of this context menu command
1226
1263
  */
1227
1264
  readonly name: string;
1265
+ /**
1266
+ * The localized names for this command
1267
+ */
1268
+ readonly name_localizations?: LocalizationMap;
1228
1269
  /**
1229
1270
  * The type of this context menu command
1230
1271
  */
@@ -1257,6 +1298,19 @@ declare class ContextMenuCommandBuilder {
1257
1298
  * @see https://discord.com/developers/docs/interactions/application-commands#permissions
1258
1299
  */
1259
1300
  setDefaultPermission(value: boolean): this;
1301
+ /**
1302
+ * Sets a name localization
1303
+ *
1304
+ * @param locale The locale to set a description for
1305
+ * @param localizedName The localized description for the given locale
1306
+ */
1307
+ setNameLocalization(locale: LocaleString, localizedName: string | null): this;
1308
+ /**
1309
+ * Sets the name localizations
1310
+ *
1311
+ * @param localizedNames The dictionary of localized descriptions to set
1312
+ */
1313
+ setNameLocalizations(localizedNames: LocalizationMap | null): this;
1260
1314
  /**
1261
1315
  * Returns the final data that should be sent to Discord.
1262
1316
  *
package/dist/index.js CHANGED
@@ -119,8 +119,8 @@ __export(Assertions_exports, {
119
119
  validateFieldLength: () => validateFieldLength
120
120
  });
121
121
  var import_shapeshift = require("@sapphire/shapeshift");
122
- var fieldNamePredicate = import_shapeshift.s.string.lengthGe(1).lengthLe(256);
123
- var fieldValuePredicate = import_shapeshift.s.string.lengthGe(1).lengthLe(1024);
122
+ var fieldNamePredicate = import_shapeshift.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(256);
123
+ var fieldValuePredicate = import_shapeshift.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(1024);
124
124
  var fieldInlinePredicate = import_shapeshift.s.boolean.optional;
125
125
  var embedFieldPredicate = import_shapeshift.s.object({
126
126
  name: fieldNamePredicate,
@@ -128,7 +128,7 @@ var embedFieldPredicate = import_shapeshift.s.object({
128
128
  inline: fieldInlinePredicate
129
129
  });
130
130
  var embedFieldsArrayPredicate = embedFieldPredicate.array;
131
- var fieldLengthPredicate = import_shapeshift.s.number.le(25);
131
+ var fieldLengthPredicate = import_shapeshift.s.number.lessThanOrEqual(25);
132
132
  function validateFieldLength(amountAdding, fields) {
133
133
  fieldLengthPredicate.parse((fields?.length ?? 0) + amountAdding);
134
134
  }
@@ -145,10 +145,10 @@ var embedAuthorPredicate = import_shapeshift.s.object({
145
145
  iconURL: imageURLPredicate,
146
146
  url: urlPredicate
147
147
  });
148
- var RGBPredicate = import_shapeshift.s.number.int.ge(0).le(255);
149
- var colorPredicate = import_shapeshift.s.number.int.ge(0).le(16777215).or(import_shapeshift.s.tuple([RGBPredicate, RGBPredicate, RGBPredicate])).nullable;
150
- var descriptionPredicate = import_shapeshift.s.string.lengthGe(1).lengthLe(4096).nullable;
151
- var footerTextPredicate = import_shapeshift.s.string.lengthGe(1).lengthLe(2048).nullable;
148
+ var RGBPredicate = import_shapeshift.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(255);
149
+ var colorPredicate = import_shapeshift.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(16777215).or(import_shapeshift.s.tuple([RGBPredicate, RGBPredicate, RGBPredicate])).nullable;
150
+ var descriptionPredicate = import_shapeshift.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(4096).nullable;
151
+ var footerTextPredicate = import_shapeshift.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(2048).nullable;
152
152
  var embedFooterPredicate = import_shapeshift.s.object({
153
153
  text: footerTextPredicate,
154
154
  iconURL: imageURLPredicate
@@ -429,18 +429,18 @@ var UnsafeSelectMenuOptionBuilder = class {
429
429
  __name(UnsafeSelectMenuOptionBuilder, "UnsafeSelectMenuOptionBuilder");
430
430
 
431
431
  // src/components/Assertions.ts
432
- var customIdValidator = import_shapeshift2.s.string.lengthGe(1).lengthLe(100);
432
+ var customIdValidator = import_shapeshift2.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);
433
433
  var emojiValidator = import_shapeshift2.s.object({
434
434
  id: import_shapeshift2.s.string,
435
435
  name: import_shapeshift2.s.string,
436
436
  animated: import_shapeshift2.s.boolean
437
437
  }).partial.strict;
438
438
  var disabledValidator = import_shapeshift2.s.boolean;
439
- var buttonLabelValidator = import_shapeshift2.s.string.lengthGe(1).lengthLe(80);
439
+ var buttonLabelValidator = import_shapeshift2.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(80);
440
440
  var buttonStyleValidator = import_shapeshift2.s.nativeEnum(import_v10.ButtonStyle);
441
- var placeholderValidator = import_shapeshift2.s.string.lengthLe(150);
442
- var minMaxValidator = import_shapeshift2.s.number.int.ge(0).le(25);
443
- var labelValueDescriptionValidator = import_shapeshift2.s.string.lengthGe(1).lengthLe(100);
441
+ var placeholderValidator = import_shapeshift2.s.string.lengthLessThanOrEqual(150);
442
+ var minMaxValidator = import_shapeshift2.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(25);
443
+ var labelValueDescriptionValidator = import_shapeshift2.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);
444
444
  var optionValidator = import_shapeshift2.s.union(import_shapeshift2.s.object({
445
445
  label: labelValueDescriptionValidator,
446
446
  value: labelValueDescriptionValidator,
@@ -448,14 +448,14 @@ var optionValidator = import_shapeshift2.s.union(import_shapeshift2.s.object({
448
448
  emoji: emojiValidator.optional,
449
449
  default: import_shapeshift2.s.boolean.optional
450
450
  }), import_shapeshift2.s.instance(UnsafeSelectMenuOptionBuilder));
451
- var optionsValidator = optionValidator.array.lengthGe(0);
452
- var optionsLengthValidator = import_shapeshift2.s.number.int.ge(0).le(25);
451
+ var optionsValidator = optionValidator.array.lengthGreaterThanOrEqual(0);
452
+ var optionsLengthValidator = import_shapeshift2.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(25);
453
453
  function validateRequiredSelectMenuParameters(options, customId) {
454
454
  customIdValidator.parse(customId);
455
455
  optionsValidator.parse(options);
456
456
  }
457
457
  __name(validateRequiredSelectMenuParameters, "validateRequiredSelectMenuParameters");
458
- var labelValueValidator = import_shapeshift2.s.string.lengthGe(1).lengthLe(100);
458
+ var labelValueValidator = import_shapeshift2.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);
459
459
  var defaultValidator = import_shapeshift2.s.boolean;
460
460
  function validateRequiredSelectMenuOptionParameters(label, value) {
461
461
  labelValueValidator.parse(label);
@@ -619,12 +619,12 @@ __export(Assertions_exports3, {
619
619
  var import_shapeshift3 = require("@sapphire/shapeshift");
620
620
  var import_v105 = require("discord-api-types/v10");
621
621
  var textInputStyleValidator = import_shapeshift3.s.nativeEnum(import_v105.TextInputStyle);
622
- var minLengthValidator = import_shapeshift3.s.number.int.ge(0).le(4e3);
623
- var maxLengthValidator = import_shapeshift3.s.number.int.ge(1).le(4e3);
622
+ var minLengthValidator = import_shapeshift3.s.number.int.greaterThanOrEqual(0).lessThanOrEqual(4e3);
623
+ var maxLengthValidator = import_shapeshift3.s.number.int.greaterThanOrEqual(1).lessThanOrEqual(4e3);
624
624
  var requiredValidator = import_shapeshift3.s.boolean;
625
- var valueValidator = import_shapeshift3.s.string.lengthLe(4e3);
626
- var placeholderValidator2 = import_shapeshift3.s.string.lengthLe(100);
627
- var labelValidator = import_shapeshift3.s.string.lengthGe(1).lengthLe(45);
625
+ var valueValidator = import_shapeshift3.s.string.lengthLessThanOrEqual(4e3);
626
+ var placeholderValidator2 = import_shapeshift3.s.string.lengthLessThanOrEqual(100);
627
+ var labelValidator = import_shapeshift3.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45);
628
628
  function validateRequiredParameters(customId, style, label) {
629
629
  customIdValidator.parse(customId);
630
630
  textInputStyleValidator.parse(style);
@@ -750,8 +750,8 @@ __export(Assertions_exports4, {
750
750
  validateRequiredParameters: () => validateRequiredParameters2
751
751
  });
752
752
  var import_shapeshift4 = require("@sapphire/shapeshift");
753
- var titleValidator = import_shapeshift4.s.string.lengthGe(1).lengthLe(45);
754
- var componentsValidator = import_shapeshift4.s.instance(ActionRowBuilder).array.lengthGe(1);
753
+ var titleValidator = import_shapeshift4.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(45);
754
+ var componentsValidator = import_shapeshift4.s.instance(ActionRowBuilder).array.lengthGreaterThanOrEqual(1);
755
755
  function validateRequiredParameters2(customId, title, components) {
756
756
  customIdValidator.parse(customId);
757
757
  titleValidator.parse(title);
@@ -876,10 +876,12 @@ __name(SelectMenuOptionBuilder, "SelectMenuOptionBuilder");
876
876
  var Assertions_exports5 = {};
877
877
  __export(Assertions_exports5, {
878
878
  assertReturnOfBuilder: () => assertReturnOfBuilder,
879
+ localizationMapPredicate: () => localizationMapPredicate,
879
880
  validateChoicesLength: () => validateChoicesLength,
880
881
  validateDefaultPermission: () => validateDefaultPermission,
881
882
  validateDescription: () => validateDescription,
882
883
  validateLocale: () => validateLocale,
884
+ validateLocalizationMap: () => validateLocalizationMap,
883
885
  validateMaxOptionsLength: () => validateMaxOptionsLength,
884
886
  validateName: () => validateName,
885
887
  validateRequired: () => validateRequired,
@@ -888,18 +890,18 @@ __export(Assertions_exports5, {
888
890
  var import_shapeshift5 = require("@sapphire/shapeshift");
889
891
  var import_is = __toESM(require("@sindresorhus/is"));
890
892
  var import_v108 = require("discord-api-types/v10");
891
- var namePredicate = import_shapeshift5.s.string.lengthGe(1).lengthLe(32).regex(/^[\P{Lu}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u);
893
+ var namePredicate = import_shapeshift5.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/^[\P{Lu}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u);
892
894
  function validateName(name) {
893
895
  namePredicate.parse(name);
894
896
  }
895
897
  __name(validateName, "validateName");
896
- var descriptionPredicate2 = import_shapeshift5.s.string.lengthGe(1).lengthLe(100);
898
+ var descriptionPredicate2 = import_shapeshift5.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);
897
899
  var localePredicate = import_shapeshift5.s.nativeEnum(import_v108.Locale);
898
900
  function validateDescription(description) {
899
901
  descriptionPredicate2.parse(description);
900
902
  }
901
903
  __name(validateDescription, "validateDescription");
902
- var maxArrayLengthPredicate = import_shapeshift5.s.unknown.array.lengthLe(25);
904
+ var maxArrayLengthPredicate = import_shapeshift5.s.unknown.array.lengthLessThanOrEqual(25);
903
905
  function validateLocale(locale) {
904
906
  return localePredicate.parse(locale);
905
907
  }
@@ -923,7 +925,7 @@ function validateRequired(required) {
923
925
  booleanPredicate.parse(required);
924
926
  }
925
927
  __name(validateRequired, "validateRequired");
926
- var choicesLengthPredicate = import_shapeshift5.s.number.le(25);
928
+ var choicesLengthPredicate = import_shapeshift5.s.number.lessThanOrEqual(25);
927
929
  function validateChoicesLength(amountAdding, choices) {
928
930
  choicesLengthPredicate.parse((choices?.length ?? 0) + amountAdding);
929
931
  }
@@ -945,6 +947,11 @@ function assertReturnOfBuilder(input, ExpectedInstanceOf) {
945
947
  }
946
948
  }
947
949
  __name(assertReturnOfBuilder, "assertReturnOfBuilder");
950
+ var localizationMapPredicate = import_shapeshift5.s.object(Object.fromEntries(Object.values(import_v108.Locale).map((locale) => [locale, import_shapeshift5.s.string.nullish]))).strict.nullish;
951
+ function validateLocalizationMap(value) {
952
+ localizationMapPredicate.parse(value);
953
+ }
954
+ __name(validateLocalizationMap, "validateLocalizationMap");
948
955
 
949
956
  // src/interactions/slashCommands/SlashCommandBuilder.ts
950
957
  var import_ts_mixer6 = require("ts-mixer");
@@ -975,12 +982,13 @@ var SharedNameAndDescription = class {
975
982
  if (!this.name_localizations) {
976
983
  Reflect.set(this, "name_localizations", {});
977
984
  }
985
+ const parsedLocale = validateLocale(locale);
978
986
  if (localizedName === null) {
979
- this.name_localizations[locale] = null;
987
+ this.name_localizations[parsedLocale] = null;
980
988
  return this;
981
989
  }
982
990
  validateName(localizedName);
983
- this.name_localizations[validateLocale(locale)] = localizedName;
991
+ this.name_localizations[parsedLocale] = localizedName;
984
992
  return this;
985
993
  }
986
994
  setNameLocalizations(localizedNames) {
@@ -996,12 +1004,13 @@ var SharedNameAndDescription = class {
996
1004
  if (!this.description_localizations) {
997
1005
  Reflect.set(this, "description_localizations", {});
998
1006
  }
1007
+ const parsedLocale = validateLocale(locale);
999
1008
  if (localizedDescription === null) {
1000
- this.description_localizations[locale] = null;
1009
+ this.description_localizations[parsedLocale] = null;
1001
1010
  return this;
1002
1011
  }
1003
1012
  validateDescription(localizedDescription);
1004
- this.description_localizations[validateLocale(locale)] = localizedDescription;
1013
+ this.description_localizations[parsedLocale] = localizedDescription;
1005
1014
  return this;
1006
1015
  }
1007
1016
  setDescriptionLocalizations(localizedDescriptions) {
@@ -1032,6 +1041,8 @@ var ApplicationCommandOptionBase = class extends SharedNameAndDescription {
1032
1041
  }
1033
1042
  runRequiredValidations() {
1034
1043
  validateRequiredParameters3(this.name, this.description, []);
1044
+ validateLocalizationMap(this.name_localizations);
1045
+ validateLocalizationMap(this.description_localizations);
1035
1046
  validateRequired(this.required);
1036
1047
  }
1037
1048
  };
@@ -1129,9 +1140,13 @@ __name(ApplicationCommandNumericOptionMinMaxValueMixin, "ApplicationCommandNumer
1129
1140
  // src/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.ts
1130
1141
  var import_shapeshift7 = require("@sapphire/shapeshift");
1131
1142
  var import_v1013 = require("discord-api-types/v10");
1132
- var stringPredicate = import_shapeshift7.s.string.lengthGe(1).lengthLe(100);
1133
- var numberPredicate = import_shapeshift7.s.number.gt(-Infinity).lt(Infinity);
1134
- var choicesPredicate = import_shapeshift7.s.object({ name: stringPredicate, value: import_shapeshift7.s.union(stringPredicate, numberPredicate) }).array;
1143
+ var stringPredicate = import_shapeshift7.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);
1144
+ var numberPredicate = import_shapeshift7.s.number.greaterThan(-Infinity).lessThan(Infinity);
1145
+ var choicesPredicate = import_shapeshift7.s.object({
1146
+ name: stringPredicate,
1147
+ name_localizations: localizationMapPredicate,
1148
+ value: import_shapeshift7.s.union(stringPredicate, numberPredicate)
1149
+ }).array;
1135
1150
  var booleanPredicate2 = import_shapeshift7.s.boolean;
1136
1151
  var ApplicationCommandOptionWithChoicesAndAutocompleteMixin = class {
1137
1152
  constructor() {
@@ -1148,13 +1163,13 @@ var ApplicationCommandOptionWithChoicesAndAutocompleteMixin = class {
1148
1163
  Reflect.set(this, "choices", []);
1149
1164
  }
1150
1165
  validateChoicesLength(choices.length, this.choices);
1151
- for (const { name, value } of choices) {
1166
+ for (const { name, name_localizations, value } of choices) {
1152
1167
  if (this.type === import_v1013.ApplicationCommandOptionType.String) {
1153
1168
  stringPredicate.parse(value);
1154
1169
  } else {
1155
1170
  numberPredicate.parse(value);
1156
1171
  }
1157
- this.choices.push({ name, value });
1172
+ this.choices.push({ name, name_localizations, value });
1158
1173
  }
1159
1174
  return this;
1160
1175
  }
@@ -1367,7 +1382,9 @@ var SlashCommandSubcommandGroupBuilder = class {
1367
1382
  return {
1368
1383
  type: import_v1020.ApplicationCommandOptionType.SubcommandGroup,
1369
1384
  name: this.name,
1385
+ name_localizations: this.name_localizations,
1370
1386
  description: this.description,
1387
+ description_localizations: this.description_localizations,
1371
1388
  options: this.options.map((option) => option.toJSON())
1372
1389
  };
1373
1390
  }
@@ -1387,7 +1404,9 @@ var SlashCommandSubcommandBuilder = class {
1387
1404
  return {
1388
1405
  type: import_v1020.ApplicationCommandOptionType.Subcommand,
1389
1406
  name: this.name,
1407
+ name_localizations: this.name_localizations,
1390
1408
  description: this.description,
1409
+ description_localizations: this.description_localizations,
1391
1410
  options: this.options.map((option) => option.toJSON())
1392
1411
  };
1393
1412
  }
@@ -1409,6 +1428,8 @@ var SlashCommandBuilder = class {
1409
1428
  }
1410
1429
  toJSON() {
1411
1430
  validateRequiredParameters3(this.name, this.description, this.options);
1431
+ validateLocalizationMap(this.name_localizations);
1432
+ validateLocalizationMap(this.description_localizations);
1412
1433
  return {
1413
1434
  name: this.name,
1414
1435
  name_localizations: this.name_localizations,
@@ -1455,7 +1476,7 @@ __export(Assertions_exports6, {
1455
1476
  });
1456
1477
  var import_shapeshift10 = require("@sapphire/shapeshift");
1457
1478
  var import_v1021 = require("discord-api-types/v10");
1458
- var namePredicate2 = import_shapeshift10.s.string.lengthGe(1).lengthLe(32).regex(/^( *[\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+ *)+$/u);
1479
+ var namePredicate2 = import_shapeshift10.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/^( *[\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+ *)+$/u);
1459
1480
  var typePredicate = import_shapeshift10.s.union(import_shapeshift10.s.literal(import_v1021.ApplicationCommandType.User), import_shapeshift10.s.literal(import_v1021.ApplicationCommandType.Message));
1460
1481
  var booleanPredicate3 = import_shapeshift10.s.boolean;
1461
1482
  function validateDefaultPermission2(value) {
@@ -1480,6 +1501,7 @@ __name(validateRequiredParameters4, "validateRequiredParameters");
1480
1501
  var ContextMenuCommandBuilder = class {
1481
1502
  constructor() {
1482
1503
  __publicField(this, "name");
1504
+ __publicField(this, "name_localizations");
1483
1505
  __publicField(this, "type");
1484
1506
  __publicField(this, "defaultPermission");
1485
1507
  }
@@ -1498,10 +1520,34 @@ var ContextMenuCommandBuilder = class {
1498
1520
  Reflect.set(this, "defaultPermission", value);
1499
1521
  return this;
1500
1522
  }
1523
+ setNameLocalization(locale, localizedName) {
1524
+ if (!this.name_localizations) {
1525
+ Reflect.set(this, "name_localizations", {});
1526
+ }
1527
+ const parsedLocale = validateLocale(locale);
1528
+ if (localizedName === null) {
1529
+ this.name_localizations[parsedLocale] = null;
1530
+ return this;
1531
+ }
1532
+ validateName2(localizedName);
1533
+ this.name_localizations[parsedLocale] = localizedName;
1534
+ return this;
1535
+ }
1536
+ setNameLocalizations(localizedNames) {
1537
+ if (localizedNames === null) {
1538
+ Reflect.set(this, "name_localizations", null);
1539
+ return this;
1540
+ }
1541
+ Reflect.set(this, "name_localizations", {});
1542
+ Object.entries(localizedNames).forEach((args) => this.setNameLocalization(...args));
1543
+ return this;
1544
+ }
1501
1545
  toJSON() {
1502
1546
  validateRequiredParameters4(this.name, this.type);
1547
+ validateLocalizationMap(this.name_localizations);
1503
1548
  return {
1504
1549
  name: this.name,
1550
+ name_localizations: this.name_localizations,
1505
1551
  type: this.type,
1506
1552
  default_permission: this.defaultPermission
1507
1553
  };