Comparing version 0.0.1 to 0.0.2
474
emo-eco.js
@@ -1,6 +0,12 @@ | ||
const { IDCheck, AmountCheck, GetMoney, RandomNumber } = require("./Src/Functions.js"); | ||
const { | ||
IDCheck, | ||
AmountCheck, | ||
GetMoney, | ||
MoneyChecker, | ||
RandomNumber | ||
} = require("./Src/Functions.js"); | ||
const db = require("wio.db"); | ||
module.exports = { | ||
Daily: async function (GuildID, UserID) { | ||
Yearly: async function (GuildID, UserID) { | ||
if (!GuildID) throw new Error(`Please Give Guild ID!`); | ||
@@ -13,3 +19,4 @@ await IDCheck(GuildID, "Guild"); | ||
if (OldMoney === null) OldMoney = "0"; | ||
await db.add(`Eco_${GuildID}_${UserID}`, 1000); | ||
await MoneyChecker(OldMoney, "OldMoney"); | ||
await db.add(`Eco_${GuildID}_${UserID}`, 10); | ||
let NewMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
@@ -21,5 +28,6 @@ if (NewMoney === null) NewMoney = "0"; | ||
UserID: UserID, | ||
AddedMoney: 1000, | ||
AddedMoney: 10, | ||
OldMoney: OldMoney, | ||
NewMoney: NewMoney, | ||
Line: `GG! You Have Claimed Your Yearly 10 Lmfao`, | ||
TimeStamp: new Date() | ||
@@ -30,3 +38,3 @@ }; | ||
}, | ||
SetMoney: async function (GuildID, UserID, Amount) { | ||
Monthly: async function (GuildID, UserID) { | ||
if (!GuildID) throw new Error(`Please Give Guild ID!`); | ||
@@ -36,10 +44,7 @@ await IDCheck(GuildID, "Guild"); | ||
await IDCheck(UserID, "User"); | ||
if (!Amount) throw new Error(`Please Give Amount!`); | ||
await AmountCheck(Amount); | ||
let OldMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (OldMoney === null) OldMoney = "0"; | ||
await db.set(`Eco_${GuildID}_${UserID}`, Amount); | ||
await MoneyChecker(OldMoney, "OldMoney"); | ||
await db.add(`Eco_${GuildID}_${UserID}`, 5); | ||
let NewMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
@@ -51,5 +56,6 @@ if (NewMoney === null) NewMoney = "0"; | ||
UserID: UserID, | ||
SettedMoney: Amount, | ||
AddedMoney: 5, | ||
OldMoney: OldMoney, | ||
NewMoney: NewMoney, | ||
Line: `GG! You Have Claimed Your Monthly 5 Lmao`, | ||
TimeStamp: new Date() | ||
@@ -60,15 +66,12 @@ }; | ||
}, | ||
AddMoney: async function (GuildID, UserID, Amount) { | ||
Daily: async function (GuildID, UserID) { | ||
if (!GuildID) throw new Error(`Please Give Guild ID!`); | ||
await IDCheck(GuildID, "Guild"); | ||
if (!UserID) throw new Error(`Please Give User ID!`); | ||
await IDCheck(UserID, "User"); | ||
if (!GuildID) throw new Error(`Please Give Guild ID!`); | ||
await IDCheck(GuildID, "Guild"); | ||
if (!Amount) throw new Error(`Please Give Amount!`); | ||
await AmountCheck(Amount); | ||
let OldMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (OldMoney === null) OldMoney = "0"; | ||
await db.add(`Eco_${GuildID}_${UserID}`, Amount); | ||
await MoneyChecker(OldMoney, "OldMoney"); | ||
await db.add(`Eco_${GuildID}_${UserID}`, 2400); | ||
let NewMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
@@ -80,5 +83,6 @@ if (NewMoney === null) NewMoney = "0"; | ||
UserID: UserID, | ||
AddedMoney: Amount, | ||
AddedMoney: 2400, | ||
OldMoney: OldMoney, | ||
NewMoney: NewMoney, | ||
Line: `GG! You Have Claimed Your Daily 2400!`, | ||
TimeStamp: new Date() | ||
@@ -89,3 +93,3 @@ }; | ||
}, | ||
RemoveMoney: async function (GuildID, UserID, Amount) { | ||
Hourly: async function (GuildID, UserID) { | ||
if (!GuildID) throw new Error(`Please Give Guild ID!`); | ||
@@ -95,10 +99,7 @@ await IDCheck(GuildID, "Guild"); | ||
await IDCheck(UserID, "User"); | ||
if (!Amount) throw new Error(`Please Give Amount!`); | ||
await AmountCheck(Amount); | ||
let OldMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (OldMoney === null) OldMoney = "0"; | ||
await db.substr(`Eco_${GuildID}_${UserID}`, Amount); | ||
await MoneyChecker(OldMoney, "OldMoney"); | ||
await db.add(`Eco_${GuildID}_${UserID}`, 100); | ||
let NewMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
@@ -110,5 +111,6 @@ if (NewMoney === null) NewMoney = "0"; | ||
UserID: UserID, | ||
RemovedMoney: Amount, | ||
AddedMoney: 100, | ||
OldMoney: OldMoney, | ||
NewMoney: NewMoney, | ||
Line: `GG! You Have Claimed Your Hourly 100!`, | ||
TimeStamp: new Date() | ||
@@ -127,2 +129,3 @@ }; | ||
if (UserMoney === null) UserMoney = "0"; | ||
await MoneyChecker(UserMoney, "UserMoney"); | ||
@@ -133,2 +136,3 @@ let Data = { | ||
Money: UserMoney, | ||
Line: `You Have ${UserMoney}!`, | ||
TimeStamp: new Date() | ||
@@ -147,2 +151,3 @@ }; | ||
if (UserMoney === null) UserMoney = "0"; | ||
await MoneyChecker(UserMoney, "UserMoney"); | ||
@@ -153,2 +158,3 @@ let Data = { | ||
Money: UserMoney, | ||
Line: `You Have ${UserMoney}!`, | ||
TimeStamp: new Date() | ||
@@ -159,3 +165,3 @@ }; | ||
}, | ||
Work: async function (GuildID, UserID, Currency, SpaceInCurrency) { | ||
SetMoney: async function (GuildID, UserID, Amount) { | ||
if (!GuildID) throw new Error(`Please Give Guild ID!`); | ||
@@ -165,4 +171,126 @@ await IDCheck(GuildID, "Guild"); | ||
await IDCheck(UserID, "User"); | ||
if (!Currency) throw new Error(`Please Give Currency Of Point/Coins | Points , Coins , $ , Etc`); | ||
if (!Amount) throw new Error(`Please Give Amount!`); | ||
await AmountCheck(Amount); | ||
let OldMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (OldMoney === null) OldMoney = "0"; | ||
await MoneyChecker(OldMoney, "OldMoney"); | ||
await db.set(`Eco_${GuildID}_${UserID}`, Number(Amount)); | ||
let NewMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (NewMoney === null) NewMoney = "0"; | ||
let Data = { | ||
GuildID: GuildID, | ||
UserID: UserID, | ||
SettedMoney: Amount, | ||
OldMoney: OldMoney, | ||
NewMoney: NewMoney, | ||
Line: `Now <@${UserID}> Have ${Amount}!`, | ||
TimeStamp: new Date() | ||
}; | ||
return Data; | ||
}, | ||
AddMoney: async function (GuildID, UserID, Amount) { | ||
if (!UserID) throw new Error(`Please Give User ID!`); | ||
await IDCheck(UserID, "User"); | ||
if (!GuildID) throw new Error(`Please Give Guild ID!`); | ||
await IDCheck(GuildID, "Guild"); | ||
if (!Amount) throw new Error(`Please Give Amount!`); | ||
await AmountCheck(Amount); | ||
let OldMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (OldMoney === null) OldMoney = "0"; | ||
await MoneyChecker(OldMoney, "OldMoney"); | ||
await db.add(`Eco_${GuildID}_${UserID}`, Number(Amount)); | ||
let NewMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (NewMoney === null) NewMoney = "0"; | ||
let Data = { | ||
GuildID: GuildID, | ||
UserID: UserID, | ||
AddedMoney: Amount, | ||
OldMoney: OldMoney, | ||
NewMoney: NewMoney, | ||
Line: `Added ${Amount} To <@${UserID}>!`, | ||
TimeStamp: new Date() | ||
}; | ||
return Data; | ||
}, | ||
RemoveMoney: async function (GuildID, UserID, Amount) { | ||
if (!GuildID) throw new Error(`Please Give Guild ID!`); | ||
await IDCheck(GuildID, "Guild"); | ||
if (!UserID) throw new Error(`Please Give User ID!`); | ||
await IDCheck(UserID, "User"); | ||
if (!Amount) throw new Error(`Please Give Amount!`); | ||
await AmountCheck(Amount); | ||
let OldMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (OldMoney === null) OldMoney = "0"; | ||
if (Amount > OldMoney) throw new Error(`User Does Not Have That Much Money!`); | ||
await db.substr(`Eco_${GuildID}_${UserID}`, Number(Amount)); | ||
let NewMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (NewMoney === null) NewMoney = "0"; | ||
let Data = { | ||
GuildID: GuildID, | ||
UserID: UserID, | ||
RemovedMoney: Amount, | ||
OldMoney: OldMoney, | ||
NewMoney: NewMoney, | ||
Line: `Removed ${Amount} From <@${UserID}>!`, | ||
TimeStamp: new Date() | ||
}; | ||
return Data; | ||
}, | ||
Give: async function (GuildID, UserID, User2ID, Amount) { | ||
if (!GuildID) throw new Error(`Please Give Guild ID!`); | ||
await IDCheck(GuildID, "Guild"); | ||
if (!UserID) throw new Error(`Please Give User ID (Sender Of Money)!`); | ||
await IDCheck(UserID, "User"); | ||
if (!User2ID) throw new Error(`Please Give User 2 ID (Money You Sending To)!`); | ||
await IDCheck(User2ID, "User2"); | ||
if (!Amount) throw new Error(`Please Give Amount!`); | ||
await AmountCheck(Amount); | ||
let OldMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (OldMoney === null) OldMoney = "0"; | ||
await MoneyChecker(OldMoney, "OldMoney"); | ||
if (Amount > OldMoney) throw new Error(`User Does Not Have That Much Money!`); | ||
await db.substr(`Eco_${GuildID}_${UserID}`, Number(Amount)); | ||
await db.add(`Eco_${GuildID}_${User2ID}`, Number(Amount)); | ||
let NewMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (NewMoney === null) NewMoney = "0"; | ||
let Data = { | ||
GuildID: GuildID, | ||
UserID: UserID, | ||
AddedMoney: Amount, | ||
RemovedMoney: Amount, | ||
OldMoney: OldMoney, | ||
NewMoney: NewMoney, | ||
Line: `Removed ${Amount} From <@${UserID}> & Added ${Amount} To <@${User2ID}>`, | ||
TimeStamp: new Date() | ||
}; | ||
return Data; | ||
}, | ||
Work: async function (GuildID, UserID) { | ||
if (!GuildID) throw new Error(`Please Give Guild ID!`); | ||
await IDCheck(GuildID, "Guild"); | ||
if (!UserID) throw new Error(`Please Give User ID!`); | ||
await IDCheck(UserID, "User"); | ||
let Works = [ | ||
@@ -178,2 +306,3 @@ "Artist", | ||
"Gamer", | ||
"Epic Gamer", | ||
"Manager", | ||
@@ -187,5 +316,8 @@ "Youtuber", | ||
"God", | ||
"Painter", | ||
"Actor/Actress", | ||
"Anime Maker (Overpowered)", | ||
"Legendary Warrior", | ||
"Legendary Emoji", | ||
"**__Ultra Legendary Superior God Of Everything__**", | ||
"Legendary Emoji" | ||
]; | ||
@@ -196,8 +328,10 @@ | ||
let Money; | ||
if (RandomWork.toLowerCase() === "Legendary Emoji") { | ||
Money = `500`; | ||
} else if (RandomWork.toLowerCase() === "**__ultra legendary superior god of everything__*") { | ||
Money = `350`; | ||
if (RandomWork.toLowerCase() === "legendary emoji") { | ||
Money = `1200`; | ||
} else if (RandomWork.toLowerCase() === "anime maker (overpowered)") { | ||
Money = `800`; | ||
} else if (RandomWork.toLowerCase() === "**__ultra legendary superior god of everything__**") { | ||
Money = `600`; | ||
} else { | ||
Money = await RandomNumber("301"); | ||
Money = await RandomNumber("451"); | ||
}; | ||
@@ -207,4 +341,5 @@ | ||
if (OldMoney === null) OldMoney = "0"; | ||
await MoneyChecker(OldMoney, "OldMoney"); | ||
await db.add(`Eco_${GuildID}_${UserID}`, Money); | ||
await db.add(`Eco_${GuildID}_${UserID}`, Number(Money)); | ||
@@ -222,3 +357,3 @@ let NewMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
Job: RandomWork, | ||
Line: `You Worked As A ${RandomWork} & Got ${Money}${SpaceInCurrency !== null ? ` ${Currency}` : `${Currency}`}`, | ||
Line: `You Worked As A ${RandomWork} & Got ${Money}`, | ||
TimeStamp: new Date() | ||
@@ -228,3 +363,268 @@ }; | ||
return Data; | ||
}, | ||
Beg: async function (GuildID, UserID) { | ||
if (!GuildID) throw new Error(`Please Give Guild ID!`); | ||
await IDCheck(GuildID, "Guild"); | ||
if (!UserID) throw new Error(`Please Give User ID!`); | ||
await IDCheck(UserID, "User"); | ||
let Gen = await RandomNumber(`501`); | ||
let NoMoney = [ | ||
"No Money For You", | ||
"404 Error: No Money", | ||
"Money Got Deleted, Try Again Later!", | ||
"No Money Thing Exists In Device ❌", | ||
`Something Went Wrong, Try Again Later!`, | ||
"Josh: No Money For You!", | ||
"Kall: **Stop Begging!**", | ||
`Stranger: Go Brrrrrrr!`, | ||
`**For Money, You Need To Work Hard** - Someone` | ||
]; | ||
let Moneyed = [ | ||
`Legendary Emoji: Need Money? No Problem! Take 1000!`, | ||
`Person: Here ${Gen} ;)`, | ||
`You Asked For Money To Your Mom & Got ${Gen}`, | ||
`You Just Checked Your Pocket & You Found ${Gen}`, | ||
`You Just Found ${Gen} From Your Purse!` | ||
] | ||
let Begs = [ | ||
NoMoney[0], | ||
NoMoney[1], | ||
NoMoney[2], | ||
NoMoney[3], | ||
NoMoney[4], | ||
NoMoney[5], | ||
NoMoney[6], | ||
NoMoney[7], | ||
NoMoney[8], | ||
Moneyed[0], | ||
Moneyed[1], | ||
Moneyed[2], | ||
Moneyed[3], | ||
Moneyed[4] | ||
]; | ||
let Be = Begs[Math.floor(Math.random() * Begs.length)]; | ||
let Money; | ||
if (NoMoney.some(N => Be.includes(N))) { | ||
Money = 0; | ||
} else if (Moneyed.some(N => Be.includes(N))) { | ||
Money = Gen; | ||
} else { | ||
Money = 0; | ||
}; | ||
let OldMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (OldMoney === null) OldMoney = "0"; | ||
await MoneyChecker(OldMoney, "OldMoney"); | ||
if (Money > 0) { | ||
await db.add(`Eco_${GuildID}_${UserID}`, Number(Money)); | ||
}; | ||
let NewMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (NewMoney === null) NewMoney = "0"; | ||
let Data = { | ||
GuildID: GuildID, | ||
UserID: UserID, | ||
AddedMoney: Money, | ||
OldMoney: OldMoney, | ||
NewMoney: NewMoney, | ||
BegLine: Be, | ||
Line: Be, | ||
TimeStamp: new Date() | ||
}; | ||
return Data; | ||
}, | ||
Slots: async function (GuildID, UserID, Amount) { | ||
if (!GuildID) throw new Error(`Please Give Guild ID!`); | ||
await IDCheck(GuildID, "Guild"); | ||
if (!UserID) throw new Error(`Please Give User ID!`); | ||
await IDCheck(UserID, "User"); | ||
if (!Amount) throw new Error(`Please Give Amount!`); | ||
await AmountCheck(Amount); | ||
let OldMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (OldMoney === null) OldMoney = "0"; | ||
await MoneyChecker(OldMoney, "OldMoney"); | ||
if (isNaN(OldMoney)) throw new Error(`User Money Is Not A Number!`); | ||
if (OldMoney < 100) throw new Error(`Need 100 To Play Slots!`); | ||
if (Amount > OldMoney) throw new Error(`User Need More Money To Play Slots!`); | ||
let Orders = [ | ||
"🍎", | ||
"🍈", | ||
"🍒" | ||
]; | ||
let Randoms = Orders.sort(() => 0.5 - Math.random()); | ||
let Order = Orders.toString(); | ||
let Random = Randoms.toString(); | ||
let Gen = await RandomNumber(OldMoney); | ||
let Checker; | ||
if (Order === Random) { | ||
Checker = { | ||
Slot: Order, | ||
Failed: false | ||
} | ||
} else { | ||
Checker = { | ||
Slot: Random, | ||
Failed: true | ||
} | ||
}; | ||
if (Checker.Failed === false) { | ||
await db.add(`Eco_${GuildID}_${UserID}`, Number(Gen)); | ||
} else { | ||
await db.substr(`Eco_${GuildID}_${UserID}`, Number(Amount)); | ||
}; | ||
let NewMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (NewMoney === null) NewMoney = "0"; | ||
let Data = { | ||
GuildID: GuildID, | ||
UserID: UserID, | ||
AddedMoney: Checker.Failed === false ? Gen : "0", | ||
OldMoney: OldMoney, | ||
NewMoney: NewMoney, | ||
Slot: Checker.Slot, | ||
Failed: Checker.Failed, | ||
Line: `You ${Checker.Failed === true ? `Lost - ${Amount}` : `Won - ${Gen}`}`, | ||
TimeStamp: new Date() | ||
}; | ||
return Data; | ||
}, | ||
Bet: async function (GuildID, UserID, Amount) { | ||
if (!GuildID) throw new Error(`Please Give Guild ID!`); | ||
await IDCheck(GuildID, "Guild"); | ||
if (!UserID) throw new Error(`Please Give User ID!`); | ||
await IDCheck(UserID, "User"); | ||
if (!Amount) throw new Error(`Please Give Amount!`); | ||
await AmountCheck(Amount); | ||
let OldMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (OldMoney === null) { | ||
throw new Error(`Need Some Money To Play Bet!`); | ||
}; | ||
await MoneyChecker(OldMoney, "OldMoney"); | ||
if (OldMoney < Amount) throw new Error(`User Need More Money Because Amount Is Higher!`); | ||
let Arr = [true, false]; | ||
let Array = Arr[Math.floor(Math.random() * Arr.length)]; | ||
let Gened = Amount + 1; | ||
let Gen = await RandomNumber(Gened); | ||
let Checker; | ||
if (Array === true) { | ||
Checker = { | ||
Got: Gen, | ||
Failed: false | ||
}; | ||
} else { | ||
Checker = { | ||
Removed: Amount, | ||
Failed: true | ||
}; | ||
}; | ||
if (Array === false) { | ||
await db.substr(`Eco_${GuildID}_${UserID}`, Number(Amount)); | ||
} else { | ||
await db.add(`Eco_${GuildID}_${UserID}`, Number(Checker.Got)); | ||
}; | ||
let NewMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (NewMoney === null) NewMoney = "0"; | ||
let Data = { | ||
GuildID: GuildID, | ||
UserID: UserID, | ||
AddedMoney: Checker.Failed === false ? Checker.Got : "0", | ||
RemovedMoney: Checker.Failed === true ? Checker.Removed : "0", | ||
OldMoney: OldMoney, | ||
NewMoney: NewMoney, | ||
Failed: Checker.Failed, | ||
Line: `You ${Checker.Failed === true ? `Lost - ${Amount}` : `Won - ${Checker.Got}`}`, | ||
TimeStamp: new Date() | ||
}; | ||
return Data; | ||
}, | ||
BetAll: async function (GuildID, UserID) { | ||
if (!GuildID) throw new Error(`Please Give Guild ID!`); | ||
await IDCheck(GuildID, "Guild"); | ||
if (!UserID) throw new Error(`Please Give User ID!`); | ||
await IDCheck(UserID, "User"); | ||
let OldMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (OldMoney === null) { | ||
throw new Error(`Need Some Money To Play BetAll!`); | ||
}; | ||
let Arr = [true, false]; | ||
let Array = Arr[Math.floor(Math.random() * Arr.length)]; | ||
let Gened = await Number(OldMoney + 1); | ||
let Gen = await RandomNumber(Gened); | ||
let Checker; | ||
if (Array === true) { | ||
Checker = { | ||
Got: Gen, | ||
Failed: false | ||
}; | ||
} else { | ||
Checker = { | ||
Removed: OldMoney, | ||
Failed: true | ||
}; | ||
}; | ||
if (Array === false) { | ||
await db.set(`Eco_${GuildID}_${UserID}`, null); | ||
} else { | ||
await db.add(`Eco_${GuildID}_${UserID}`, Number(Checker.Got)); | ||
}; | ||
let NewMoney = await (await GetMoney(GuildID, UserID, db)).Money; | ||
if (NewMoney === null) NewMoney = "0"; | ||
let Data = { | ||
GuildID: GuildID, | ||
UserID: UserID, | ||
AddedMoney: Checker.Failed === false ? Checker.Got : "0", | ||
RemovedMoney: Checker.Failed === true ? Checker.Removed : "0", | ||
OldMoney: OldMoney, | ||
NewMoney: NewMoney, | ||
Failed: Checker.Failed, | ||
Line: `You ${Checker.Failed === true ? `Lost - ${NewMoney}` : `Won - ${Checker.Got}`}`, | ||
TimeStamp: new Date() | ||
}; | ||
return Data; | ||
} | ||
}; |
{ | ||
"name": "emo-eco", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Emoji Economy For Discord Bots!", | ||
@@ -16,2 +16,3 @@ "main": "emo-eco.js", | ||
"Discord.js", | ||
"Eco", | ||
"Economy" | ||
@@ -26,5 +27,4 @@ ], | ||
"dependencies": { | ||
"pretty-ms": "^7.0.1", | ||
"wio.db": "^4.0.9" | ||
} | ||
} | ||
} |
@@ -1,11 +0,12 @@ | ||
### Emo Eco | ||
# Emo Eco 😁 | ||
- This Package Is Under Development! | ||
- This Package Is Mainly For Discord Bots (Discord.js) | ||
- Make Sure To Install Wio.db Before Using Package! | ||
- Stable Verison : Not Released | ||
- Full : Emoji Economy | ||
- _**Make Sure To Install [Wio.db](https://www.npmjs.com/package/wio.db) Before Using Package!**_ | ||
- _This Package Is For Discord Bots (Mainly [Discord.js](https://www.npmjs.com/package/discord.js))_ | ||
- _Full : Emoji Economy_ | ||
- Report Bugs, Errors, Problems In [Support Server](https://discord.gg/kG2WAUT) | ||
- Stable Version : [Current Version](https://www.npmjs.com/package/emo-eco) | ||
# Usage | ||
## Usage 📕 | ||
```js | ||
//Discord.js - discord.js.org | ||
const Discord = require("discord.js"); | ||
@@ -16,10 +17,10 @@ const Emo = require("emo-eco"); | ||
client.on("ready", () => { | ||
console.log("Bot Is Ready With Emo-Eco!"); | ||
console.log("Bot Is Ready With Emo-Eco 💖!"); | ||
}); | ||
client.on("message", async message => { | ||
if (message.content.toLowerCase() === "balance") { | ||
let Data = await Emo.Balance(message.guild.id, message.author.id); | ||
return message.channel.send(Data.Money); | ||
} | ||
if (message.content.toLowerCase() === "work") { | ||
let Data = await Emo.Work(message.guild.id, message.author.id); | ||
return message.channel.send(Data.Line); | ||
}; | ||
}); | ||
@@ -31,57 +32,28 @@ | ||
# Why Emo-Eco? | ||
## Why Emo-Eco ❓ | ||
- Fast & Easy To Use | ||
- Stores Data In Json File | ||
- Support | ||
- Stores Data In Json File ([Wio.db](https://www.npmjs.com/package/wio.db)) | ||
- Many Functions (12+) | ||
- Mainly For [Discord.js](https://www.npmjs.com/package/discord.js) Bots | ||
- [Support 69/69](https://discord.gg/kG2WAUT) | ||
Documentation | ||
## Documentation 📖 | ||
- All Functions Return Data As Objects (.<Thing>) | ||
**Daily(GuildID, UserID):** Daily | Add Money To The User (1000, NO COOLDOWN)! | ||
- Link => Scroll Down Or [Click Me (Recommended)](https://bit.ly/34tvqau) | ||
Response : | ||
GuildID, UserID, AddedMoney, OldMoney, NewMoney, TimeStamp | ||
# More 😉 | ||
**SetMoney(GuildID, UserID, Amount):** SetMoney | Set The Money Of User! | ||
_Note : This Package Is Using [Wio.db](https://www.npmjs.com/package/wio.db) (Database)_ | ||
Response : | ||
GuildID, UserID, SettedMoney, OldMoney, NewMoney, TimeStamp | ||
- This Package Is Made With 💖 By Legendary Emoji#1742 | ||
**AddMoney(GuildID, UserID, Amount):** AddMoney | Add Money To The User! | ||
- Donations Will Help Us To Maintain This Package | ||
Response : | ||
GuildID, UserID, AddedMoney, OldMoney, NewMoney, TimeStamp | ||
- Documentation => [Click Me](https://github.com/LegendaryEmoji/emo-eco/wiki) | ||
**RemoveMoney(GuildID, UserID, Amount):** RemoveMoney | Remove Money To The User! | ||
- Support Server => [Click Me](https://discord.gg/kG2WAUT) | ||
Response : | ||
GuildID, UserID, RemovedMoney, OldMoney, NewMoney, TimeStamp | ||
**Balance(GuildID, UserID):** Balance | Show Money Of User! | ||
Response : | ||
GuildID, UserID, Money, TimeStamp | ||
**GetMoney(GuildID, UserID):** GetMoney | Show Money Of User! | ||
Response : | ||
GuildID, UserID, Money, TimeStamp | ||
**Work(GuildID, UserID, Currency, SpaceInCurrency):** Work | Work & Get Paid (NO COOLDOWN)! | ||
Response : | ||
GuildID, UserID, AddedMoney, OldMoney, NewMoney, Work, Job, Line, TimeStamp | ||
# More! | ||
_Note: This Package Is Using Many Websites For Getting Stuff, Thanks To Websites Owners_ | ||
- This Package Is Made With 💖 By Emoji | ||
- Donations Will Help Us To Maintain This Package | ||
- Thank You For Reading & Using This Package ;) | ||
- Patreon (Legendary Emoji) => [Click Me](https://www.patreon.com/LegendaryEmoji) |
@@ -1,2 +0,2 @@ | ||
module.exports = { | ||
module.exports = { //By a dickless person | ||
IDCheck: async function (ID, Type) { | ||
@@ -32,2 +32,16 @@ if (!ID) throw new Error(`Please Give ID That You Want To Check!`); | ||
}, | ||
MoneyChecker: async function(Amount, Type) { | ||
if (!Amount) throw new Error(`Please Give Amount!`); | ||
if (!Type) throw new Error(`Please Give Type - OldMoney, NewMoney`) | ||
if (isNaN(Amount)) throw new Error(`Invalid ${Type} - Data Is Not Number, Clear Database Eco Data!`); | ||
let Data = { | ||
Type: "Amount", | ||
Response: "String", | ||
Amount: Amount, | ||
Done: true | ||
}; | ||
return Data; | ||
}, | ||
GetMoney: async function (GuildID, UserID, Db) { | ||
@@ -43,2 +57,3 @@ if (!GuildID) throw new Error(`Please Give ID Of Guild!`); | ||
let Money = await Db.fetch(`Eco_${GuildID}_${UserID}`); | ||
if (isNaN(Money)) throw new Error(`Invalid Type - Data Is Not Number, Clear Database Eco Data!`) | ||
@@ -54,60 +69,10 @@ let Data = { | ||
}, | ||
CoolDownCheck: async function (UserID, Default, Line, Db) { | ||
if (!UserID) throw new Error(`Please Give ID Of User!`); | ||
if (!Db) throw new Error(`Please Give Your Database Variable!`); | ||
if (!Default) throw new Error(`Please Give Your Default Time In Ms!`); | ||
if (isNaN(Default)) throw new Error(`Please Give Valid Default Time In Ms!`); | ||
if (!Line) throw new Error(`Please Give Your Database Line!`); | ||
let db = Db; | ||
let Data = await db.fetch(`${Line}_${UserID}`); | ||
if (Data.CoolDown && Data.CoolDown === true) { | ||
let Cooldowned = { | ||
UserID: UserID, | ||
CoolDown: true, | ||
CoolDownDate: (Default - (Date.now() - Data.CoolDownTime)).toDateString(), | ||
CoolDownTime: (Default - (Date.now() - Data.CoolDownTime)).toTimeString(), | ||
Date: new Date().toDateString(), | ||
Time: new Date().toTimeString(), | ||
TimeStamp: new Date() | ||
}; | ||
return Cooldowned; | ||
}; | ||
let Checked = { | ||
UserID: UserID, | ||
CoolDown: false, | ||
Date: new Date().toDateString(), | ||
Time: new Date().toTimeString(), | ||
TimeStamp: new Date() | ||
}; | ||
return Checked; | ||
/* | ||
let Seted = { | ||
UserID: UserID, | ||
CoolDown: true, | ||
CoolDownTime: new Date(), | ||
Date: new Date().toDateString(), | ||
Time: new Date().toTimeString(), | ||
TimeStamp: new Date() | ||
}; | ||
await db.set(`${Line}_${UserID}`, Seted); | ||
setTimeout(async () => { | ||
await db.set(`${Line}_${UserID}`, null); | ||
}, 86400000); | ||
*/ | ||
}, | ||
RandomNumber: async function (Amount) { | ||
RandomNumber: async function (Amount, Amount2) { | ||
if (!Amount) throw new Error(`Please Give Amount!`); | ||
if (isNaN(Amount)) throw new Error(`Please Give A Valid Amount!`); | ||
if (!Amount2) return Math.floor(Math.random() * Amount); | ||
if (isNaN(Amount2)) throw new Error(`Please Give A Valid Amount2!`); | ||
return Math.floor(Math.random() * Amount); | ||
return Math.floor(Math.random() * (Amount - Amount2)) + Amount; | ||
} | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26111
1
573
57
1
- Removedpretty-ms@^7.0.1
- Removedparse-ms@2.1.0(transitive)
- Removedpretty-ms@7.0.1(transitive)