27 lines
644 B
JavaScript
27 lines
644 B
JavaScript
|
if(process.env.NODE_ENV !== "production") {
|
||
|
require("dotenv").config();
|
||
|
}
|
||
|
|
||
|
const Discord = require("discord.js");
|
||
|
const client = new Discord.Client();
|
||
|
const ModuleManager = require("./src/module_manager");
|
||
|
|
||
|
let moduleManager = new ModuleManager();
|
||
|
|
||
|
client.on("ready", () => {
|
||
|
console.log("Logged in as " + client.user.tag);
|
||
|
});
|
||
|
|
||
|
client.on("message", message => {
|
||
|
let content = message.toString();
|
||
|
|
||
|
if(content.substr(0,1) === "!") {
|
||
|
let boundary = content.indexOf(' ');
|
||
|
let prefix = content.substr(0, boundary);
|
||
|
|
||
|
moduleManager.execute(prefix, message);
|
||
|
}
|
||
|
});
|
||
|
|
||
|
client.login(process.env.DISCORD_TOKEN);
|