1 // First, this must be at the top level of your code, **NOT** in any event!
2 const talkedRecently = new Set();
3
4 if (talkedRecently.has(msg.author.id)) {
5 msg.channel.send("Wait 1 minute before getting typing this again. - " + msg.author);
6 } else {
7
8 // the user can type the command ... your command code goes here :)
9
10 // Adds the user to the set so that they can't talk for a minute
11 talkedRecently.add(msg.author.id);
12 setTimeout(() => {
13 // Removes the user from the set after a minute
14 talkedRecently.delete(msg.author.id);
15 }, 60000);
16 }