@discordjs/builders 0.14.0-dev.1651493044-4ba0f56 → 0.14.0-dev.1652443433-d522320
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 +129 -5
- package/dist/index.js +136 -51
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +136 -51
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _sapphire_shapeshift from '@sapphire/shapeshift';
|
|
2
|
-
import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, APIActionRowComponentTypes, APIActionRowComponent, APIBaseComponent, ComponentType, APIMessageActionRowComponent, APIModalActionRowComponent, APIButtonComponent, APIMessageComponent, APIModalComponent, APITextInputComponent, TextInputStyle, APIModalInteractionResponseCallbackData, APISelectMenuComponent, LocalizationMap, LocaleString, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandAttachmentOption, APIApplicationCommandBooleanOption, ChannelType, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, RESTPostAPIApplicationCommandsJSONBody, APIApplicationCommandOption, Locale, ApplicationCommandType } from 'discord-api-types/v10';
|
|
2
|
+
import { APIEmbedField, APIEmbedAuthor, APIEmbedFooter, APIEmbedImage, APIEmbed, APISelectMenuOption, APIMessageComponentEmoji, ButtonStyle, APIActionRowComponentTypes, APIActionRowComponent, APIBaseComponent, ComponentType, APIMessageActionRowComponent, APIModalActionRowComponent, APIButtonComponent, APIMessageComponent, APIModalComponent, APITextInputComponent, TextInputStyle, APIModalInteractionResponseCallbackData, APISelectMenuComponent, LocalizationMap, LocaleString, ApplicationCommandOptionType, APIApplicationCommandBasicOption, APIApplicationCommandAttachmentOption, APIApplicationCommandBooleanOption, ChannelType, APIApplicationCommandChannelOption, APIApplicationCommandOptionChoice, APIApplicationCommandIntegerOption, APIApplicationCommandMentionableOption, APIApplicationCommandNumberOption, APIApplicationCommandRoleOption, APIApplicationCommandStringOption, APIApplicationCommandUserOption, APIApplicationCommandSubcommandGroupOption, APIApplicationCommandSubcommandOption, RESTPostAPIApplicationCommandsJSONBody, APIApplicationCommandOption, Locale, Permissions as Permissions$1, ApplicationCommandType } from 'discord-api-types/v10';
|
|
3
3
|
import { URL } from 'url';
|
|
4
4
|
import { Snowflake } from 'discord-api-types/globals';
|
|
5
5
|
|
|
@@ -1148,9 +1148,19 @@ declare class SlashCommandBuilder {
|
|
|
1148
1148
|
/**
|
|
1149
1149
|
* Whether the command is enabled by default when the app is added to a guild
|
|
1150
1150
|
*
|
|
1151
|
-
* @
|
|
1151
|
+
* @deprecated This property is deprecated and will be removed in the future.
|
|
1152
|
+
* You should use `setDefaultMemberPermissions` or `setDMPermission` instead.
|
|
1152
1153
|
*/
|
|
1153
|
-
readonly
|
|
1154
|
+
readonly default_permission: boolean | undefined;
|
|
1155
|
+
/**
|
|
1156
|
+
* Set of permissions represented as a bit set for the command
|
|
1157
|
+
*/
|
|
1158
|
+
readonly default_member_permissions: Permissions | null | undefined;
|
|
1159
|
+
/**
|
|
1160
|
+
* Indicates whether the command is available in DMs with the application, only for globally-scoped commands.
|
|
1161
|
+
* By default, commands are visible.
|
|
1162
|
+
*/
|
|
1163
|
+
readonly dm_permission: boolean | null | undefined;
|
|
1154
1164
|
/**
|
|
1155
1165
|
* Returns the final data that should be sent to Discord.
|
|
1156
1166
|
*
|
|
@@ -1165,8 +1175,28 @@ declare class SlashCommandBuilder {
|
|
|
1165
1175
|
* @param value Whether or not to enable this command by default
|
|
1166
1176
|
*
|
|
1167
1177
|
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
1178
|
+
* @deprecated Use `setDefaultMemberPermissions` or `setDMPermission` instead.
|
|
1168
1179
|
*/
|
|
1169
1180
|
setDefaultPermission(value: boolean): this;
|
|
1181
|
+
/**
|
|
1182
|
+
* Sets the default permissions a member should have in order to run the command.
|
|
1183
|
+
*
|
|
1184
|
+
* **Note:** You can set this to `'0'` to disable the command by default.
|
|
1185
|
+
*
|
|
1186
|
+
* @param permissions The permissions bit field to set
|
|
1187
|
+
*
|
|
1188
|
+
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
1189
|
+
*/
|
|
1190
|
+
setDefaultMemberPermissions(permissions: Permissions | null | undefined): this;
|
|
1191
|
+
/**
|
|
1192
|
+
* Sets if the command is available in DMs with the application, only for globally-scoped commands.
|
|
1193
|
+
* By default, commands are visible.
|
|
1194
|
+
*
|
|
1195
|
+
* @param enabled If the command should be enabled in DMs
|
|
1196
|
+
*
|
|
1197
|
+
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
1198
|
+
*/
|
|
1199
|
+
setDMPermission(enabled: boolean | null | undefined): this;
|
|
1170
1200
|
/**
|
|
1171
1201
|
* Adds a new subcommand group to this command
|
|
1172
1202
|
*
|
|
@@ -1199,6 +1229,41 @@ declare function validateDefaultPermission$1(value: unknown): asserts value is b
|
|
|
1199
1229
|
declare function validateRequired(required: unknown): asserts required is boolean;
|
|
1200
1230
|
declare function validateChoicesLength(amountAdding: number, choices?: APIApplicationCommandOptionChoice[]): void;
|
|
1201
1231
|
declare function assertReturnOfBuilder<T extends ApplicationCommandOptionBase | SlashCommandSubcommandBuilder | SlashCommandSubcommandGroupBuilder>(input: unknown, ExpectedInstanceOf: new () => T): asserts input is T;
|
|
1232
|
+
declare const localizationMapPredicate: _sapphire_shapeshift.UnionValidator<{
|
|
1233
|
+
"en-US": string | null;
|
|
1234
|
+
"en-GB": string | null;
|
|
1235
|
+
bg: string | null;
|
|
1236
|
+
"zh-CN": string | null;
|
|
1237
|
+
"zh-TW": string | null;
|
|
1238
|
+
hr: string | null;
|
|
1239
|
+
cs: string | null;
|
|
1240
|
+
da: string | null;
|
|
1241
|
+
nl: string | null;
|
|
1242
|
+
fi: string | null;
|
|
1243
|
+
fr: string | null;
|
|
1244
|
+
de: string | null;
|
|
1245
|
+
el: string | null;
|
|
1246
|
+
hi: string | null;
|
|
1247
|
+
hu: string | null;
|
|
1248
|
+
it: string | null;
|
|
1249
|
+
ja: string | null;
|
|
1250
|
+
ko: string | null;
|
|
1251
|
+
lt: string | null;
|
|
1252
|
+
no: string | null;
|
|
1253
|
+
pl: string | null;
|
|
1254
|
+
"pt-BR": string | null;
|
|
1255
|
+
ro: string | null;
|
|
1256
|
+
ru: string | null;
|
|
1257
|
+
"es-ES": string | null;
|
|
1258
|
+
"sv-SE": string | null;
|
|
1259
|
+
th: string | null;
|
|
1260
|
+
tr: string | null;
|
|
1261
|
+
uk: string | null;
|
|
1262
|
+
vi: string | null;
|
|
1263
|
+
} | null | undefined>;
|
|
1264
|
+
declare function validateLocalizationMap(value: unknown): asserts value is LocalizationMap;
|
|
1265
|
+
declare function validateDMPermission$1(value: unknown): asserts value is boolean | null | undefined;
|
|
1266
|
+
declare function validateDefaultMemberPermissions$1(permissions: unknown): string | null | undefined;
|
|
1202
1267
|
|
|
1203
1268
|
declare const Assertions$1_validateDescription: typeof validateDescription;
|
|
1204
1269
|
declare const Assertions$1_validateLocale: typeof validateLocale;
|
|
@@ -1206,6 +1271,8 @@ declare const Assertions$1_validateMaxOptionsLength: typeof validateMaxOptionsLe
|
|
|
1206
1271
|
declare const Assertions$1_validateRequired: typeof validateRequired;
|
|
1207
1272
|
declare const Assertions$1_validateChoicesLength: typeof validateChoicesLength;
|
|
1208
1273
|
declare const Assertions$1_assertReturnOfBuilder: typeof assertReturnOfBuilder;
|
|
1274
|
+
declare const Assertions$1_localizationMapPredicate: typeof localizationMapPredicate;
|
|
1275
|
+
declare const Assertions$1_validateLocalizationMap: typeof validateLocalizationMap;
|
|
1209
1276
|
declare namespace Assertions$1 {
|
|
1210
1277
|
export {
|
|
1211
1278
|
validateName$1 as validateName,
|
|
@@ -1217,6 +1284,10 @@ declare namespace Assertions$1 {
|
|
|
1217
1284
|
Assertions$1_validateRequired as validateRequired,
|
|
1218
1285
|
Assertions$1_validateChoicesLength as validateChoicesLength,
|
|
1219
1286
|
Assertions$1_assertReturnOfBuilder as assertReturnOfBuilder,
|
|
1287
|
+
Assertions$1_localizationMapPredicate as localizationMapPredicate,
|
|
1288
|
+
Assertions$1_validateLocalizationMap as validateLocalizationMap,
|
|
1289
|
+
validateDMPermission$1 as validateDMPermission,
|
|
1290
|
+
validateDefaultMemberPermissions$1 as validateDefaultMemberPermissions,
|
|
1220
1291
|
};
|
|
1221
1292
|
}
|
|
1222
1293
|
|
|
@@ -1225,6 +1296,10 @@ declare class ContextMenuCommandBuilder {
|
|
|
1225
1296
|
* The name of this context menu command
|
|
1226
1297
|
*/
|
|
1227
1298
|
readonly name: string;
|
|
1299
|
+
/**
|
|
1300
|
+
* The localized names for this command
|
|
1301
|
+
*/
|
|
1302
|
+
readonly name_localizations?: LocalizationMap;
|
|
1228
1303
|
/**
|
|
1229
1304
|
* The type of this context menu command
|
|
1230
1305
|
*/
|
|
@@ -1232,9 +1307,19 @@ declare class ContextMenuCommandBuilder {
|
|
|
1232
1307
|
/**
|
|
1233
1308
|
* Whether the command is enabled by default when the app is added to a guild
|
|
1234
1309
|
*
|
|
1235
|
-
* @
|
|
1310
|
+
* @deprecated This property is deprecated and will be removed in the future.
|
|
1311
|
+
* You should use `setDefaultMemberPermissions` or `setDMPermission` instead.
|
|
1312
|
+
*/
|
|
1313
|
+
readonly default_permission: boolean | undefined;
|
|
1314
|
+
/**
|
|
1315
|
+
* Set of permissions represented as a bit set for the command
|
|
1236
1316
|
*/
|
|
1237
|
-
readonly
|
|
1317
|
+
readonly default_member_permissions: Permissions$1 | null | undefined;
|
|
1318
|
+
/**
|
|
1319
|
+
* Indicates whether the command is available in DMs with the application, only for globally-scoped commands.
|
|
1320
|
+
* By default, commands are visible.
|
|
1321
|
+
*/
|
|
1322
|
+
readonly dm_permission: boolean | null | undefined;
|
|
1238
1323
|
/**
|
|
1239
1324
|
* Sets the name
|
|
1240
1325
|
*
|
|
@@ -1255,8 +1340,41 @@ declare class ContextMenuCommandBuilder {
|
|
|
1255
1340
|
* @param value Whether or not to enable this command by default
|
|
1256
1341
|
*
|
|
1257
1342
|
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
1343
|
+
* @deprecated Use `setDefaultMemberPermissions` or `setDMPermission` instead.
|
|
1258
1344
|
*/
|
|
1259
1345
|
setDefaultPermission(value: boolean): this;
|
|
1346
|
+
/**
|
|
1347
|
+
* Sets the default permissions a member should have in order to run the command.
|
|
1348
|
+
*
|
|
1349
|
+
* **Note:** You can set this to `'0'` to disable the command by default.
|
|
1350
|
+
*
|
|
1351
|
+
* @param permissions The permissions bit field to set
|
|
1352
|
+
*
|
|
1353
|
+
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
1354
|
+
*/
|
|
1355
|
+
setDefaultMemberPermissions(permissions: Permissions$1 | null | undefined): this;
|
|
1356
|
+
/**
|
|
1357
|
+
* Sets if the command is available in DMs with the application, only for globally-scoped commands.
|
|
1358
|
+
* By default, commands are visible.
|
|
1359
|
+
*
|
|
1360
|
+
* @param enabled If the command should be enabled in DMs
|
|
1361
|
+
*
|
|
1362
|
+
* @see https://discord.com/developers/docs/interactions/application-commands#permissions
|
|
1363
|
+
*/
|
|
1364
|
+
setDMPermission(enabled: boolean | null | undefined): this;
|
|
1365
|
+
/**
|
|
1366
|
+
* Sets a name localization
|
|
1367
|
+
*
|
|
1368
|
+
* @param locale The locale to set a description for
|
|
1369
|
+
* @param localizedName The localized description for the given locale
|
|
1370
|
+
*/
|
|
1371
|
+
setNameLocalization(locale: LocaleString, localizedName: string | null): this;
|
|
1372
|
+
/**
|
|
1373
|
+
* Sets the name localizations
|
|
1374
|
+
*
|
|
1375
|
+
* @param localizedNames The dictionary of localized descriptions to set
|
|
1376
|
+
*/
|
|
1377
|
+
setNameLocalizations(localizedNames: LocalizationMap | null): this;
|
|
1260
1378
|
/**
|
|
1261
1379
|
* Returns the final data that should be sent to Discord.
|
|
1262
1380
|
*
|
|
@@ -1270,17 +1388,23 @@ declare function validateDefaultPermission(value: unknown): asserts value is boo
|
|
|
1270
1388
|
declare function validateName(name: unknown): asserts name is string;
|
|
1271
1389
|
declare function validateType(type: unknown): asserts type is ContextMenuCommandType;
|
|
1272
1390
|
declare function validateRequiredParameters(name: string, type: number): void;
|
|
1391
|
+
declare function validateDMPermission(value: unknown): asserts value is boolean | null | undefined;
|
|
1392
|
+
declare function validateDefaultMemberPermissions(permissions: unknown): string | null | undefined;
|
|
1273
1393
|
|
|
1274
1394
|
declare const Assertions_validateDefaultPermission: typeof validateDefaultPermission;
|
|
1275
1395
|
declare const Assertions_validateName: typeof validateName;
|
|
1276
1396
|
declare const Assertions_validateType: typeof validateType;
|
|
1277
1397
|
declare const Assertions_validateRequiredParameters: typeof validateRequiredParameters;
|
|
1398
|
+
declare const Assertions_validateDMPermission: typeof validateDMPermission;
|
|
1399
|
+
declare const Assertions_validateDefaultMemberPermissions: typeof validateDefaultMemberPermissions;
|
|
1278
1400
|
declare namespace Assertions {
|
|
1279
1401
|
export {
|
|
1280
1402
|
Assertions_validateDefaultPermission as validateDefaultPermission,
|
|
1281
1403
|
Assertions_validateName as validateName,
|
|
1282
1404
|
Assertions_validateType as validateType,
|
|
1283
1405
|
Assertions_validateRequiredParameters as validateRequiredParameters,
|
|
1406
|
+
Assertions_validateDMPermission as validateDMPermission,
|
|
1407
|
+
Assertions_validateDefaultMemberPermissions as validateDefaultMemberPermissions,
|
|
1284
1408
|
};
|
|
1285
1409
|
}
|
|
1286
1410
|
|
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.
|
|
123
|
-
var fieldValuePredicate = import_shapeshift.s.string.
|
|
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.
|
|
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.
|
|
149
|
-
var colorPredicate = import_shapeshift.s.number.int.
|
|
150
|
-
var descriptionPredicate = import_shapeshift.s.string.
|
|
151
|
-
var footerTextPredicate = import_shapeshift.s.string.
|
|
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.
|
|
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.
|
|
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.
|
|
442
|
-
var minMaxValidator = import_shapeshift2.s.number.int.
|
|
443
|
-
var labelValueDescriptionValidator = import_shapeshift2.s.string.
|
|
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.
|
|
452
|
-
var optionsLengthValidator = import_shapeshift2.s.number.int.
|
|
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.
|
|
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.
|
|
623
|
-
var maxLengthValidator = import_shapeshift3.s.number.int.
|
|
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.
|
|
626
|
-
var placeholderValidator2 = import_shapeshift3.s.string.
|
|
627
|
-
var labelValidator = import_shapeshift3.s.string.
|
|
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.
|
|
754
|
-
var componentsValidator = import_shapeshift4.s.instance(ActionRowBuilder).array.
|
|
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,14 @@ __name(SelectMenuOptionBuilder, "SelectMenuOptionBuilder");
|
|
|
876
876
|
var Assertions_exports5 = {};
|
|
877
877
|
__export(Assertions_exports5, {
|
|
878
878
|
assertReturnOfBuilder: () => assertReturnOfBuilder,
|
|
879
|
+
localizationMapPredicate: () => localizationMapPredicate,
|
|
879
880
|
validateChoicesLength: () => validateChoicesLength,
|
|
881
|
+
validateDMPermission: () => validateDMPermission,
|
|
882
|
+
validateDefaultMemberPermissions: () => validateDefaultMemberPermissions,
|
|
880
883
|
validateDefaultPermission: () => validateDefaultPermission,
|
|
881
884
|
validateDescription: () => validateDescription,
|
|
882
885
|
validateLocale: () => validateLocale,
|
|
886
|
+
validateLocalizationMap: () => validateLocalizationMap,
|
|
883
887
|
validateMaxOptionsLength: () => validateMaxOptionsLength,
|
|
884
888
|
validateName: () => validateName,
|
|
885
889
|
validateRequired: () => validateRequired,
|
|
@@ -888,18 +892,18 @@ __export(Assertions_exports5, {
|
|
|
888
892
|
var import_shapeshift5 = require("@sapphire/shapeshift");
|
|
889
893
|
var import_is = __toESM(require("@sindresorhus/is"));
|
|
890
894
|
var import_v108 = require("discord-api-types/v10");
|
|
891
|
-
var namePredicate = import_shapeshift5.s.string.
|
|
895
|
+
var namePredicate = import_shapeshift5.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/^[\P{Lu}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+$/u);
|
|
892
896
|
function validateName(name) {
|
|
893
897
|
namePredicate.parse(name);
|
|
894
898
|
}
|
|
895
899
|
__name(validateName, "validateName");
|
|
896
|
-
var descriptionPredicate2 = import_shapeshift5.s.string.
|
|
900
|
+
var descriptionPredicate2 = import_shapeshift5.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);
|
|
897
901
|
var localePredicate = import_shapeshift5.s.nativeEnum(import_v108.Locale);
|
|
898
902
|
function validateDescription(description) {
|
|
899
903
|
descriptionPredicate2.parse(description);
|
|
900
904
|
}
|
|
901
905
|
__name(validateDescription, "validateDescription");
|
|
902
|
-
var maxArrayLengthPredicate = import_shapeshift5.s.unknown.array.
|
|
906
|
+
var maxArrayLengthPredicate = import_shapeshift5.s.unknown.array.lengthLessThanOrEqual(25);
|
|
903
907
|
function validateLocale(locale) {
|
|
904
908
|
return localePredicate.parse(locale);
|
|
905
909
|
}
|
|
@@ -923,7 +927,7 @@ function validateRequired(required) {
|
|
|
923
927
|
booleanPredicate.parse(required);
|
|
924
928
|
}
|
|
925
929
|
__name(validateRequired, "validateRequired");
|
|
926
|
-
var choicesLengthPredicate = import_shapeshift5.s.number.
|
|
930
|
+
var choicesLengthPredicate = import_shapeshift5.s.number.lessThanOrEqual(25);
|
|
927
931
|
function validateChoicesLength(amountAdding, choices) {
|
|
928
932
|
choicesLengthPredicate.parse((choices?.length ?? 0) + amountAdding);
|
|
929
933
|
}
|
|
@@ -945,6 +949,21 @@ function assertReturnOfBuilder(input, ExpectedInstanceOf) {
|
|
|
945
949
|
}
|
|
946
950
|
}
|
|
947
951
|
__name(assertReturnOfBuilder, "assertReturnOfBuilder");
|
|
952
|
+
var localizationMapPredicate = import_shapeshift5.s.object(Object.fromEntries(Object.values(import_v108.Locale).map((locale) => [locale, import_shapeshift5.s.string.nullish]))).strict.nullish;
|
|
953
|
+
function validateLocalizationMap(value) {
|
|
954
|
+
localizationMapPredicate.parse(value);
|
|
955
|
+
}
|
|
956
|
+
__name(validateLocalizationMap, "validateLocalizationMap");
|
|
957
|
+
var dmPermissionPredicate = import_shapeshift5.s.boolean.nullish;
|
|
958
|
+
function validateDMPermission(value) {
|
|
959
|
+
dmPermissionPredicate.parse(value);
|
|
960
|
+
}
|
|
961
|
+
__name(validateDMPermission, "validateDMPermission");
|
|
962
|
+
var memberPermissionPredicate = import_shapeshift5.s.union(import_shapeshift5.s.bigint.transform((value) => value.toString()), import_shapeshift5.s.number.safeInt.transform((value) => value.toString()), import_shapeshift5.s.string.regex(/^\d+$/)).nullish;
|
|
963
|
+
function validateDefaultMemberPermissions(permissions) {
|
|
964
|
+
return memberPermissionPredicate.parse(permissions);
|
|
965
|
+
}
|
|
966
|
+
__name(validateDefaultMemberPermissions, "validateDefaultMemberPermissions");
|
|
948
967
|
|
|
949
968
|
// src/interactions/slashCommands/SlashCommandBuilder.ts
|
|
950
969
|
var import_ts_mixer6 = require("ts-mixer");
|
|
@@ -975,12 +994,13 @@ var SharedNameAndDescription = class {
|
|
|
975
994
|
if (!this.name_localizations) {
|
|
976
995
|
Reflect.set(this, "name_localizations", {});
|
|
977
996
|
}
|
|
997
|
+
const parsedLocale = validateLocale(locale);
|
|
978
998
|
if (localizedName === null) {
|
|
979
|
-
this.name_localizations[
|
|
999
|
+
this.name_localizations[parsedLocale] = null;
|
|
980
1000
|
return this;
|
|
981
1001
|
}
|
|
982
1002
|
validateName(localizedName);
|
|
983
|
-
this.name_localizations[
|
|
1003
|
+
this.name_localizations[parsedLocale] = localizedName;
|
|
984
1004
|
return this;
|
|
985
1005
|
}
|
|
986
1006
|
setNameLocalizations(localizedNames) {
|
|
@@ -996,12 +1016,13 @@ var SharedNameAndDescription = class {
|
|
|
996
1016
|
if (!this.description_localizations) {
|
|
997
1017
|
Reflect.set(this, "description_localizations", {});
|
|
998
1018
|
}
|
|
1019
|
+
const parsedLocale = validateLocale(locale);
|
|
999
1020
|
if (localizedDescription === null) {
|
|
1000
|
-
this.description_localizations[
|
|
1021
|
+
this.description_localizations[parsedLocale] = null;
|
|
1001
1022
|
return this;
|
|
1002
1023
|
}
|
|
1003
1024
|
validateDescription(localizedDescription);
|
|
1004
|
-
this.description_localizations[
|
|
1025
|
+
this.description_localizations[parsedLocale] = localizedDescription;
|
|
1005
1026
|
return this;
|
|
1006
1027
|
}
|
|
1007
1028
|
setDescriptionLocalizations(localizedDescriptions) {
|
|
@@ -1032,6 +1053,8 @@ var ApplicationCommandOptionBase = class extends SharedNameAndDescription {
|
|
|
1032
1053
|
}
|
|
1033
1054
|
runRequiredValidations() {
|
|
1034
1055
|
validateRequiredParameters3(this.name, this.description, []);
|
|
1056
|
+
validateLocalizationMap(this.name_localizations);
|
|
1057
|
+
validateLocalizationMap(this.description_localizations);
|
|
1035
1058
|
validateRequired(this.required);
|
|
1036
1059
|
}
|
|
1037
1060
|
};
|
|
@@ -1129,9 +1152,13 @@ __name(ApplicationCommandNumericOptionMinMaxValueMixin, "ApplicationCommandNumer
|
|
|
1129
1152
|
// src/interactions/slashCommands/mixins/ApplicationCommandOptionWithChoicesAndAutocompleteMixin.ts
|
|
1130
1153
|
var import_shapeshift7 = require("@sapphire/shapeshift");
|
|
1131
1154
|
var import_v1013 = require("discord-api-types/v10");
|
|
1132
|
-
var stringPredicate = import_shapeshift7.s.string.
|
|
1133
|
-
var numberPredicate = import_shapeshift7.s.number.
|
|
1134
|
-
var choicesPredicate = import_shapeshift7.s.object({
|
|
1155
|
+
var stringPredicate = import_shapeshift7.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(100);
|
|
1156
|
+
var numberPredicate = import_shapeshift7.s.number.greaterThan(-Infinity).lessThan(Infinity);
|
|
1157
|
+
var choicesPredicate = import_shapeshift7.s.object({
|
|
1158
|
+
name: stringPredicate,
|
|
1159
|
+
name_localizations: localizationMapPredicate,
|
|
1160
|
+
value: import_shapeshift7.s.union(stringPredicate, numberPredicate)
|
|
1161
|
+
}).array;
|
|
1135
1162
|
var booleanPredicate2 = import_shapeshift7.s.boolean;
|
|
1136
1163
|
var ApplicationCommandOptionWithChoicesAndAutocompleteMixin = class {
|
|
1137
1164
|
constructor() {
|
|
@@ -1148,13 +1175,13 @@ var ApplicationCommandOptionWithChoicesAndAutocompleteMixin = class {
|
|
|
1148
1175
|
Reflect.set(this, "choices", []);
|
|
1149
1176
|
}
|
|
1150
1177
|
validateChoicesLength(choices.length, this.choices);
|
|
1151
|
-
for (const { name, value } of choices) {
|
|
1178
|
+
for (const { name, name_localizations, value } of choices) {
|
|
1152
1179
|
if (this.type === import_v1013.ApplicationCommandOptionType.String) {
|
|
1153
1180
|
stringPredicate.parse(value);
|
|
1154
1181
|
} else {
|
|
1155
1182
|
numberPredicate.parse(value);
|
|
1156
1183
|
}
|
|
1157
|
-
this.choices.push({ name, value });
|
|
1184
|
+
this.choices.push({ name, name_localizations, value });
|
|
1158
1185
|
}
|
|
1159
1186
|
return this;
|
|
1160
1187
|
}
|
|
@@ -1367,7 +1394,9 @@ var SlashCommandSubcommandGroupBuilder = class {
|
|
|
1367
1394
|
return {
|
|
1368
1395
|
type: import_v1020.ApplicationCommandOptionType.SubcommandGroup,
|
|
1369
1396
|
name: this.name,
|
|
1397
|
+
name_localizations: this.name_localizations,
|
|
1370
1398
|
description: this.description,
|
|
1399
|
+
description_localizations: this.description_localizations,
|
|
1371
1400
|
options: this.options.map((option) => option.toJSON())
|
|
1372
1401
|
};
|
|
1373
1402
|
}
|
|
@@ -1387,7 +1416,9 @@ var SlashCommandSubcommandBuilder = class {
|
|
|
1387
1416
|
return {
|
|
1388
1417
|
type: import_v1020.ApplicationCommandOptionType.Subcommand,
|
|
1389
1418
|
name: this.name,
|
|
1419
|
+
name_localizations: this.name_localizations,
|
|
1390
1420
|
description: this.description,
|
|
1421
|
+
description_localizations: this.description_localizations,
|
|
1391
1422
|
options: this.options.map((option) => option.toJSON())
|
|
1392
1423
|
};
|
|
1393
1424
|
}
|
|
@@ -1405,22 +1436,32 @@ var SlashCommandBuilder = class {
|
|
|
1405
1436
|
__publicField(this, "description");
|
|
1406
1437
|
__publicField(this, "description_localizations");
|
|
1407
1438
|
__publicField(this, "options", []);
|
|
1408
|
-
__publicField(this, "
|
|
1439
|
+
__publicField(this, "default_permission");
|
|
1440
|
+
__publicField(this, "default_member_permissions");
|
|
1441
|
+
__publicField(this, "dm_permission");
|
|
1409
1442
|
}
|
|
1410
1443
|
toJSON() {
|
|
1411
1444
|
validateRequiredParameters3(this.name, this.description, this.options);
|
|
1445
|
+
validateLocalizationMap(this.name_localizations);
|
|
1446
|
+
validateLocalizationMap(this.description_localizations);
|
|
1412
1447
|
return {
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
description: this.description,
|
|
1416
|
-
description_localizations: this.description_localizations,
|
|
1417
|
-
options: this.options.map((option) => option.toJSON()),
|
|
1418
|
-
default_permission: this.defaultPermission
|
|
1448
|
+
...this,
|
|
1449
|
+
options: this.options.map((option) => option.toJSON())
|
|
1419
1450
|
};
|
|
1420
1451
|
}
|
|
1421
1452
|
setDefaultPermission(value) {
|
|
1422
1453
|
validateDefaultPermission(value);
|
|
1423
|
-
Reflect.set(this, "
|
|
1454
|
+
Reflect.set(this, "default_permission", value);
|
|
1455
|
+
return this;
|
|
1456
|
+
}
|
|
1457
|
+
setDefaultMemberPermissions(permissions) {
|
|
1458
|
+
const permissionValue = validateDefaultMemberPermissions(permissions);
|
|
1459
|
+
Reflect.set(this, "default_member_permissions", permissionValue);
|
|
1460
|
+
return this;
|
|
1461
|
+
}
|
|
1462
|
+
setDMPermission(enabled) {
|
|
1463
|
+
validateDMPermission(enabled);
|
|
1464
|
+
Reflect.set(this, "dm_permission", enabled);
|
|
1424
1465
|
return this;
|
|
1425
1466
|
}
|
|
1426
1467
|
addSubcommandGroup(input) {
|
|
@@ -1448,6 +1489,8 @@ SlashCommandBuilder = __decorateClass([
|
|
|
1448
1489
|
// src/interactions/contextMenuCommands/Assertions.ts
|
|
1449
1490
|
var Assertions_exports6 = {};
|
|
1450
1491
|
__export(Assertions_exports6, {
|
|
1492
|
+
validateDMPermission: () => validateDMPermission2,
|
|
1493
|
+
validateDefaultMemberPermissions: () => validateDefaultMemberPermissions2,
|
|
1451
1494
|
validateDefaultPermission: () => validateDefaultPermission2,
|
|
1452
1495
|
validateName: () => validateName2,
|
|
1453
1496
|
validateRequiredParameters: () => validateRequiredParameters4,
|
|
@@ -1455,7 +1498,7 @@ __export(Assertions_exports6, {
|
|
|
1455
1498
|
});
|
|
1456
1499
|
var import_shapeshift10 = require("@sapphire/shapeshift");
|
|
1457
1500
|
var import_v1021 = require("discord-api-types/v10");
|
|
1458
|
-
var namePredicate2 = import_shapeshift10.s.string.
|
|
1501
|
+
var namePredicate2 = import_shapeshift10.s.string.lengthGreaterThanOrEqual(1).lengthLessThanOrEqual(32).regex(/^( *[\p{L}\p{N}\p{sc=Devanagari}\p{sc=Thai}_-]+ *)+$/u);
|
|
1459
1502
|
var typePredicate = import_shapeshift10.s.union(import_shapeshift10.s.literal(import_v1021.ApplicationCommandType.User), import_shapeshift10.s.literal(import_v1021.ApplicationCommandType.Message));
|
|
1460
1503
|
var booleanPredicate3 = import_shapeshift10.s.boolean;
|
|
1461
1504
|
function validateDefaultPermission2(value) {
|
|
@@ -1475,13 +1518,26 @@ function validateRequiredParameters4(name, type) {
|
|
|
1475
1518
|
validateType(type);
|
|
1476
1519
|
}
|
|
1477
1520
|
__name(validateRequiredParameters4, "validateRequiredParameters");
|
|
1521
|
+
var dmPermissionPredicate2 = import_shapeshift10.s.boolean.nullish;
|
|
1522
|
+
function validateDMPermission2(value) {
|
|
1523
|
+
dmPermissionPredicate2.parse(value);
|
|
1524
|
+
}
|
|
1525
|
+
__name(validateDMPermission2, "validateDMPermission");
|
|
1526
|
+
var memberPermissionPredicate2 = import_shapeshift10.s.union(import_shapeshift10.s.bigint.transform((value) => value.toString()), import_shapeshift10.s.number.safeInt.transform((value) => value.toString()), import_shapeshift10.s.string.regex(/^\d+$/)).nullish;
|
|
1527
|
+
function validateDefaultMemberPermissions2(permissions) {
|
|
1528
|
+
return memberPermissionPredicate2.parse(permissions);
|
|
1529
|
+
}
|
|
1530
|
+
__name(validateDefaultMemberPermissions2, "validateDefaultMemberPermissions");
|
|
1478
1531
|
|
|
1479
1532
|
// src/interactions/contextMenuCommands/ContextMenuCommandBuilder.ts
|
|
1480
1533
|
var ContextMenuCommandBuilder = class {
|
|
1481
1534
|
constructor() {
|
|
1482
1535
|
__publicField(this, "name");
|
|
1536
|
+
__publicField(this, "name_localizations");
|
|
1483
1537
|
__publicField(this, "type");
|
|
1484
|
-
__publicField(this, "
|
|
1538
|
+
__publicField(this, "default_permission");
|
|
1539
|
+
__publicField(this, "default_member_permissions");
|
|
1540
|
+
__publicField(this, "dm_permission");
|
|
1485
1541
|
}
|
|
1486
1542
|
setName(name) {
|
|
1487
1543
|
validateName2(name);
|
|
@@ -1495,16 +1551,45 @@ var ContextMenuCommandBuilder = class {
|
|
|
1495
1551
|
}
|
|
1496
1552
|
setDefaultPermission(value) {
|
|
1497
1553
|
validateDefaultPermission2(value);
|
|
1498
|
-
Reflect.set(this, "
|
|
1554
|
+
Reflect.set(this, "default_permission", value);
|
|
1555
|
+
return this;
|
|
1556
|
+
}
|
|
1557
|
+
setDefaultMemberPermissions(permissions) {
|
|
1558
|
+
const permissionValue = validateDefaultMemberPermissions2(permissions);
|
|
1559
|
+
Reflect.set(this, "default_member_permissions", permissionValue);
|
|
1560
|
+
return this;
|
|
1561
|
+
}
|
|
1562
|
+
setDMPermission(enabled) {
|
|
1563
|
+
validateDMPermission2(enabled);
|
|
1564
|
+
Reflect.set(this, "dm_permission", enabled);
|
|
1565
|
+
return this;
|
|
1566
|
+
}
|
|
1567
|
+
setNameLocalization(locale, localizedName) {
|
|
1568
|
+
if (!this.name_localizations) {
|
|
1569
|
+
Reflect.set(this, "name_localizations", {});
|
|
1570
|
+
}
|
|
1571
|
+
const parsedLocale = validateLocale(locale);
|
|
1572
|
+
if (localizedName === null) {
|
|
1573
|
+
this.name_localizations[parsedLocale] = null;
|
|
1574
|
+
return this;
|
|
1575
|
+
}
|
|
1576
|
+
validateName2(localizedName);
|
|
1577
|
+
this.name_localizations[parsedLocale] = localizedName;
|
|
1578
|
+
return this;
|
|
1579
|
+
}
|
|
1580
|
+
setNameLocalizations(localizedNames) {
|
|
1581
|
+
if (localizedNames === null) {
|
|
1582
|
+
Reflect.set(this, "name_localizations", null);
|
|
1583
|
+
return this;
|
|
1584
|
+
}
|
|
1585
|
+
Reflect.set(this, "name_localizations", {});
|
|
1586
|
+
Object.entries(localizedNames).forEach((args) => this.setNameLocalization(...args));
|
|
1499
1587
|
return this;
|
|
1500
1588
|
}
|
|
1501
1589
|
toJSON() {
|
|
1502
1590
|
validateRequiredParameters4(this.name, this.type);
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
type: this.type,
|
|
1506
|
-
default_permission: this.defaultPermission
|
|
1507
|
-
};
|
|
1591
|
+
validateLocalizationMap(this.name_localizations);
|
|
1592
|
+
return { ...this };
|
|
1508
1593
|
}
|
|
1509
1594
|
};
|
|
1510
1595
|
__name(ContextMenuCommandBuilder, "ContextMenuCommandBuilder");
|