The code that is reused across lightbot-discord and lightbot-mastoton
- JavaScript 100%
|
|
||
|---|---|---|
| tests | update tests to use the new structure | |
| .gitignore | [cleanup] moved test stuff to tests/ folder | |
| index.js | no need for Class | |
| LICENSE | Create LICENSE | |
| LightGrid.js | [minor] add functions for symmetry (but still unused) | |
| LightPicture.js | LightPicture constructor have some safeties against empty path | |
| package-lock.json | 0.2.0 | |
| package.json | 0.2.0 | |
| Player.js | [wip] First commit of the PlayerManager stuff | |
| PlayerManager.js | [cleanup] less warning in console | |
| README.md | update readme with more instructions | |
Lightbot-util (Library)
The Library that generates the pictures for Lightbot, and also manage the player database.
Used by:
- Lightbot for Mastodon
- and soon by Lightbot for Discord
Installation:
npm install git://github.com/narFnarF/lightbot-util.git#v0.1.1
Usage:
Initialize:
const pm = require('lightbot-util').PlayerManager;
pm.init("path/to/file.json", "admin id"); //
PlayerManager.getOrCreatePlayer()
Will get the player if it exists or create a new one if it doesn't.
args:
- userID: string
- name : string
Returns: Player
const player = pm.getOrCreatePlayer("123456", "Toto");
console.log(`Player name:${player.name}.`); // Player name: Toto
console.log(`Player level: ${player.level}.`); // Player level: 1
console.log(player.allowedToPlay()); //true
Player.allowedToPlay()
As the player waited long enough to play again?
Returns : boolean