@rox_cool/mongo-eco

A simple mongo db economy framework for discord.js

Usage no npm install needed!

<script type="module">
  import roxCoolMongoEco from 'https://cdn.skypack.dev/@rox_cool/mongo-eco';
</script>

README

What is this

This is a simple mongo db economy framework which makes it easer for discord bot developers to make economy commands more easier

Installation

npm i @rox_cool/mongo-eco --save

Then...

const eco = require('mongo-eco')
eco.setDB("Your mongo db url")

Add this in your index.js or your main file and then..

In the messages event...


    /**
     * @param {string} userID - A valid discord user id
     * @param {string} serverID - A valid discord server id
     * @param {Object} options - Options for setting up user data, totally optional , it already has a default fallback i.e   wallet: 0 and bank: 0
     * @param {number} options.wallet - Money required to be set in the wallet
     * @param {number} options.bank - Money required to be set in the bank
     * @returns {Promise<boolean>} If the user's data is made it will return true
     */


client.on("message", async (message) => {
    eco.createUser(message.author.id, message.guild.id, {"options if necessary"} )
})