Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. var Discord = require("discord.js");
  2.  
  3. var client = new Discord.Client();
  4. var afk = false;
  5. var timeOut;
  6.  
  7. // todo: check if someone talks and reset timer
  8.  
  9. function timer() {
  10. timeOut = setTimeout(AFK, 300000);
  11. }
  12.  
  13. if(timeOut === "1")
  14. {
  15. clearTimeout();
  16. timer();
  17. }
  18.  
  19.  
  20. function AFK() {
  21.  
  22. client.on("message", function(message)
  23. {
  24. var input = message.content.toUpperCase();
  25.  
  26. if(timeOut === "1")
  27. {
  28. clearTimeout();
  29. // todo: things to do to the afk below here
  30. }
  31. });
  32. }
  33.  
  34.  
  35.  
  36. client.login("key");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement