Giter Site home page Giter Site logo

cesiumlabs / quick.eco Goto Github PK

View Code? Open in Web Editor NEW
56.0 4.0 9.0 970 KB

Powerful economy framework for discord bots.

Home Page: https://eco.js.org

JavaScript 100.00%
discord eco discord-bots economy discord-economy discord-server economy-framework custom-storage database

quick.eco's Introduction

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

quick.eco's People

Contributors

hasethakuru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

quick.eco's Issues

Where does the data save?

I am trying to figure out where does all those data save. Trying to delete them manually. I need the path to those data. Please help. Thanks!

"TypeError: db.table is not a constructor" error thrown when attempting to start bot.

A quick summary of the problem:
So I have followed the guide on setting the bot up, but when I attempt to run it with node main.js I get this error:
image

It reads:

TypeError: db.table is not a constructor
    at new EconomyManager (C:\Users\sammy\Desktop\KRPSBot\2.0.5\node_modules\�[4mquick.eco�[24m\src\EconomyManager.js:18:24)
    at Object.<anonymous> (C:\Users\sammy\Desktop\KRPSBot\2.0.5\commands\balance.js:3:13)
�[90m    at Module._compile (internal/modules/cjs/loader.js:1133:30)�[39m
�[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)�[39m
�[90m    at Module.load (internal/modules/cjs/loader.js:977:32)�[39m
�[90m    at Function.Module._load (internal/modules/cjs/loader.js:877:14)�[39m
�[90m    at Module.require (internal/modules/cjs/loader.js:1019:19)�[39m
�[90m    at require (internal/modules/cjs/helpers.js:77:18)�[39m
    at Object.<anonymous> (C:\Users\sammy\Desktop\KRPSBot\2.0.5\main.js:15:18)
�[90m    at Module._compile (internal/modules/cjs/loader.js:1133:30)�[39m

Expected outcome:
That this wouldn't happen and the program would continue as normal.

Extra comments:
I think the issue resides in the EconomyManager.js (line 18) where it says if (name) db = new db.table(name.replace(/ +/g, ""));

Random user on .leaderboard()

i've trying using .leaderboard()
but it just fetch some random user, not actually top user

then how can i get the top user? without using .all()

Error with mongo.

Error: Could not find @quick.eco/mongo
I have uninstalled @quick.eco/mongo, reinstalled, updated, etc and I keep getting thrown the same error.

addMoney is a little glitchy

When using addMoney, let me use a hypothetical to make this easier to understand:

Your balance is 9000.

If you use addMoney and the amount of money you input is 10, it'll literally add 10 to it, making it 900010.

Multiple Economy?

Is it possible to run multiple balances?

Like Balance A/Balance B/Balance C?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.