Nico105
Nico105

Reputation: 188

Send is not defined, embed message problem (edit)

`module.exports = {
    name: 'lat2',
    description: 'Let the Bot display latency/Response Time and API latency',
    execute(message, args) {
        const Embed1 = {
            color: "RANDOM",
            description: 'Pinging...',
        };

        const Embed2 = {
            color: "RANDOM",
            title: 'Latencies',
            description: `Latency/Response Time: ${send.createdTimestamp - message.createdTimestamp}ms\nAPI latency/"Remote Response time": ${Math.round(message.client.ws.ping)}ms`,
        };

        message.channel.send({ embed: Embed1 }).then(send => {
            send.edit({ embed: Embed2 });
        })
    }
};`

so can i do the whole thing embed or not? because... send is not defined the thing works fine in the non embed version.

Upvotes: 0

Views: 113

Answers (1)

user13247772
user13247772

Reputation:

Discord embed messages are constructed differently. send() isn't an object, it's a function, you have to use msg.edit. You should make the color yourself.

`module.exports = {
  name: 'lat2',
  description: 'Let the Bot display latency/Response Time and API latency',
  execute(message, args) {
    let Embed1 = new Discord.MessageEmbed()
      .setColor("#"+String(Math.floor(Math.random()*16777215).toString(16)))
      .setDescription("Pinging...")

    let Embed2 = new Discord.MessageEmbed()
      .setColor("#"+String(Math.floor(Math.random()*16777215).toString(16)))
      .setTitle("Latencies")
      .setDescription(`Latency/Response Time: ${send.createdTimestamp - message.createdTimestamp}ms\nAPI latency/"Remote Response time": ${Math.round(message.client.ws.ping)}ms`)

    msg.channel.send(Embed1).then(msg => {
      msg.edit(Embed2);
    });
  }
};`

Upvotes: 1

Related Questions