daily pastebin goal
65%
SHARE
TWEET

Untitled

a guest Dec 16th, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require("discord.js");
  2. const Enmap = require("enmap");
  3. const fs = require("fs");
  4. const client = new Discord.Client();
  5. const config = require("./config.json");
  6. client.config = config;
  7. fs.readdir("./events/", (err, files) => {
  8.   if (err) return console.error(err);
  9.   files.forEach(file => {
  10.     const event = require(`./events/${file}`);
  11.     let eventName = file.split(".")[0];
  12.     client.on(eventName, event.bind(null, client));
  13.   });
  14. });
  15. client.commands = new Enmap();
  16. fs.readdir("./commands/", (err, files) => {
  17.   if (err) return console.error(err);
  18.   files.forEach(file => {
  19.     if (!file.endsWith(".js")) return;
  20.     let props = require(`./commands/${file}`);
  21.     let commandName = file.split(".")[0];
  22.     console.log(`Attempting to load command ${commandName}`);
  23.     client.commands.set(commandName, props);
  24.   });
  25. });
  26. client.login(config.token);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top