@botsmk2/mongodb
v1.5.0
Published
Quickly connects Discord bot to MongoDB
Downloads
28
Readme
@botsmk2/mongodb
A custom class for managing the connection to MongoDB and for storing Discord bot information.
Install
$ npm install @botsmk2/mongodb
Usage
const {MongoDB, Bot} = require('@botsmk2/mongodb');
const mongoDB = new MongoDB(true); //true if the project accessing MongoDB is a bot && process.env.BOT_DATABASE has been set
//=> Opened connection to database
//=> Opened conection to bot's database
const {MongoDB, Bot} = require('@botsmk2/mongodb');
const mongodb = new MongoDB(false);
mongodb.on('databaseConnected', function() {
const bot = new Bot();
bot.name = "TEMPORARY BOT";
bot.description = "This bot is just a test";
bot.owner = {email: '[email protected]', discordID: '1234567890987654321'};
bot.productionStatus = 'pending';
bot.addStatus('YouTube', 'watching');
bot.addVariable('PREFIX', '!');
bot.addVariable('BOT_TOKEN', 'NULL');
bot.addVariable('CLIENT_ID', 'NULL');
bot.addVariable('CLIENT_SECRET', 'NULL');
bot.addVariable('TZ', 'America/Indiana/Indianapolis');
bot.saveToDatabase(mongodb.db);
})