Advertisement
Guest User

Untitled

a guest
Jan 27th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. const discord = require("discord.js");
  2. const botConfig = require("./botconfig.json");
  3.  
  4. const fs = require("fs");
  5.  
  6. const bot = new discord.Client();
  7. bot.commands = new discord.Collection();
  8.  
  9. fs.readdir("./commands", (err, files) => {
  10.  
  11. if(err) console.log(err);
  12.  
  13. var jsFiles = files.filter(f => f.split(".").pop() === "js");
  14.  
  15. if(jsFiles.length <= 0) {
  16. console.log("kon geen files vinden!");
  17. return;
  18.  
  19. }
  20.  
  21. jsFiles.forEach((f,i) => {
  22.  
  23. var fileGet = require(`./commands/${f}`);
  24. console.log(`De file ${f} is geladen`)
  25.  
  26. bot.commands.set(fileGet.help.name, fileGet);
  27.  
  28.  
  29. })
  30.  
  31. });
  32.  
  33.  
  34. bot.on("ready", async () => {
  35.  
  36. console.log(`${bot.user.username} is online!`);
  37.  
  38. let statuses = [
  39.  
  40. "play.cloudnetwerk.eu",
  41. ".help"
  42.  
  43. ]
  44.  
  45. setInterval(function () {
  46.  
  47. let status = statuses[Math.floor(Math.random() * statuses.length)];
  48. bot.user.setActivity(status, { type: "WATCHING" });
  49.  
  50. }, 10000)
  51.  
  52. global.staffRole = "Support";
  53.  
  54. });
  55.  
  56. bot.on("message", async message => {
  57.  
  58. // Als bot bericht stuurt stuur dan return.
  59. if (message.author.bot) return;
  60.  
  61. if (message.channel.type === "dm") return;
  62.  
  63. var prefix = botConfig.prefix;
  64.  
  65. var messageArray = message.content.split(" ");
  66.  
  67. var command = messageArray[0];
  68.  
  69. var arguments = messageArray.slice(1);
  70.  
  71.  
  72.  
  73. var commands = bot.command.(command.slice(prefix.length));
  74.  
  75. if(commands) commands.run(bot, message, arguments)
  76.  
  77. if( command === `${prefix}ip`){
  78.  
  79. return message.channel.send("play.cloudnetwerk.eu");
  80.  
  81. }
  82.  
  83. });
  84.  
  85.  
  86. bot.login(botConfig.token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement