P粉0068477502023-08-04 11:26:05
If you are using discord.js v14, then you need to update the method of using embedded messages (Embeds) when replying to messages. Just change the code to the following:
client.on('guildCreate', guild => { const channel = guild.channels.cache.find(channel => channel.type === 'text' && channel.permissionsFor(guild.me).has('SEND_MESSAGES')); if (channel) { const exampleEmbed = new EmbedBuilder() .setColor(0xF99CF8) .setTitle('**B**') .setAuthor('S') .setThumbnail('https://i.imgur.com/N4') .setDescription('H') channel.send({ embeds: [exampleEmbed] }); }});
In addition, you need to modify the first line to:
const { Client, GatewayIntentBits, EmbedBuilder} = require('discord.js');
Just delete the third line to make your code clearer.
For more details, visit here: https://discordjs.guide/popular-topics/embeds.html#embed-preview