I tried make the bot delete the trigger command after sending an embed but when i run the command it deletes both trigger and embed
My code:
bot.on('message', message=>{
let args = message.content.substring(prefix.length).split(" ");
switch(args[0]){
case 'bronze':
if (message.content.toLowerCase().includes("!bronze")) {
message.delete();
}
const embed = new Discord.MessageEmbed()
.setColor('#cc6633')
.setTitle('title')
.setDescription('text')
.setThumbnail('my thumbnail')
.addFields(
{ name: '\u200B', value: '\u200B' },
{ name: 'text', value: 'text' },
{ name: 'text', value: 'text', inline: true },
{ name: 'text', value: 'text', inline: true },
)
.addField('text', '<@&720343920873046105>')
.addField('\u200B', '\u200B')
.setTimestamp()
.setFooter(`footer`, 'my photo');
}
})
This has a very easy fix:
message.delete();
message.channel.send(embed):
You can also add a delay (in milliseconds) as a parameter for the message.delete()
method.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.