@botsmk2/mongodb

1.5.0 • Public • Published

@botsmk2/mongodb

npm

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: 'useremail@gmail.com', 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);
})

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.5.0
    0
    • latest

Version History

Package Sidebar

Install

npm i @botsmk2/mongodb

Weekly Downloads

0

Version

1.5.0

License

MIT

Unpacked Size

8.65 kB

Total Files

5

Last publish

Collaborators

  • battlemanmk2