slack-robot-state
slack-robot plugin to enable state management
Installing
You need to install slack-robot (if you still use npm version 2, it will be installed for you because it's listed as peer dependencies)
$ npm install slack-robot slack-robot-state --save
Usage
Specify path where you want to store the state
var SlackRobot = ;var state = ;var robot = 'slack-token'; // if the file doesn't exist, it will be created for youvar statePath = '/path/to/your/state/file.json';var pluginState = ; // or specify default statevar defaultState = attack: 2 defense: 50 ;var pluginState = ; // enable pluginrobot; // start using itrobot; if robotstatekey === 'value' // do something // reset state to default// if defaultState is not specified on init, it will use an empty objectrobot;
License
MIT