I started making discord bot with Eris library in JS. I want to send an embed message after using command and save the newly-created message's ID to a variable. The emb
object is a global variable with embed struct. Here's the code:
if(interaction.data.name == 'createmsg'){
value1 = interaction.channel.id;
value2 = interaction.data.options[0].value;
interaction.createMessage({embed: emb}).then((val) => console.log(val));
}
The problem is the variable val
is undefined so I can't get the message ID.
Other thing that I've tried is:
var msg = await interaction.createMessage({embed: emb});
console.log(msg);
but it also prints undefined
(or Promise <Pending>
if I remove the await
keyword). I can see bot's message on discord's channel after using command.
I was able to get the message's ID, when I used the Client's function createMessage
but the discord's chat was saying something like "The bot is thinking..." above my embed message. Is there any other approach to this or at least some workaround?