File tree 4 files changed +13
-7
lines changed
4 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 1
1
node_modules /
2
2
output /
3
+ token.txt
Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ A bot that turns Slack into a legitimate Texas Hold'em client. Start a game in a
5
5
6
6
### Getting Started
7
7
1 . Create a new [ bot integration] ( https://my.slack.com/services/new/bot )
8
- 1 . Add your API token to ` main.js `
8
+ 1 . Paste the API token from your integration into ` main.js ` _ OR_
9
+ 1 . Create a ` token.txt ` file and paste your API token there
9
10
1 . ` npm install `
10
11
1 . ` node src/main.js `
11
12
1 . To start a game, ` @<your_bot_name>: Deal `
Original file line number Diff line number Diff line change @@ -14,11 +14,7 @@ class Bot {
14
14
//
15
15
// token - An API token from the bot integration
16
16
constructor ( token ) {
17
- if ( token === 'YOUR-TOKEN-GOES-HERE' ) {
18
- throw new Error ( 'Use a valid API token!' ) ;
19
- } else {
20
- this . slack = new Slack ( token , true , true ) ;
21
- }
17
+ this . slack = new Slack ( token , true , true ) ;
22
18
}
23
19
24
20
// Public: Brings this bot online and starts handling messages sent to it.
Original file line number Diff line number Diff line change 1
1
require ( 'babel/register' ) ;
2
2
3
+ try {
4
+ var fs = require ( 'fs' ) ;
5
+ var token = fs . readFileSync ( 'token.txt' , 'utf8' ) . trim ( ) ;
6
+ } catch ( error ) {
7
+ console . log ( "Your API token should be placed in a 'token.txt' file, which is missing." ) ;
8
+ return ;
9
+ }
10
+
3
11
var Bot = require ( './bot' ) ;
4
- var bot = new Bot ( 'YOUR-TOKEN-GOES-HERE' ) ;
12
+ var bot = new Bot ( token ) ;
5
13
bot . login ( ) ;
You can’t perform that action at this time.
0 commit comments