Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

discord.js cooldown

// Add this at the top of your JS file:
// First, this must be at the top level of your code, **NOT** in any event!
const talkedRecently = new Set();


//Now in the command event add this:
    if (talkedRecently.has(userid)) {
       console.log("Wait 1 minute before getting typing this again. - " + userid);
    } else {
      
      console.log('Hello! How are you?')
      
        talkedRecently.add(userid);
        setTimeout(() => {
          // Removes the user from the set after a minute
          talkedRecently.delete(userid);
        }, 60000);
    }
 
PREVIOUS NEXT
Tagged: #cooldown
ADD COMMENT
Topic
Name
8+2 =