1.0.0 • Published 3 years ago

legitdb v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

LegitDB

Support Server

WDB is a database that helps you store stuff in your database. All data is being stored with better-sqlite3

What is good about it:

  • You do not lose data everytime you restart your bot
  • You can instantly start using it without setting up anything
  • Very easy to use. Nothing complex in it

Example

const db = require("wdb");

// To set an object in the db for a specific user
db.set(`info_${message.author.id}`, { bio: "Very nice user" });
// Logs for us: { bio: "Very nice user" }

// To push data in an array in the db

let data = {
bio: "Very nice user",
Skill: "Sports"
}
db.push(`info_${message.author.id}`, data);
// Logs for us: { bio: "Very nice user", Skill: "Sports" }


// Adding an amount / a number to the user
db.add(`money_${message.author.id}`, 500);
// Logs for us: 500


//Removing an amount / a number to the user
db.subtract(`money_${message.author.id}`, 500)
//Since we already had 500 we will remove 500 so it logs for us: 0

//Deleting a values key
db.delete(`money_${message.author.id}`)
//Logs for us: null

// Fetching data
db.get(`money_${message.author.id}`);
db.fetch(`money_${message.author.id}`);

Installation

If you're having troubles installing wdb , here is a troubleshooting guide.

For Linux & Windows:

  • npm i db

Window users might have to do extra steps listed here.

For Mac

Step 1 Install XCode

Step 2 Run: npm i -g node-gyp in your terminal

Step 3 Run: node-gyp --python /path/to/python2.7 (skip this step if you dont have python 3.x installed)

Step 4 Run: npm i wdb