discord.js say command code example
Example 1: Bot say command discord.js
client.on('message', message => {
if (message.content.startsWith(prefix + 'say')) {
if (message.author.bot) return;
const SayMessage = message.content.slice(6).trim();
message.channel.send(SayMessage)
message.channel.send("Text By " + ` **${message.author}**`)
}
});
Example 2: discord say command
client.on('message', message => {
if (message.content.startsWith(prefix + 'say')) {
if (message.author.bot) return;
const SayMessage = message.content.slice(4).trim();
message.channel.send("**" + SayMessage + "**")
message.channel.send("- " + `**${message.author}**`)
}
});
Example 3: 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 4: 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}`)