//Require these at top of index.js
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
cs.setMongoURL('MongoURL Here');
//Require these at top of index.js
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
cs.setMongoURL('MongoURL Here');
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
cs.setDefaultWalletAmount('100') // $100 will be the default wallet money when a new User is created.
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
cs.setDefaultBankAmount('100') // $100 will be the default Bank money when a new User is created.
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
cs.setMaxWalletAmount('10000') // $10,000 will be the Maximum amount of money a user can have in there wallet!
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
cs.setMaxBankAmount('10000') // $10,000 will be the Maximum amount of money a user can have in there bank!
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
cs.searchForNewUpdate(true) // It'll console log if there's a new update.
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
const money = 1000;
const wheretoPutMoney = 'wallet'; // Or bank
let result = await cs.addMoney({
user: 'UserID',
guild: 'GuildID',
amount: money,
wheretoPutMoney: wheretoPutMoney
});
if (result.error) return message.reply("You cant add negitive money");
else message.reply(`Successfully added $${money} to ${message.author.username}, ( in ${wheretoPutMoney} )`)
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
const money = 1000;
const wheretoPutMoney = 'wallet'; // Or bank
let result = await cs.removeMoney({
user: 'userID',
guild: 'guildID',
amount: money,
wheretoPutMoney: wheretoPutMoney
});
if (result.error) return message.reply("You cant remove negitive money");
else message.reply(`Successfully removed $${money} to ${message.author.username}, ( from ${wheretoPutMoney} )`)
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
const money = 1000;
const wheretoPutMoney = 'wallet'; // Or bank
let result = await cs.addMoneyToAllUsers({
guild: message.guild.id,
amount: money,
wheretoPutMoney: wheretoPutMoney
});
if (result.error) {
if (result.type === 'negative-money') return message.reply("You cant add negitive money");
else return message.reply('No User\'s found');
} else message.reply(`Successfully added $${money} to ${result.rawData.length} people!, ( in ${wheretoPutMoney} )`)
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
const money = 1000;
const wheretoPutMoney = 'wallet'; // Or bank
let result = await cs.removeMoneyFromAllUsers({
guild: message.guild.id,
amount: money,
wheretoPutMoney: wheretoPutMoney
});
if (result.error) {
if (result.type === 'negative-money') return message.reply("You cant remove negitive money");
else return message.reply('No User\'s found');
} else message.reply(`Successfully removed $${money} from ${result.rawData.length} people!, ( in ${wheretoPutMoney} )`)
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let money = args[0].value
if (isNaN(money)) return message.reply("Amount is not a number.");
let result = await cs.gamble({
user: 'userID',
guild: 'guildID',
amount: money,
minAmount: 1,
cooldown: 25 //25 seconds
});
if (result.error) {
if (result.type == 'amount') return message.reply("Please insert an amount first.");
if (result.type == 'nan') return message.reply("The amount was not a number.");
if (result.type == 'low-money') return message.reply(`You don't have enough money. You need ${result.neededMoney}$ more to perform the action. `);
if (result.type == 'gamble-limit') return message.reply(`You don't have enough money for gambling. The minimum was $${result.minAmount}.`);
if (result.type == 'time') return message.reply(`Wooo that is too fast. You need to wait **${result.second}** second(s) before you can gamble again.`);
} else {
if (result.type == 'lost') return message.reply(`Ahh, no. You lose $${result.amount}. You've $${result.wallet} left. Good luck next time.`);
if (result.type == 'won') return message.reply(`Woohoo! You won $${result.amount}! You've $${result.wallet}. Good luck, have fun!`);
}
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let money = args[0].value
if (!money) return message.reply("Enter the amount you want to deposite.");
let result = await cs.deposite({
user: 'userID',
guild: 'guildID',
amount: money
});
if (result.error) {
if (result.type === 'money') return message.reply("Specify an amount to deposite");
if (result.type === 'negative-money') return message.reply("You can't deposite negative money");
if (result.type === 'low-money') return message.reply("You don't have that much money in wallet.");
if (result.type === 'no-money') return message.reply("You don't have any money to deposite");
if (result.type === 'bank-full') return message.reply("Your bank is full. It has reached it's limit.");
} else {
if (result.type === 'all-success') return message.reply("You have deposited all your money to your bank" + `\nNow you've $${result.rawData.wallet} In your wallet and $${result.rawData.bank} in your bank.`);
if (result.type === 'success') return message.reply(`You have deposited $${result.amount} money to your bank.\nNow you've $${result.rawData.wallet} In your wallet and $${result.rawData.bank} in your bank.`);
};
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let money = args[0].value
if (!money) return message.reply("Enter the amount you want to withdraw.");
let result = await cs.withdraw({
user: 'userID',
guild: 'guildID',
amount: money
});
if (result.error) {
if (result.type === 'money') return message.reply("Specify an amount to withdraw")
if (result.type === 'negative-money') return message.reply("You can't withdraw negative money, please use deposit command")
if (result.type === 'low-money') return message.reply("You don't have that much money in bank.")
if (result.type === 'no-money') return message.reply("You don't have any money to withdraw")
} else {
if (result.type === 'all-success') return message.reply("You have withdraw'd all your money from your bank" + `\nNow you've $${result.rawData.wallet} In your wallet and $${result.rawData.bank} in your bank.`)
if (result.type === 'success') return message.reply(`You have withdraw $${result.amount} money from your bank.\nNow you've $${result.rawData.wallet} In your wallet and $${result.rawData.bank} in your bank.`)
};
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
const user = message.options.getUser('user') || 'userID';
let result = await cs.balance({
user: user,
guild: 'guildID'.id
});
return message.reply(`${user.tag}, has $${(result.wallet).toLocaleString()} in there wallet and $${(result.bank).toLocaleString()} in there bank. There Max bank has been set to $${(result.rawData.bankSpace.toLocaleString())}`);
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let user = message.options.getUser('user');
if (user.id === 'userID'.id) return message.channel.send(`You can't transfer money to yourself!`);
let amount = message.options.getInteger('amount');
if (!amount) return message.reply("Enter amount of money to add.");
if (amount.includes("-")) return message.reply("You can't send negitive money.")
let money = parseInt(amount);
let result = await cs.transferMoney({
user: 'userID',
user2: user,
guild: 'guildID',
amount: money
});
if (result.error) return message.reply(`You don't have enough money in your wallet.`);
else message.reply(`**${message.author.username}**, Successfully transfered **${result.money}** to **${result.user2.username}**`)
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let data = await cs.leaderboard('guildID');
if (data.length < 1) return message.reply("Nobody's in leaderboard yet.");
const msg = new Discord.MessageEmbed();
let pos = 0;
// This is to get First 10 Users :)
data.slice(0, 10).map(e => {
if (!client.users.cache.get(e.userID)) return;
pos++
msg.addField(`${pos} - **${client.users.cache.get(e.userID).username}**`, `Wallet: **${e.wallet}** - Bank: **${e.bank}**`, true);
});
message.reply({
embeds: [msg]
}).catch();
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let data = await cs.globalLeaderboard();
if (data.length < 1) return message.reply("Nobody's in Global leaderboard yet.");
const msg = new Discord.MessageEmbed();
let pos = 0;
// This is to get First 10 Users )
data.slice(0, 10).map(e => {
if (!client.users.cache.get(e.userID)) return;
pos++
msg.addField(`${pos} - **${client.users.cache.get(e.userID).username}**`, `Wallet: **${e.wallet}** - Bank: **${e.bank}**`, true);
});
message.reply({
embeds: [msg]
}).catch();
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let result = await cs.hourly({
user: 'UserID',
guild: 'guildID',
amount: 100,
});
if (result.error) return message.reply(`You have used hourly recently Try again in ${result.time}`);
else return message.reply(`You have earned $${result.amount}. Your streak is now ${result.rawData.streak.hourly}`);
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let result = await cs.quaterly({
user: 'userID',
guild: 'guildID',
amount: 100,
});
if (result.error) return message.reply(`You have used quaterly recently Try again in ${result.time}`);
else message.reply(`You have earned $${result.amount}. Your streak is now ${result.rawData.streak.quaterly}`);
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let result = await cs.hafly({
user: 'userID',
guild: 'guildID',
amount: 100,
});
if (result.error) return message.reply(`You have used hafly recently Try again in ${result.time}`);
else return message.reply(`You have earned $${result.amount}. Your streak is now ${result.rawData.streak.hafly}`);
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let result = await cs.daily({
user: 'userID',
guild: 'guildID',
amount: 100,
});
if (result.error) return message.reply(`You have used daily recently Try again in ${result.time}`);
else message.reply(`You have earned $${result.amount}. Your streak is now ${result.rawData.streak.daily}`);
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let result = await cs.weekly({
user: 'userID',
guild: 'guildID',
amount: 100,
});
if (result.error) return message.reply(`You have used weekly recently Try again in ${result.time}`);
else message.reply(`You have earned $${result.amount}. Your streak is now ${result.rawData.streak.weekly}`);
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let result = await cs.monthly({
user: 'userID',
guild: 'guildID',
amount: 6000,
});
if (result.error) return message.reply(`You have used monthly recently Try again in ${result.time}`);
else message.reply(`You have earned $${result.amount}. Your streak is now ${result.rawData.streak.monthly}`);
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let result = await cs.yearly({
user: 'userID',
guild: 'guildID',
amount: 6000,
});
if (result.error) return message.reply(`You have used yearly recently Try again in ${result.time}`);
else message.reply(`You have earned $${result.amount}. Your streak is now ${result.rawData.streak.yearly}`);
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let result = await cs.work({
user: 'userID',
guild: 'guildID',
maxAmount: 100,
replies: ['Programmer', 'Builder', 'Waiter', 'Busboy', 'Chief', 'Mechanic'],
cooldown: 25 //25 seconds
});
if (result.error) return message.reply(`You have already worked recently Try again in ${result.time}`);
else message.reply(`You worked as a ${result.workType} and earned $${result.amount}.`)
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let user = args[0].user
if (user.bot || user === client.user) return message.reply("This user is a bot.");
if (!user) return message.reply('Sorry, you forgot to mention somebody.');
let result = await cs.rob({
user: 'userID',
user2: user,
guild: 'guildID',
minAmount: 100,
successPercentage: 5,
cooldown: 25, //25 seconds,
maxRob: 1000
});
if (result.error) {
if (result.type === 'time') return message.reply(`You have already robbed recently Try again in ${result.time}`);
if (result.type === 'low-money') return message.reply(`You need atleast $${result.minAmount} to rob somebody.`);
if (result.type === 'low-wallet') return message.reply(`${result.user2.username} have less than $${result.minAmount} to rob.`)
if (result.type === 'caught') return message.reply(`${'userID'.username} you robbed ${result.user2.username} and got caught and you payed ${result.amount} to ${result.user2.username}!`)
} else {
if (result.type === 'success') return message.reply(`${'userID'.username} you robbed ${result.user2.username} and got away with ${result.amount}!`)
}
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let result = await cs.beg({
user: 'userID',
guild: 'guildID',
minAmount: 100,
maxAmount: 400
});
if (result.error) return message.reply(`You have begged recently Try again in ${result.time}`);
else message.reply(`You have earned $${result.amount}.`)
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
const user = message.options.getUser('user') || 'userID';
let result = await cs.getUserItems({
user: user,
guild: 'guildID',
});
let inv = result.inventory.slice(0, 10)
const embed = new Discord.MessageEmbed()
.setDescription('Your Inventory in Empty!')
for (key of inv) {
embed.addField(`**${key.name}:**`, `Amount: ${key.amount}`);
embed.setDescription('Your Inventory!')
};
return message.reply({
embeds: [embed]
})
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let result = await cs.getShopItems({
guild: 'guildID'
});
let inv = result.inventory;
const embed = new Discord.MessageEmbed()
.setDescription('Shop!')
for (let key in inv) {
embed.addField(`${parseInt(key) + 1} - Price: $${inv[key].price} - **${inv[key].name}:**`, inv[key].description)
}
message.reply({
embeds: [embed]
})
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
if (message.options.getInteger('price') < 1) return message.channel.send("You can't add an item for less than 1$!");
let result = await cs.addItem({
guild: 'guildID',
inventory: {
name: message.options.getString('name'),
price: message.options.getInteger('price'),
description: message.options.getString('description')
}
});
if (result.error) {
if (result.type == 'No-Inventory-Name') return message.channel.send('There was a error, Please enter item name to removadd.!')
if (result.type == 'Invalid-Inventory-Price') return message.channel.send('There was a error, invalid price!')
if (result.type == 'No-Inventory-Price') return message.channel.send('There was a error, You didnt specify price!')
if (result.type == 'No-Inventory') return message.channel.send('There was a error, No data recieved!')
} else return message.channel.send('Done! Successfully added `' + message.options.getString('name') + '` to the shop!')
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
if (!args[0].value) return message.reply('Which item to remove?')
let result = await cs.removeItem({
guild: 'guildID',
item: parseInt(args[0].value)
});
if (result.error) {
if (result.type == 'Invalid-Item-Number') return message.reply('There was a error, Please enter item number to remove.!')
if (result.type == 'Unknown-Item') return message.reply('There was a error, The Item Does not exist!')
} else message.reply('Done! Successfully removed the `' + result.inventory.name + '` from shop!')
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
cs.setItems({
guild: 'guildID', // guild, remove this line to make it global
shop: [{
name: 'Watch',
price: 20
}, {
name: 'Rolex',
price: 1230
}]
}).then(console.log)
Note: This will remove money from user's bank
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let thing = args[0].value
if (!thing) return message.reply('Please provide item number')
if (isNaN(thing)) return message.reply('Please provide valid item number')
let result = await cs.addUserItem({
user: 'userID',
guild: 'guildID',
item: parseInt(args[0].value)
});
if (result.error) {
if (result.type === 'No-Item') return message.reply('Please provide valid item number');
if (result.type === 'Invalid-Item') return message.reply('item does not exists');
if (result.type === 'low-money') return message.reply(`**You don't have enough balance to buy this item!**`);
} else return message.reply(`**Successfully bought \`${result.inventory.name}\` for $${result.inventory.price}**`)
Note: This will NOT add money to user's bank
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
if (!args[0].value) return message.reply('Which item to remove?')
let result = await cs.removeUserItem({
user: 'userID',
guild: 'guildID',
item: parseInt(args[0].value)
});
if (result.error) {
if (result.type == 'Invalid-Item-Number') return message.reply('There was a error, Please enter item number to remove.!')
if (result.type == 'Unknown-Item') return message.reply('There was a error, The Item Does not exist!')
} else message.reply('Done! Successfully sold the `' + result.inventory.name + '` for free! You now have ' + result.inventory.amount + ' of those items left!')
  You can modify same example to make a 'use' command.
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
// !use < item name from your inventory>
let item = args[0].value;
if (!item) return message.reply("What item you wana use?")
if (parseInt(item)) return message.reply("Please use the name of the item, not the ID.")
let haveItem = false;
const arr = await cs.getUserItems({
user: 'userID',
guild: 'guildID',
});
let i;
for (key in arr.inventory) {
if (arr.inventory[key].name.toLowerCase().includes(item.toLowerCase())) haveItem = true
i = key;
};
if (haveItem) {
let money = Math.floor((Math.random() * 10) + 1) * 100 // 100 - 1000
let result = await cs.addMoney({
user: 'userID',
guild: 'guildID',
amount: money,
wheretoPutMoney: 'wallet'
});
await cs.removeUserItem({
user: 'userID',
guild: 'guildID',
item: i
});
if (result.error) {
console.log(result)
return message.reply("Unknown error occured see console.")
} else return message.reply("You've used " + item + " and earned $" + money)
} else return message.reply("Please buy the item first!")
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let result = await cs.info('userID'.id, 'guildID'.id);
const embed = new Discord.MessageEmbed()
.setDescription('Info about ' + 'userID'.tag);
let unUsed = '';
let cantBeUsed = '';
for (const [key, value] of result.info) {
if (value.used) unUsed += `- ${key}\n`;
else cantBeUsed += `- ${key} ( ${value.timeLeft} )\n`;
}
embed.addField('Commands That you can use:', unUsed || 'None');
embed.addField('Commands That you can\'t use:', cantBeUsed || 'None');
message.reply({
embeds: [embed]
});
  Note: It will auto create new user if it dosn't already exist.
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
let result = await cs.findUser({user: 'UserID', guild: 'guildID'});
console.log(result);
  Note: It can take few moments to update the DB.
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
cs.saveUser('Raw data from findUser Function.');
  Note: It uses mili-seconds. You need to await it else it wont work.
// Requiring the Package
const CurrencySystem = require("currency-system");
const cs = new CurrencySystem;
// Method:
await cs.sleep(Time_in_MS);
process.on("unhandledRejection", _ => console.error(_.stack + '\n' + '='.repeat(20)));