Discord.js Inbedded buttons not wokring
"TypeError: Cannot read properties of undefined (reading 'PRIMARY')
at Object.execute (/Users/lex/TheHierarchysBot/Bot/commands/message/ticketinfo.js:20:42)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Client.<anonymous> (/Users/lex/TheHierarchysBot/Bot/index.js:101:9)
"
With this code "const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyles } = require('discord.js');
module.exports = {
name: 'ticketinfo',
description: 'Displays information about The Hierarchy Tickets.',
async execute(interaction) {
const roleID = '1156687225300467774';
const member = await interaction.guild.members.fetch(interaction.user.id);
if (!member || !member.roles.cache.some(role => role.id === roleID)) {
return await interaction.reply({ content: 'You do not have permission to use this command.', ephemeral: true });
}
// Create the button
const button = new ButtonBuilder()
.setCustomId('create-ticket');
// Set the style of the button
if (member.roles.cache.some(role => role.id === roleID)) {
button.setStyle(ButtonStyles.PRIMARY);
} else {
button.setStyle(ButtonStyles.SECONDARY);
}
// Create the action row
const row = new ActionRowBuilder()
.addComponents(button);
// Create the embed
const embed = new EmbedBuilder()
.setColor('#00FF00') // Sets the color to green
.addFields(
{ name: 'Contact', value:
To open a ticket, <@1156691598550249583>!
, inline: false }
)
.setFooter({ text: 'If you need additional support/tickets are not working, Dm the owner' });
// Send the reply
await interaction.reply({ embeds: [embed], components: [row] });
},
};
"
discord.js 14.13.0
newest node2 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!well damn im dumb š
"ValidationError > s.nativeEnum(T)
Expected the value to be a string or number
Received:
| undefined
at NativeEnumValidator.handle (/Users/lex/TheHierarchysBot/Bot/node_modules/@sapphire/shapeshift/dist/index.js:1871:25)
at NativeEnumValidator.parse (/Users/lex/TheHierarchysBot/Bot/node_modules/@sapphire/shapeshift/dist/index.js:212:88)
at ButtonBuilder.setStyle (/Users/lex/TheHierarchysBot/Bot/node_modules/@discordjs/builders/dist/index.js:636:44)
at Object.execute (/Users/lex/TheHierarchysBot/Bot/commands/message/ticketinfo.js:20:20)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Client.<anonymous> (/Users/lex/TheHierarchysBot/Bot/index.js:101:9)
"
idek what this is goin on abt
š
Idk i did some changes that u said `