How to convert code to js14?

Code is // Import required modules const { Client, Intents } = require('discord.js'); // Create a new client with necessary intents const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES] }); // Replace 'YOUR_BOT_TOKEN' with your actual bot token const BOT_TOKEN = 'MTEzNTE5NjU3NjM0ODkwOTYwOA.G-8KoH.bMI4RGNftDSQlD9J5J0aSW1eCOybnNiT4hvzkE'; // The ID of the channel where the bot will listen for messages const TARGET_CHANNEL_ID = '1135196103537606697'; // When the bot is ready and connected to Discord client.on('ready', () => { console.log(Logged in as ${client.user.tag}!); }); // Listen for messages client.on('messageCreate', (message) => { // Check if the message was sent in the target channel and not by the bot itself if (message.channel.id === TARGET_CHANNEL_ID && !message.author.bot) { // Create an embed message with the user's message content const embed = new MessageEmbed() .setColor('#ff0000') .setDescription(message.content) .addField('Radio', message.content) .setFooter('Wagner Group CampBase Radio'); // Send the embed message message.channel.send({ embeds: [embed] }); // Delete the user's original message message.delete().catch((err) => console.error('Error deleting message:', err)); } }); // Log in to Discord with your bot token client.login(BOT_TOKEN);
6 Replies
d.js toolkit
d.js toolkit11mo ago
- 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!
ifml
ifml11mo ago
by reading the docs Thonk
Mark
Mark11mo ago
please refer to the guide you've been linked to, read through it and ctrl + f as you encounter further changes
DemonDeparture
DemonDeparture11mo ago
discord.js@14.11.0 v18.16.1 ok
treble/luna
treble/luna11mo ago
also reset your token
!"Unkown
!"Unkown11mo ago
and dont use chat gpt