简体   繁体   中英

Can I use one command to send multiple embed? Discord.js

I want to ask if it's possible to build a bot in Node.js (using Discord.js) with Visual Studio Code that if I send a single command, will reply with different embed messages.

It didn't work with command handler.

It can be done, try using this:

const embed1 = new Discord.MessageEmbed()
    .setColor('0xf7f7f8')
    .setTitle('Embed 1')
    .setDescription("First Embed")
    .addField("First Embed Field", "Text")
    
const embed2 = new Discord.MessageEmbed()
    .setColor('0xf7f7f8')
    .setTitle('Embed 2')
    .setDescription("Second Embed")
    .addField("Second Embed Field", "Text")

message.channel.send({embed: embed1})
message.channel.send({embed: embed2})

There are probably better ways to go ahead and do this but this works perfectly!

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM