I’m beginner in js and I’m trying to make my music bot delete embeds made by embedbuilder function. Example: I’m using play command and bot has to send 2 embeds first one saying it’s searching and then second showing results. It deletes my command and then…crash
throw new DiscordAPIError(data, res.status, request);
DiscordAPIError: Unknown Message
I’m new to Dc js v13 btw
Here’s embed builder function code
function embedbuilder(client, message, color, title, description, thumbnail) {
try{ let embed = new Discord.MessageEmbed()
.setColor(color)
.setFooter(client.user.username, client.user.displayAvatarURL());
if (title) embed.setTitle(title);
if (description) embed.setDescription(description);
if (thumbnail) embed.setThumbnail(thumbnail)
return message.channel.send({ embeds: }).then(setTimeout(() => message.delete(), 5000));
}catch (error){
console.error(embed)
}
}
This code is result of me trying to find solution.Now “play” command code
else if (command === "play" || command === "p") {
embedbuilder(client, message, "#fffff0", "Searching!", args.join(" ")).catch(console.error)
return distube.play(message, args.join(" "));
And code making bot show results
.on("searchResult", (message, result) => {
try{ let i = 0;
return embedbuilder(client, message, "#fffff0", "", `**Choose**n${result.map(song => `**${++i}**. [${song.name}](${song.url}) - `${song.formattedDuration}``).join("n")}n*I will wait*`).catch(console.error)
}catch (error){
console.error
}
})
I wonder if making separate timeouts would be better, but I already tried to and I gave up.
discord.js: 13.3.1 (v12 before for long time, new to v13)
distube: 3.0.4
By the way how do i fix that?
if (message.content.includes(client.user.id)) {
return message.reply(new Discord.MessageEmbed().setColor("#fffff0").setAuthor(`${message.author.username}, My prefix is ${prefix}, please type ${prefix}help to see my commands`, message.author.displayAvatarURL({ dynamic: true })));
}
When i try to ping my bot it says
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Cannot send an empty message