discord.js reply to message

JavaScript
//this is an event listener
client.on('message', message => {
  // If message is ping
  if (message.content === 'ping') {
    // Send pong back
    message.channel.send('pong');
  }
});

Source

Also in JavaScript: