Created
May 10, 2019 20:54
-
-
Save Strandxo/27cb505471f3ae4dffae8075f5dda82a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { readdirSync } = require("fs") | |
module.exports = (client) => { | |
const load = dirs => { | |
const commands = readdirSync(`./commands/${dirs}/`).filter(d => d.endsWith('.js')); | |
for (let file of commands) { | |
let pull = require(`../commands/${dirs}/${file}`); | |
client.commands.set(pull.config.name, pull); | |
if (pull.config.aliases) pull.config.aliases.forEach(a => client.aliases.set(a, pull.config.name)); | |
}; | |
}; | |
readdirSync('./commands/').forEach(x => load(x)); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { readdirSync } = require("fs") | |
module.exports = (client) => { | |
const load = dirs => { | |
const events = readdirSync(`./events/${dirs}/`).filter(d => d.endsWith('.js')); | |
for (let file of events) { | |
const evt = require(`../events/${dirs}/${file}`); | |
let eName = file.split('.')[0]; | |
client.on(eName, evt.bind(null, client)); | |
}; | |
}; | |
readdirSync('./events/').forEach(x => load(x)); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Client, Collection } = require("discord.js"); | |
const { token } = require("./config.js"); | |
const client = new Client(); | |
["aliases", "commands"].forEach(x => client[x] = new Collection()); | |
["command", "event"].forEach(x => require(`./utilities/${x}`)(client)); | |
client.login(token); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment