1
0
Fork
You've already forked lightbot-util
0
The code that is reused across lightbot-discord and lightbot-mastoton
  • JavaScript 100%
Find a file
2020年05月17日 22:13:22 -04:00
tests update tests to use the new structure 2019年07月15日 23:36:34 -04:00
.gitignore [cleanup] moved test stuff to tests/ folder 2019年07月14日 22:42:02 -04:00
index.js no need for Class 2019年07月15日 23:32:24 -04:00
LICENSE Create LICENSE 2019年07月13日 18:53:05 -04:00
LightGrid.js [minor] add functions for symmetry (but still unused) 2020年01月12日 21:00:10 -05:00
LightPicture.js LightPicture constructor have some safeties against empty path 2019年07月15日 23:27:04 -04:00
package-lock.json 0.2.0 2020年05月17日 22:13:22 -04:00
package.json 0.2.0 2020年05月17日 22:13:22 -04:00
Player.js [wip] First commit of the PlayerManager stuff 2019年07月13日 23:06:49 -04:00
PlayerManager.js [cleanup] less warning in console 2019年07月14日 22:29:33 -04:00
README.md update readme with more instructions 2020年05月17日 22:12:22 -04:00

Lightbot-util (Library)

The Library that generates the pictures for Lightbot, and also manage the player database.

Used by:

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