Mark
0
Q:

discord js ping command

message.channel.send("Getting bot ping...").then(m =>{
    var ping = m.createdTimestamp - message.createdTimestamp;
    var trueping = Math.round(bot.pi);

    m.edit(`Bot latency: ${botPing}`);
});
-3
// If the command sent in the chat is "ping"
if(cmd === `${prefix}ping `) {
  
  // It sends the user "Pinging"
        message.channel.send("Pinging...").then(m =>{
          // The math thingy to calculate the user's ping
            var ping = m.createdTimestamp - message.createdTimestamp;

          // Basic embed
            var embed = new Discord.MessageEmbed()
            .setAuthor(`Your ping is ${ping}`)
            .setColor("Your Color")
            
            // Then It Edits the message with the ping variable embed that you created
            m.edit(embed)
        });
    }
0
if(cmd === `${prefix}ping`) {
        message.channel.send("Pinging...").then(m =>{
            var ping = m.createdTimestamp - message.createdTimestamp;
            var botPing = Math.round(bot.pi);

            m.edit(`**:ping_pong: Pong! Your Ping Is:-**\n  ${ping}ms`);
        });
    }
0

New to Communities?

Join the community