quick.eco
TypeScript icon, indicating that this package has built-in type declarations

6.0.0 • Public • Published

Quick.eco

Powerful economy framework for discord bots.

NPM

FOSSA Status

Installing

$ npm i quick.eco -s
 
// Add one of the following adapters [required]
 
$ npm i @quick.eco/sqlite
 
$ npm i @quick.eco/mongo
 
$ npm i @quick.eco/mysql 

Adapter Usage

Features

  • Global Economy
  • Per-guild Economy
  • Built-in cooldown
  • Flexible
  • Randomizer
  • Configurable
  • Storage Adapters
  • & much more...

Getting Started

const { EconomyManager } = require("quick.eco");
const eco = new EconomyManager({
    adapter: '', // => sqlite, mongo or mysql
    adapterOptions: {} // => Options
});

Example

const Discord = require("discord.js");
const client = new Discord.Client();
const { EconomyManager } = require("quick.eco")
const eco = new EconomyManager({
    adapter: 'sqlite'
});
 
client.on("ready", () => console.log('ready!'));
 
client.on("message", async (message) => {
    if (!message.guild || message.author.bot) return;
 
    if (message.content === "daily") {
        let add = await eco.daily(message.author.id, false, 500);
        if (add.cooldown) return message.reply(`You already claimed your daily coins. Come back after ${add.time.days} days, ${add.time.hours} hours, ${add.time.minutes} minutes & ${add.time.seconds} seconds.`);
        return message.reply(`you claimed ${add.amount} as your daily coins and now you have total ${add.money} coins.`);
    }
 
    if (message.content === "bal") {
        let money = await eco.fetchMoney(message.author.id);
        return message.channel.send(`${message.author} has ${money} coins.`);
    }
 
    if (message.content === "leaderboard") {
        let lb = await eco.leaderboard(false, 10);
        const embed = new Discord.MessageEmbed()
        .setAuthor("Leaderboard")
        .setColor("BLURPLE");
        lb.forEach(u => {
            embed.addField(`${u.position}${client.users.cache.get(u.user).tag}`, `Money: ${u.money} 💸`);
        });
        return message.channel.send(embed);
    }
});
 
client.login("XXXXXXXXXXXXXX");

Links

© Snowflake Studio ❄️ - 2020

Package Sidebar

Install

npm i quick.eco

Homepage

eco.js.org

Weekly Downloads

59

Version

6.0.0

License

MIT

Unpacked Size

34.5 kB

Total Files

8

Last publish

Collaborators

  • snowflake7
  • zyrouge