Lex
Lex
DIAdiscord.js - Imagine an app
Created by Lex on 9/30/2023 in #djs-questions
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 node
7 replies
DIAdiscord.js - Imagine an app
Created by Lex on 9/29/2023 in #djs-questions
Direct Messages Not Receiving
My discord bot does not see or recieve direct messages, I have partials on and all the intents logging and error checking but i still get nothing const client = new Client({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions, GatewayIntentBits.GuildMembers, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMessageTyping, GatewayIntentBits.DirectMessages, GatewayIntentBits.DirectMessageReactions, GatewayIntentBits.DirectMessageTyping ], partials: [Partials.Message, Partials.Channel, Partials.Reaction], });
6 replies