code:
module.exports = {
minArgs: 2,
expectedArgs: '<Channel mention> <JSON>',
callback: ({ message, args }) => {
const targetChannel = message.mentions.channels.first()
if (!targetChannel) {
message.reply('Specify a channel to sent the embed in')
return
}
args.shift()
try {
const json = JSON.parse(args.join(' '))
const { text = '' } = json
targetChannel.send(text, {
embed: json,
})
} catch (error) {
message.reply('Invalid JSON')
}
},
}
error: RangeError [MESSAGE_CONTENT_TYPE]: Message content must be a non-empty string. The bot should send an embed at the command !embed @tag JSON, but when I send json, I get an error. My json: { "title": "Embed", "description": "Test", "color": "0x00ff00" }
CodePudding user response:
If you are using V13 here is the way to send an embed
send({ content: 'Text', embeds: [embed] });