@discordjs/builders
Advanced tools
Comparing version 0.14.0-dev.1652400688-aed687b to 0.14.0-dev.1652443433-d522320
import * as _sapphire_shapeshift from '@sapphire/shapeshift'; | ||
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'; | ||
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'; | ||
import { URL } from 'url'; | ||
@@ -1151,6 +1151,16 @@ import { Snowflake } from 'discord-api-types/globals'; | ||
* | ||
* @default true | ||
* @deprecated This property is deprecated and will be removed in the future. | ||
* You should use `setDefaultMemberPermissions` or `setDMPermission` instead. | ||
*/ | ||
readonly defaultPermission: boolean | undefined; | ||
readonly default_permission: boolean | undefined; | ||
/** | ||
* Set of permissions represented as a bit set for the command | ||
*/ | ||
readonly default_member_permissions: Permissions | null | undefined; | ||
/** | ||
* Indicates whether the command is available in DMs with the application, only for globally-scoped commands. | ||
* By default, commands are visible. | ||
*/ | ||
readonly dm_permission: boolean | null | undefined; | ||
/** | ||
* Returns the final data that should be sent to Discord. | ||
@@ -1169,5 +1179,25 @@ * | ||
* @see https://discord.com/developers/docs/interactions/application-commands#permissions | ||
* @deprecated Use `setDefaultMemberPermissions` or `setDMPermission` instead. | ||
*/ | ||
setDefaultPermission(value: boolean): this; | ||
/** | ||
* Sets the default permissions a member should have in order to run the command. | ||
* | ||
* **Note:** You can set this to `'0'` to disable the command by default. | ||
* | ||
* @param permissions The permissions bit field to set | ||
* | ||
* @see https://discord.com/developers/docs/interactions/application-commands#permissions | ||
*/ | ||
setDefaultMemberPermissions(permissions: Permissions | null | undefined): this; | ||
/** | ||
* Sets if the command is available in DMs with the application, only for globally-scoped commands. | ||
* By default, commands are visible. | ||
* | ||
* @param enabled If the command should be enabled in DMs | ||
* | ||
* @see https://discord.com/developers/docs/interactions/application-commands#permissions | ||
*/ | ||
setDMPermission(enabled: boolean | null | undefined): this; | ||
/** | ||
* Adds a new subcommand group to this command | ||
@@ -1237,2 +1267,4 @@ * | ||
declare function validateLocalizationMap(value: unknown): asserts value is LocalizationMap; | ||
declare function validateDMPermission$1(value: unknown): asserts value is boolean | null | undefined; | ||
declare function validateDefaultMemberPermissions$1(permissions: unknown): string | null | undefined; | ||
@@ -1260,2 +1292,4 @@ declare const Assertions$1_validateDescription: typeof validateDescription; | ||
Assertions$1_validateLocalizationMap as validateLocalizationMap, | ||
validateDMPermission$1 as validateDMPermission, | ||
validateDefaultMemberPermissions$1 as validateDefaultMemberPermissions, | ||
}; | ||
@@ -1280,6 +1314,16 @@ } | ||
* | ||
* @default true | ||
* @deprecated This property is deprecated and will be removed in the future. | ||
* You should use `setDefaultMemberPermissions` or `setDMPermission` instead. | ||
*/ | ||
readonly defaultPermission: boolean | undefined; | ||
readonly default_permission: boolean | undefined; | ||
/** | ||
* Set of permissions represented as a bit set for the command | ||
*/ | ||
readonly default_member_permissions: Permissions$1 | null | undefined; | ||
/** | ||
* Indicates whether the command is available in DMs with the application, only for globally-scoped commands. | ||
* By default, commands are visible. | ||
*/ | ||
readonly dm_permission: boolean | null | undefined; | ||
/** | ||
* Sets the name | ||
@@ -1304,5 +1348,25 @@ * | ||
* @see https://discord.com/developers/docs/interactions/application-commands#permissions | ||
* @deprecated Use `setDefaultMemberPermissions` or `setDMPermission` instead. | ||
*/ | ||
setDefaultPermission(value: boolean): this; | ||
/** | ||
* Sets the default permissions a member should have in order to run the command. | ||
* | ||
* **Note:** You can set this to `'0'` to disable the command by default. | ||
* | ||
* @param permissions The permissions bit field to set | ||
* | ||
* @see https://discord.com/developers/docs/interactions/application-commands#permissions | ||
*/ | ||
setDefaultMemberPermissions(permissions: Permissions$1 | null | undefined): this; | ||
/** | ||
* Sets if the command is available in DMs with the application, only for globally-scoped commands. | ||
* By default, commands are visible. | ||
* | ||
* @param enabled If the command should be enabled in DMs | ||
* | ||
* @see https://discord.com/developers/docs/interactions/application-commands#permissions | ||
*/ | ||
setDMPermission(enabled: boolean | null | undefined): this; | ||
/** | ||
* Sets a name localization | ||
@@ -1333,2 +1397,4 @@ * | ||
declare function validateRequiredParameters(name: string, type: number): void; | ||
declare function validateDMPermission(value: unknown): asserts value is boolean | null | undefined; | ||
declare function validateDefaultMemberPermissions(permissions: unknown): string | null | undefined; | ||
@@ -1339,2 +1405,4 @@ declare const Assertions_validateDefaultPermission: typeof validateDefaultPermission; | ||
declare const Assertions_validateRequiredParameters: typeof validateRequiredParameters; | ||
declare const Assertions_validateDMPermission: typeof validateDMPermission; | ||
declare const Assertions_validateDefaultMemberPermissions: typeof validateDefaultMemberPermissions; | ||
declare namespace Assertions { | ||
@@ -1346,2 +1414,4 @@ export { | ||
Assertions_validateRequiredParameters as validateRequiredParameters, | ||
Assertions_validateDMPermission as validateDMPermission, | ||
Assertions_validateDefaultMemberPermissions as validateDefaultMemberPermissions, | ||
}; | ||
@@ -1348,0 +1418,0 @@ } |
@@ -881,2 +881,4 @@ "use strict"; | ||
validateChoicesLength: () => validateChoicesLength, | ||
validateDMPermission: () => validateDMPermission, | ||
validateDefaultMemberPermissions: () => validateDefaultMemberPermissions, | ||
validateDefaultPermission: () => validateDefaultPermission, | ||
@@ -956,2 +958,12 @@ validateDescription: () => validateDescription, | ||
__name(validateLocalizationMap, "validateLocalizationMap"); | ||
var dmPermissionPredicate = import_shapeshift5.s.boolean.nullish; | ||
function validateDMPermission(value) { | ||
dmPermissionPredicate.parse(value); | ||
} | ||
__name(validateDMPermission, "validateDMPermission"); | ||
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; | ||
function validateDefaultMemberPermissions(permissions) { | ||
return memberPermissionPredicate.parse(permissions); | ||
} | ||
__name(validateDefaultMemberPermissions, "validateDefaultMemberPermissions"); | ||
@@ -1429,3 +1441,5 @@ // src/interactions/slashCommands/SlashCommandBuilder.ts | ||
__publicField(this, "options", []); | ||
__publicField(this, "defaultPermission"); | ||
__publicField(this, "default_permission"); | ||
__publicField(this, "default_member_permissions"); | ||
__publicField(this, "dm_permission"); | ||
} | ||
@@ -1437,8 +1451,4 @@ toJSON() { | ||
return { | ||
name: this.name, | ||
name_localizations: this.name_localizations, | ||
description: this.description, | ||
description_localizations: this.description_localizations, | ||
options: this.options.map((option) => option.toJSON()), | ||
default_permission: this.defaultPermission | ||
...this, | ||
options: this.options.map((option) => option.toJSON()) | ||
}; | ||
@@ -1448,5 +1458,15 @@ } | ||
validateDefaultPermission(value); | ||
Reflect.set(this, "defaultPermission", value); | ||
Reflect.set(this, "default_permission", value); | ||
return this; | ||
} | ||
setDefaultMemberPermissions(permissions) { | ||
const permissionValue = validateDefaultMemberPermissions(permissions); | ||
Reflect.set(this, "default_member_permissions", permissionValue); | ||
return this; | ||
} | ||
setDMPermission(enabled) { | ||
validateDMPermission(enabled); | ||
Reflect.set(this, "dm_permission", enabled); | ||
return this; | ||
} | ||
addSubcommandGroup(input) { | ||
@@ -1477,2 +1497,4 @@ const { options } = this; | ||
__export(Assertions_exports6, { | ||
validateDMPermission: () => validateDMPermission2, | ||
validateDefaultMemberPermissions: () => validateDefaultMemberPermissions2, | ||
validateDefaultPermission: () => validateDefaultPermission2, | ||
@@ -1505,2 +1527,12 @@ validateName: () => validateName2, | ||
__name(validateRequiredParameters4, "validateRequiredParameters"); | ||
var dmPermissionPredicate2 = import_shapeshift10.s.boolean.nullish; | ||
function validateDMPermission2(value) { | ||
dmPermissionPredicate2.parse(value); | ||
} | ||
__name(validateDMPermission2, "validateDMPermission"); | ||
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; | ||
function validateDefaultMemberPermissions2(permissions) { | ||
return memberPermissionPredicate2.parse(permissions); | ||
} | ||
__name(validateDefaultMemberPermissions2, "validateDefaultMemberPermissions"); | ||
@@ -1513,3 +1545,5 @@ // src/interactions/contextMenuCommands/ContextMenuCommandBuilder.ts | ||
__publicField(this, "type"); | ||
__publicField(this, "defaultPermission"); | ||
__publicField(this, "default_permission"); | ||
__publicField(this, "default_member_permissions"); | ||
__publicField(this, "dm_permission"); | ||
} | ||
@@ -1528,5 +1562,15 @@ setName(name) { | ||
validateDefaultPermission2(value); | ||
Reflect.set(this, "defaultPermission", value); | ||
Reflect.set(this, "default_permission", value); | ||
return this; | ||
} | ||
setDefaultMemberPermissions(permissions) { | ||
const permissionValue = validateDefaultMemberPermissions2(permissions); | ||
Reflect.set(this, "default_member_permissions", permissionValue); | ||
return this; | ||
} | ||
setDMPermission(enabled) { | ||
validateDMPermission2(enabled); | ||
Reflect.set(this, "dm_permission", enabled); | ||
return this; | ||
} | ||
setNameLocalization(locale, localizedName) { | ||
@@ -1557,8 +1601,3 @@ if (!this.name_localizations) { | ||
validateLocalizationMap(this.name_localizations); | ||
return { | ||
name: this.name, | ||
name_localizations: this.name_localizations, | ||
type: this.type, | ||
default_permission: this.defaultPermission | ||
}; | ||
return { ...this }; | ||
} | ||
@@ -1565,0 +1604,0 @@ }; |
{ | ||
"name": "@discordjs/builders", | ||
"version": "0.14.0-dev.1652400688-aed687b", | ||
"version": "0.14.0-dev.1652443433-d522320", | ||
"description": "A set of builders that you can use when creating your bot", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
452153
4557