I am having issues with sending discord embeds. This is my code:
module.exports = {
name: 'tiktok',
description: "sends tiktok link",
execute(message, args, Discord) {
const newEmbed = new Discord.MessageEmbed()
.setColor('#228B22')
.setTitle('Tiktok')
.setURL('https://www.tiktok.com/@elcattuccino?lang=en')
.setDescription('tiktok link for the discord server')
.addFields(
{name: 'Tiktok', value:'heres the tiktok link'},
)
.setImage('https://cdn.discordapp.com/avatars/752212130870329384/6a16609eafc28f95ad8f64e80ffcc24e.png?size=80')
.setFooter('check out the tiktok');
message.channel.send(newEmbed);
}
}
But I get this error:
throw new DiscordAPIError(data, res.status, request); ^
DiscordAPIError: Cannot send an empty message at RequestHandler.execute (C:\Users\willm\OneDrive\Desktop\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:349:13) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async RequestHandler.push (C:\Users\willm\OneDrive\Desktop\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:50:14) at async TextChannel.send (C:\Users\willm\OneDrive\Desktop\Discord Bot\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:172:15) { method: 'post', path: '/channels/910099863180550144/messages',
code: 50006, httpStatus: 400, requestData: { json: { content: undefined, tts: false, nonce: undefined, embeds: undefined, components: undefined, username: undefined, avatar_url: undefined, allowed_mentions: undefined, flags: undefined, message_reference: undefined, attachments: undefined, sticker_ids: undefined }, files: [] } }
Use message.channel.send({ embeds: [newEmbed] });
Also field has changed
.addField('LINK', '[LINK](TIKTOK LINK)', true)
like this