I'm creating a bot that I want to respond with rich embeds. Since I have over three dozen different args for this one command, I thought I could keep the code clean by moving the embed for each arg to a different .js file, then use the 'require' variable to call the file when the appropriate arg is used. Simple, right? However, whenever I run the file, the embed isn't rendered correctly.
I've tried removing those first couple lines because I thought that was specifying that it should be sent as a message instead of an embed, bu that just led to error messages (like "message is not defined" or "cannot send empty message")
Here's the code I'm using in the main command file, which works when I call a variable that's in the same file:
else if (args[0] === 'butterfly') {
return message.channel.send(require('./butterfly.js'))
}
And here's the code in the second file that I'm pretty sure has the issue:
module.exports = (message) => {
message.channel.send({embed: {
color: 16615352,
author: {
name: "TEST",
url: "https://url.here",
icon_url: "https://url.here"
},
description: "test",
thumbnail: {
url: "https://url.here"
},
fields: [{
name: "Test",
value: "Test",
inline: true
},
{
name: "Test2",
value: "Test2",
inline: true
}
],
}
});
}
Currently, I can get the text to send, but it doesn't render as an embed and I just get the code text starting at "(message)". What do I use to specify that the code should be rendered as an embed?