title: Chat bot command cooldown
body: <p>So I'm working on a Discord Bot that uses discord.js, a node.js wrapper for the Discord API. Basically the code works like this:</p>
  
  <pre><code>/*
    A ping pong bot, whenever you send "ping", it replies "pong".
  */
  
  // import the discord.js module
  const Discord = require('discord.js');
  
  // create an instance of a Discord Client, and call it bot
  const bot = new Discord.Client();
  
  // the token of your bot - https://discordapp.com/developers/applications/me
  const token = 'your bot token here';
  
  // create an event listener for messages
  bot.on('message', message =&gt; {
    // if the message is "ping",
    if (message.content === 'ping') {
      // send "pong" to the same channel.
      message.channel.sendMessage('pong');
    }
  });
  bot.login(token);
  </code></pre>
  
  <p>But my question is, how can I make it so that a user can only use the "ping" command with a cooldown of 3 seconds. To do this you would need the user ID, and that would be message.author.id if you were wondering. Thanks in advance.</p>