I'm getting
DiscordAPIError: Cannot send an empty message at RequestHandler.execute
├── discord.js@12.5.3
├── dotenv@10.0.0
├── mssql@7.3.0
└── nodemon@2.0.15
Basically it send message on server channel, but after sending message it throw the error
const exampleEmbed = new MessageEmbed()
.setColor('#0099ff')
.setTitle(result1.recordset[0].Title)
.setURL('https://www.ebay.com/itm/' result1.recordset[0].ebay_id)
.setAuthor(_state, _img, 'https://discord.js.org')
.setDescription(output)
.setThumbnail(result1.recordset[0].IMG)
.addFields(
{ name: 'Price [Ebay]', value: result1.recordset[0].Price, inline: true },
{ name: 'Price [Poshmark]', value: result1.recordset[0].POSHMARK_PRICE, inline: true },
{ name: 'Price [Mercari]', value: result1.recordset[0].Mercari_price, inline: true }
)
.setTimestamp()
.setFooter('Bot by programerAnel', 'https://i.imgur.com/wSTFkRM.png');
msg.reply(exampleEmbed)
All 100 lines of code on git: link
CodePudding user response:
Looking at your entire code, it seems that line 40 was the real problem. Whenever you are sending something, never do a variable on its own. It could be nullish. Make sure to add a label so you don't encounter this error, and it will be easy to debug
msg.reply("relatedLabel: " result1.recordset[0].id)