simple bot codde discord.js 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: Bots latency discord js
var yourping = new Date().getTime() - message.createdTimestamp
var botping = Math.round(bot.ws.ping)
message.channel.send(`Your ping: ${yourping} \nBots ping: ${botping}`)