ez-eco
v1.0.1
Published
An easy-to-use economy system based on mongoose
Downloads
12
Readme
Installation
npm i easygoose
Creating a database
const ez = require('ez-eco')
ez.createDB(StartingCoinAmount, Description) //= Creates a database (duh)
//=> "Your DB's code is *code*"
// It also prints your code in the console
// Write your code down somewhere because if you lose it you can't access your database anymore!
Database functions
const ez = require('ez-eco')
ez.getDB(Code) //= Gets your database
//=> DB class object
let database = ez.getDB(Code) //= So we can use it in the examples :>
database.delete() //= Deletes your database. Oof!
//=> undefined
database.regenerateCode() //= Regenerates your code. Oh and it doesn't tell you your new one >.<
//=> undefined
database.getUser(ID) //= Gets a user using their ID
//=> User class object
database.getUsers() //= Gets all the users in the database. Useful if you wanna make a leaderboard
//=> Array of user class objects
database.findUsersByCoins(CoinAmount) //= Gets the users with that amount of coins
//=> Array of user class objects (unless no users have that amount of coins)
database.createUser(ID) //= Creates a user
//=> undefined
User functions
// Users aren't that interesting, sorry -.-
const ez = require('ez-eco')
let database = ez.getDB(Code) //= It would be nice to get your database first
let user = database.getUser(ID) //= Here comes the user
user.delete() //= Deletes the user. Guess they've been bad ¯\_(ツ)_/¯
//=> undefined
user.setCoins(CoinAmount) //= Sets the user's coins
//=> undefined
user.changeCoins(CoinAmount) //= Changes the amount of the user's coins
//=> undefined
// See? Not as interesting