ludex.eco
Version:
ludex.eco Javascript İle Yapılabilecek Kolay Kurulumlu Bir Ekonomi Modülüdür.
144 lines (122 loc) • 6.76 kB
JavaScript
const db = require("quick.db")
const ms = require("parse-ms")
module.exports = class quickeasy {
/*
Balance
*/
balance(option) {
let bal
if(!option.userId) throw new Error("BALANCE - You did not add a userID. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
if(option.userId) bal = db.get(`quickeasy_money_${option.userId}`)
let data = {
money: `${bal || "0"}`
}
return data
}
/*
Work
*/
work(option) {
if(!option.userId) throw new Error("WORK - You did not specify a userID. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
if(!option.workMoney) throw new Error("WORK - You did not specify workMoney. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
if(isNaN(option.workMoney)) throw new Error("WORK - Your workMoney is not a valid number. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
if(!option.workJobs) option.workJobs = ["Chef", "Cashier", "Teacher", "Programmer"]
if(typeof option.workJobs !== "object") throw new Error ("WORK - Your workJobs must be an array. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
let random = Math.floor(Math.random() * option.workMoney)
let rword = Math.floor(Math.random() * option.workJobs.length)
db.add(`quickeasy_money_${option.userId}`, random)
let data = {
amount: `${random}`,
job: `${option.workJobs[rword]}`
}
return data
}
/*
addMoney
*/
addMoney(option){
if(!option.userId) throw new Error("ADDMONEY - You did not specify a userID. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
if(!option.amountMoney) throw new Error("ADDMONEY - You did not specify amountMoney. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
if(isNaN(option.amountMoney)) throw new Error("ADDMONEY - Your amountMoney is not a valid number. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
db.add(`quickeasy_money_${option.userId}`, option.amountMoney)
let data = {
amount: `${option.amountMoney}`
}
return data
}
/*
removeMoney
*/
removeMoney(option){
if(!option.userId) throw new Error("REMOVEMONEY - You did not specify a userID. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
if(!option.amountMoney) throw new Error("REMOVEMONEY - You did not specify amountMoney. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
if(isNaN(option.amountMoney)) throw new Error("REMOVEMONEY - Your amountMoney is not a valid number. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
db.subtract(`quickeasy_money_${option.userId}`, option.amountMoney)
let data = {
amount: `${option.amountMoney}`
}
return data
}
/*
setMoney
*/
setMoney(option){
if(!option.userId) throw new Error("SETMONEY - You did not specify a userID. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
if(!option.amountMoney) throw new Error("SETMONEY - You did not specify amountMoney. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
if(isNaN(option.amountMoney)) throw new Error("SETMONEY - Your amountMoney is not a valid number. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
db.set(`quickeasy_money_${option.userId}`, option.amountMoney)
let data = {
amount: `${option.amountMoney}`
}
return data
}
/*
resetMoney
*/
resetMoney(option){
if(!option.userId) throw new Error("RESETMONEY - You did not specify a userID. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
db.delete(`quickeasy_money_${option.userId}`)
}
pay(option){
if(!option.userId) throw new Error("PAY - You did not specify a userID. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
if(!option.usertoPay) throw new Error("PAY - You did not specify a the yser you want to pay. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
if(!option.amountMoney) throw new Error("PAY - You did not specify an amountMoney. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
if(isNaN(option.amountMoney)) throw new Error("PAY - Your amountMoney is not a number. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
db.subtract(`quickeasy_money_${option.userId}`, option.amountMoney)
db.add(`quickeasy_money_${option.usertoPay}`, option.amountMoney)
let data = {
amount: `${option.amountMoney}`,
}
return data
}
search(option) {
if(!option.userId) throw new Error("SEARCH - You did not specify a userID. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
if(!option.searchMoney) throw new Error("SEARCH - You did not specify searchMoney. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
if(isNaN(option.searchMoney)) throw new Error("SEARCH - Your searchMoney is not a valid number. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
if(!option.searchPlace) option.searchPlace = ["House" , "Home", "Pocket" , "Hospital"]
if(typeof option.searchPlace !== "object") throw new Error ("SEARCH - Your searchPlace must be an array. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
let random = Math.floor(Math.random() * option.searchMoney)
let rword = Math.floor(Math.random() * option.searchPlace.length)
db.add(`quickeasy_money_${option.userId}`, random)
let data = {
amount: `${random}`,
place: `${option.searchPlace[rword]}`
}
return data
}
beg(option) {
if(!option.userId) throw new Error("BEG - You did not specify a userID. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
if(!option.begMoney) throw new Error("BEG - You did not specify begMoney. Confused? Join our support server: https://discord.BGE/cNgpPXS9JW")
if(isNaN(option.begMoney)) throw new Error("BEG - Your begMoney is not a valid number. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
if(!option.begPeople) option.begPeople = ["Charlie" , "WLegit", "MrBeast" , "Mum"]
if(typeof option.begPeople !== "object") throw new Error ("BEG - Your begPeople must be an array. Confused? Join our support server: https://discord.gg/VcfpUgtajB")
let random = Math.floor(Math.random() * option.begMoney)
let rword = Math.floor(Math.random() * option.begPeople.length)
db.add(`quickeasy_money_${option.userId}`, random)
let data = {
amount: `${random}`,
people: `${option.begPeople[rword]}`
}
return data
}
}