Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const discord = require("discord.js");
- const botConfig = require("./botconfig.json");
- const fs = require("fs");
- const bot = new discord.Client();
- bot.commands = new discord.Collection();
- fs.readdir("./commands", (err, files) => {
- if(err) console.log(err);
- var jsFiles = files.filter(f => f.split(".").pop() === "js");
- if(jsFiles.length <= 0) {
- console.log("kon geen files vinden!");
- return;
- }
- jsFiles.forEach((f,i) => {
- var fileGet = require(`./commands/${f}`);
- console.log(`De file ${f} is geladen`)
- bot.commands.set(fileGet.help.name, fileGet);
- })
- });
- bot.on("ready", async () => {
- console.log(`${bot.user.username} is online!`);
- let statuses = [
- "play.cloudnetwerk.eu",
- ".help"
- ]
- setInterval(function () {
- let status = statuses[Math.floor(Math.random() * statuses.length)];
- bot.user.setActivity(status, { type: "WATCHING" });
- }, 10000)
- global.staffRole = "Support";
- });
- bot.on("message", async message => {
- // Als bot bericht stuurt stuur dan return.
- if (message.author.bot) return;
- if (message.channel.type === "dm") return;
- var prefix = botConfig.prefix;
- var messageArray = message.content.split(" ");
- var command = messageArray[0];
- var arguments = messageArray.slice(1);
- var commands = bot.command.(command.slice(prefix.length));
- if(commands) commands.run(bot, message, arguments)
- if( command === `${prefix}ip`){
- return message.channel.send("play.cloudnetwerk.eu");
- }
- });
- bot.login(botConfig.token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement