File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 1
- var HTTPS = require ( 'https' ) ;
1
+ let HTTPS = require ( 'https' ) ;
2
2
3
3
const botID = process . env . BOT_ID ;
4
4
@@ -8,7 +8,7 @@ const options = {
8
8
method : 'POST'
9
9
} ;
10
10
11
- var body = {
11
+ let body = {
12
12
bot_id : botID ,
13
13
text : "" ,
14
14
attachments : {
@@ -39,7 +39,7 @@ const imageURLs = [
39
39
const activationPhrase = "Activate that sucka!" ;
40
40
41
41
function respond ( ) {
42
- var request = JSON . parse ( this . req . chunks [ 0 ] ) ;
42
+ let request = JSON . parse ( this . req . chunks [ 0 ] ) ;
43
43
44
44
if ( request . text && request . text === activationPhrase ) {
45
45
this . res . writeHead ( 200 ) ;
@@ -53,15 +53,15 @@ function getRandomIndex(arr) {
53
53
}
54
54
55
55
function postMessage ( ) {
56
- var botResponse = quotes [ getRandomIndex ( quotes ) ] ;
57
- var imageURL = imageURLs [ getRandomIndex ( imageURLs ) ] ;
56
+ let botResponse = quotes [ getRandomIndex ( quotes ) ] ;
57
+ let imageURL = imageURLs [ getRandomIndex ( imageURLs ) ] ;
58
58
59
59
body . text = botResponse ;
60
60
body . attachments . url = imageURL ;
61
61
62
62
console . log ( 'sending ' + botResponse + ' to ' + botID ) ;
63
63
64
- var botReq = HTTPS . request ( options , function ( res ) {
64
+ let botReq = HTTPS . request ( options , function ( res ) {
65
65
if ( res . statusCode != 202 ) {
66
66
console . log ( 'rejecting bad status code ' + res . statusCode ) ;
67
67
}
You can’t perform that action at this time.
0 commit comments