M
M
MrAfitol2021-04-14 16:37:04
JavaScript
MrAfitol, 2021-04-14 16:37:04

How to change one Embed to another Embed?

I want the bot to first send such an embed 6076eef918a86947732977.png
And then change the previous one to this one 6076ef3be6c9b734652537.png

So far, I just got it like this, but it does not replace

command(bot, 'scan', (message) => {
        const embed = new Discord.MessageEmbed()
          .setTitle('Scaning:')
          .setColor('#8B0000')
          .setDescription('**0% [⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣]    end in 0.30s **')


        message.channel.send(embed)

        const membed = new Discord.MessageEmbed()
           .setTitle('Scaning:')
           .setColor('#8B0000')
           .setDescription('**5% [⁣=>⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣ ⁣]    end in 0.30s **')


        message.channel.edit(membed)
    })
  });

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2021-04-14
@MrAfitol

you need to be able not only to write code, but also to understand what you write.
specifically about this line:
message.channel.edit(membed)
the .edit() method edits some channel data, for example: channel name, subject, permissions , etc.
moreover, in order to perform one of the above actions, you need to pass completely different parameters.
if you want to change the message sent by the bot, you must implement the following construct:

message.channel.send("сообщение").then(m => {
    // ...где m является классом Message
   m.edit("новый_контент_сообщения")
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question