Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

java script discord timer

const helloSet = new Set();

bot.on('message', msg => {
  let args = msg.content.substring(prefix.length).split(" ");
  if(args[0] === 'hello'){
    if(helloSet.has(msg.author.id)){
      msg.channel.send(`Please wait 10 seconds before using this command again.`)
      setTimeout(() => {
        helloSet.delete(msg.author.id)
      }, 10000)
    } else {
      msg.channel.send(`Hello!`)
      helloSet.add(msg.author.id)
    }
  }
})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #java #script #discord #timer
ADD COMMENT
Topic
Name
5+4 =