swift.eco
v2.0.0
Published
A simple, easy and powerful package meant for easy use of economy for discord bots!
Downloads
1
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
const Eco = require('swift.eco');
const eco = new Eco.Manager();
Advanced Setup
// 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
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
!