2021-05-08 22:47:32 +00:00
|
|
|
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(' ');
|
2021-05-08 23:40:30 +00:00
|
|
|
let prefix = boundary === -1 ? content : content.substr(0, boundary);
|
2021-05-08 22:47:32 +00:00
|
|
|
|
|
|
|
moduleManager.execute(prefix, message);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
client.login(process.env.DISCORD_TOKEN);
|