# swift.eco

> A simple, easy and powerful package meant for easy use of economy for discord bots!

Latest version **2.0.0** (published 2023-06-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install swift.eco
pnpm add swift.eco
yarn add swift.eco
bun add swift.eco
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2023-06-04 |
| First published | 2022-05-24 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 30.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | magicals |
| Maintainers | magicals |

## Links

- npm: https://www.npmjs.com/package/swift.eco
- npm.io page: https://npm.io/package/swift.eco

## Dependencies (1)

- [quick.db](https://npm.io/package/quick.db.md) ^9.1.6

## Recent versions

- 2.0.0 (latest) — 2023-06-04
- 1.1.0 — 2022-05-31
- 1.0.0 — 2022-05-24

## README

# Installation
```
npm i swift.eco
```
# About
A simple, easy and powerful package meant for easy use of economy for discord bots!
# Features
- Now supports the latest version of Quick.DB
- Global Economy
- Built-in cooldown
- Easily customizable
- & much more
# Setup
```js
const Eco = require('swift.eco');
const eco = new Eco.Manager();
```
# Advanced Setup
```js
// recommended to use Discord.JS V14, head over to https://discord.js.org/ for more info!
const Discord = require('discord.js');
const client = new Discord.Client({ intents: new Discord.Intents(32767) })

const Eco = require('swift.eco');
const eco = new Eco.Manager();

client.on('ready', () => {
  console.log(`${client.user.tag} is up and ready!`)
  client.user.setActivity('!help', { type: 'PLAYING' })
})

client.on('messageCreate', message => {
  if(message.content === '!balance' || message.content === '!bal') {
    let wallet = eco.fetchMoney(message.author.id);
    let bank = eco.fetchBank(message.author.id);

    const embed = new Discord.MessageEmbed()
     .setTitle(`${message.author.username}'s Balance`)
     .setDescription(`**Wallet**: ${wallet.amount}\n**Bank**: ${bank.amount}`)
     .setColor('RED')
    message.channel.send({embeds:[embed]})
  }
  if(message.content === '!daily') {
    let dailyamt = Math.floor(Math.random() * 20000) + 10000;
    let daily = eco.daily(message.author.id, dailyamt);

    if (daily.onCooldown) return message.channel.send(`You already claimed your daily coins. Come back after ${daily.time.hours} hours, ${daily.time.minutes} minutes & ${daily.time.seconds} seconds!`);
    else return message.channel.send(`You've claimed ${daily.amount} as your daily coins and now you have total ${daily.after} coins!`);
  };
});

client.login('YOUR BOT TOKEN');
```
# Functions
```js
addMoney(userid, amount); // Add money & return object
fetchMoney(userid); // Return object
fetchBank(userid); // Return object
setMoney(userid, amount); // Set new money valuw & return object
deleteUser(userid); // Delete a user from the database
removeMoney(userid, amount); // Remove a certain amount of money from the user
daily(userid, amount); // Add daily amount and return object with cooldown
weekly(userid, amount); // Add weekly amount and return object with cooldown
work(userid, amount, { options }); // Work function, returns object | options: { cooldown: time_in_ms, jobs: ["job name", "another job"] }
beg(userid, amount, { options }); // Beg function, returns object | options: { canLose: false, cooldown: time_in_ms } | [ can be used in "search" command ]
fish(userid, amount, { options }); // Fish function, returns object | options: { canLose: false, cooldown: time_in_ms }
hunt(userid, amount, { options }); // Hunt function, returns object | options: { canLose: false, cooldown: time_in_ms }
dig(userid, amount, { options }); // Dig function, returns object | options: { canLose: false, cooldown: time_in_ms }
crime(userid, amount, { options }); // Crime function, returns object | options: { canLose: false, cooldown: time_in_ms }
postmeme(userid, amount, { options }); // Postmeme function, returns object | options: { canLose: false, cooldown: time_in_ms }
transfer(userid1, userid2, amount); // Transfer balance from a user to another, returns object
rob(userid1, userid2, amount); // Rob someone's balance, returns object
search(userid, amount, { options }); // Search function, returns object | options: { cooldown: time_in_ms, places: ["Uber", "Sewer"] }
leaderboard({ options }); // Returns leaderboard | options: { raw: false, limit: 10 }
```
# Support
For support or issues or queries, message me on discord at `Magicals#5931`!

---
_Source: https://npm.io/package/swift.eco · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
