Advertisement
Guest User

AFK Command Code

a guest
Oct 18th, 2019
504
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. bot.afk = new Map();
  2.  
  3. bot.on("message", async message => {
  4. if (message.author.bot) return;
  5.  
  6. if (message.channel.type === "dm") {
  7. message.author.send("coming soon ;)");
  8. }
  9.  
  10. if (!message.content.startsWith(prefix)) return;
  11. let messageArray = message.content.split(" ");
  12. let cmd = messageArray[0];
  13. let args = messageArray.slice(1);
  14. let commandfile = bot.commands.get(cmd.slice(prefix.length));
  15. if (commandfile) commandfile.run(bot, message, args);
  16.  
  17. if (message.content.includes(message.mentions.users.first())) {
  18. let mentioned = bot.afk.get(message.mentions.users.first().id);
  19. if (mentioned)
  20. message.channel.send(
  21. `**${mentioned.usertag} is currently afk. Reason: ${mentioned.reason}**`
  22. );
  23. }
  24.  
  25. let afkcheck = bot.afk.get(message.author.id);
  26. if (afkcheck)
  27. return [
  28. bot.afk.delete(message.author.id),
  29. message.reply(`I have removed you afk`).then(msg => msg.delete(10000))
  30. ];
  31. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement