OGHUB
OGHUB
DIAdiscord.js - Imagine an app
Created by OGHUB on 9/12/2024 in #djs-questions
Premium Button didn't work
Hi, there, First of all, I haven't found any documentation on how the Premium button works. Secondly, I have a problem (Expected the value to be a string or number) for the “Premium” button type. My code:
await interaction.reply({
embeds: [
new EmbedBuilder()
.setColor("DarkRed")
.setTimestamp()
.setAuthor({
name:
interaction.user.globalName ??
interaction.user.username ??
"Unknown User",
iconURL: interaction.user.displayAvatarURL() ?? "",
})
.setThumbnail(client.user.displayAvatarURL())
.setDescription("You do not have a Premium subscription to OGHub."),
],
components: [
new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setStyle(ButtonStyle.Premium)
.setSKUId("1270342893235605524"),
new ButtonBuilder()
.setLabel("Sign-up")
.setStyle(ButtonStyle.Link)
.setURL("https://...")
),
],
});
await interaction.reply({
embeds: [
new EmbedBuilder()
.setColor("DarkRed")
.setTimestamp()
.setAuthor({
name:
interaction.user.globalName ??
interaction.user.username ??
"Unknown User",
iconURL: interaction.user.displayAvatarURL() ?? "",
})
.setThumbnail(client.user.displayAvatarURL())
.setDescription("You do not have a Premium subscription to OGHub."),
],
components: [
new ActionRowBuilder().addComponents(
new ButtonBuilder()
.setStyle(ButtonStyle.Premium)
.setSKUId("1270342893235605524"),
new ButtonBuilder()
.setLabel("Sign-up")
.setStyle(ButtonStyle.Link)
.setURL("https://...")
),
],
});
Full error:
ValidationError > s.nativeEnum(T)
Expected the value to be a string or number

Received:
| undefined

at _NativeEnumValidator.handle (node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:2634:25)
at _NativeEnumValidator.parse (node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:939:90)
at ButtonBuilder.setStyle (node_modules/@discordjs/builders/dist/index.js:636:44)
at checkPremium (src/structures/commandOptions/checkPremium.js:66:14)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.run (src/interactions/slashCommands/premium.js:33:30)
ValidationError > s.nativeEnum(T)
Expected the value to be a string or number

Received:
| undefined

at _NativeEnumValidator.handle (node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:2634:25)
at _NativeEnumValidator.parse (node_modules/@sapphire/shapeshift/dist/cjs/index.cjs:939:90)
at ButtonBuilder.setStyle (node_modules/@discordjs/builders/dist/index.js:636:44)
at checkPremium (src/structures/commandOptions/checkPremium.js:66:14)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.run (src/interactions/slashCommands/premium.js:33:30)
Version : Latest (v14.16.x)
7 replies
DIAdiscord.js - Imagine an app
Created by OGHUB on 8/6/2024 in #djs-questions
Premium
Code:
await message.channel.send({
embeds: [
new EmbedBuilder()
.setColor("DarkRed")
.setTimestamp()
.setAuthor({
name:
message.member?.user?.globalName ??
message.member?.user?.username ??
"Unknown User",
iconURL: message.member?.user?.displayAvatarURL() ?? "",
})
.setThumbnail(client.user.displayAvatarURL())
.setDescription("You do not have a Premium subscription to OGHub."),
],
components: [
{
type: 1,
components: [
{
type: 2,
style: 6,
sku_id: 1270342893235605524,
},
{
type: 2,
label: "Sign-up ...",
style: 5,
url: "https://.../en/auth/sign-up",
},
],
},
],
});
await message.channel.send({
embeds: [
new EmbedBuilder()
.setColor("DarkRed")
.setTimestamp()
.setAuthor({
name:
message.member?.user?.globalName ??
message.member?.user?.username ??
"Unknown User",
iconURL: message.member?.user?.displayAvatarURL() ?? "",
})
.setThumbnail(client.user.displayAvatarURL())
.setDescription("You do not have a Premium subscription to OGHub."),
],
components: [
{
type: 1,
components: [
{
type: 2,
style: 6,
sku_id: 1270342893235605524,
},
{
type: 2,
label: "Sign-up ...",
style: 5,
url: "https://.../en/auth/sign-up",
},
],
},
],
});
Error Code: RangeError: Buttons must have a label and/or an emoji at validateRequiredButtonParameters .
16 replies