Metrios/index.js

27 lines
672 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 = boundary === -1 ? content : content.substr(0, boundary);
moduleManager.execute(prefix, message);
}
});
client.login(process.env.DISCORD_TOKEN);