File tree 3 files changed +21
-7
lines changed
3 files changed +21
-7
lines changed Original file line number Diff line number Diff line change
1
+ # ID of Twitch application
1
2
TWITCH_CLIENT_ID =
2
- TWITCH_CLIENT_SECRET =
3
+ # Secret of Twitch application
4
+ TWITCH_CLIENT_SECRET =
5
+ # Username of the channel where it will connect and listen for events
6
+ TWITCH_CHANNEL_NAME =
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ The file content of the file should be something similar to this:
57
57
``` env
58
58
TWITCH_CLIENT_ID=theClientIdProvidedByTwitch
59
59
TWITCH_CLIENT_SECRET=aSecretYouHaveToKeepSafe
60
+ TWITCH_CHANNEL_NAME=<username of the Twitch streamer>
60
61
```
61
62
62
63
### Create OAuth2 user token
Original file line number Diff line number Diff line change @@ -2,13 +2,22 @@ import { connect } from "./chatClient";
2
2
import { listen } from "./helpers/webServer" ;
3
3
import { registerUserListener } from "./pubSubClient" ;
4
4
5
- const channel = "alexbcberio" ;
5
+ const LOG_PREFIX = "[APP] " ;
6
+
7
+ const channel = process . env . TWITCH_CHANNEL_NAME ;
6
8
7
9
export async function bootstrap ( ) {
8
- await Promise . all ( [
9
- registerUserListener ( channel ) ,
10
- connect ( [ channel ] ) ,
11
- ] ) ;
10
+ if ( ! channel ) {
11
+ console . error (
12
+ `${ LOG_PREFIX } Missing environment parameter TWITCH_CHANNEL_NAME`
13
+ ) ;
14
+
15
+ const errorCode = 1 ;
16
+
17
+ process . exit ( errorCode ) ;
18
+ }
19
+
20
+ await Promise . all ( [ registerUserListener ( channel ) , connect ( [ channel ] ) ] ) ;
12
21
13
22
listen ( ) ;
14
- }
23
+ }
You can’t perform that action at this time.
0 commit comments