"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>!
To open a ticket, <@1156691598550249583>!
, inline: false } ) .setFooter({ text: 'If you need additional support/tickets are not working, Dm the owner' });