discord.js ping bot for info code example
Example 1: discord js ping command
if(cmd === `${prefix}ping `) {
message.channel.send("Pinging...").then(m =>{
var ping = m.createdTimestamp - message.createdTimestamp;
var embed = new Discord.MessageEmbed()
.setAuthor(`Your ping is ${ping}`)
.setColor("Your Color")
m.edit(embed)
});
}
Example 2: how to make a ping in discord.js
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`);
});
}