gambling-system
v2.0.1
Published
Create a gambling system using JSON easily.
Downloads
2
Maintainers
Readme
Requirements :
- [x] fs
- [x] A JSON file. (In this case is named
coins.json
)
So you take an idea, This is mostly thinked to be used with WebSockets unique IDs or **Discord users IDs. To create each profile you need an ID, or a name to organize.
'ID': {coins: 100, bank: 100}
Commands :
Commands | Use
------------ | -------------
Gambling.create(ID_or_name, defaultCoins, defaultBank);
| Creates a profile with an ID of ID_or_name
, and with default defaultCoins
, and defaultBank
Gambling.add(ID_or_name, coinsToAdd);
| Adds coinsToAdd
to the ID_or_name
profile.
Gambling.remove(ID_or_name, coinsToRemove);
| Removes coinsToRemove
to the ID_or_name
profile.
Gambling.withdraw('force or verify', ID_or_name);
| Removes coinsToWithdraw
from ID_or_name
profile's bank and add them to the default 'Wallet'.
|_ | PD : For first argument you need to put 'force' or 'verify'. Force will change the value without checking, and verify will check the user has the coins to withdraw.
To intialze gambling-system
first write this code at the top of your main file.
let QuickGambling = require('gambling-system');
const Gambling = new QuickGambling.system.currency('./coins.json');
To create a profile with an ID or name you need to use write this :
// Guide :
Gambling.create(ID_or_name, defaultCoins, defaultBank);
// In use :
Gambling.create(socket.id, 50, 0);
- ID_or_name :
- You can plug in a name or a unique number.
- defaultCoins :
- You can plug in the amount of coins the user will have when the profile is created.
- defaultBank :
- You can plug in the amount of coins the user will on his bank when the profile is created.
- coinsToAdd :
- You can plug in the amount of coins will be added to a ID_or_name's profile.
- coinsToRemove :
- You can plug in the amount of coins will be removed from ID_or_name's profile.