A simple database similar to quick.db by Plexi Development.
npm install block.dbNPM: NPM Link
Installation: npm install block.db
Block.DB is inspired package from the npm package called: "Quick.db". This package has very similar features to Quick.db and here is an example of a Discord Economy Balance command!
``js
// Discord Bot Balance Command.
const Discord = require('discord.js')
const db = require('block.db');
const client = new Discord.Client()
client.on('message', async message => {
if (message.content.startsWith(!bal)) {
const user = message.mentions.users.first() || message.author
// Global:
let bal = db.get();
if (bal == null) {
bal = 0;
db.set(, 0);
}
// Guild:
let bal = db.get();
if (bal == null) {
bal = 0;
db.set(, 0);Balance: ${bal}
}
let embed = new Discord.MessageEmbed()
.setAuthor(user.username, user.displayAvatarURL)
.setDescription();`
message.channel.send(embed)
}
});
js
const db = require('block.db');// Set:
db.set(
variable, [value]);// Get:
db.get(
variable);
or
db.retrieve(variable);// Add:
db.add(
variable, [value]);// Sub:
db.sub(
variable, [value]);// All:
db.all(
variable);
or
db.getAll(variable);
``