Reputation: 204
I'm trying to send an embed message that I wrote before the embed was sent. Unfortunately this doesn't work. The message that I type is getting deleted but the embed is not sent and I get an error code.
Thats my Script:
case 'a':
case 'A':
let part = message.content.split(" ");
if(!message.member.permissions.has(Discord.Permissions.FLAGS.MANAGE_ROLES)) return;
if(!part[1]) return;
var text = message.content.split(" ").slice(1).join(" ");
message.delete();
const aembed = new Discord.MessageEmbed()
.setColor('RED')
.setThumbnail('png')
.addField('Our newest announcement: ', text, true)
.setTimestamp()
.setFooter('This is an announcement' + 'from' + message.member.displayName + '!')
message.channel.send({embed: aembed})
My error code is:
C:\User\Bot v13\node_modules\discord.js\src\rest\RequestHandler.js:298
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Cannot send an empty message
at RequestHandler.execute (C:\Alle Discord Bots\Bot v13\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (C:\Alle Discord Bots\Bot v13\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
at async TextChannel.send (C:\Alle Discord Bots\Bot v13\node_modules\discord.js\src\structures\interfaces\TextBasedChannel.js:172:15) {
method: 'post',
path: '/channels/897416583549427743/messages',
code: 50006,
httpStatus: 400,
requestData: {
Upvotes: 2
Views: 1466
Reputation: 9041
Discord.js v13 no longer uses the embed
property. Use the embeds
property instead (it’s an array!)
message.channel.send({embeds: [aembed]})
Upvotes: 3