@@ -19,13 +19,13 @@ function Twiliobot(configuration) {
1919 utterances : botkit . utterances ,
2020 } ;
2121
22- bot . send = function ( message , cb ) {
22+ bot . send = function ( message , cb ) {
2323 botkit . debug ( 'SEND ' , message ) ;
2424
2525 bot . api . channels ( message . channel ) . messages . create ( message )
26- . then ( function ( response ) {
26+ . then ( function ( response ) {
2727 cb ( null , response ) ;
28- } ) . catch ( function ( err ) {
28+ } ) . catch ( function ( err ) {
2929 cb ( err ) ;
3030 } ) ;
3131 } ;
@@ -167,7 +167,7 @@ function Twiliobot(configuration) {
167167 return twilio_botkit ;
168168 } ;
169169
170- twilio_botkit . handleWebhookPayload = function ( req , res , bot ) {
170+ twilio_botkit . handleWebhookPayload = function ( req , res , bot ) {
171171 var message = req . body ;
172172 twilio_botkit . ingest ( bot , message , res ) ;
173173 } ;
@@ -220,7 +220,7 @@ function Twiliobot(configuration) {
220220 var channels = bot . channels ;
221221
222222 // if its not in a channel with the bot
223- var apprChan = channels . filter ( function ( ch ) {
223+ var apprChan = channels . filter ( function ( ch ) {
224224 return ch . sid === message . channel ;
225225 } ) ;
226226
@@ -235,7 +235,7 @@ function Twiliobot(configuration) {
235235
236236 if ( bot . identity && message . user === bot . identity ) {
237237 // remove that channel from bot.channels.channels
238- var chan_to_rem = bot . channels . map ( function ( ch ) {
238+ var chan_to_rem = bot . channels . map ( function ( ch ) {
239239 return ch . sid ;
240240 } ) . indexOf ( message . channel ) ;
241241
@@ -249,7 +249,7 @@ function Twiliobot(configuration) {
249249 var channels = bot . channels ;
250250
251251 // if its not in a channel with the bot
252- var apprChan = channels . filter ( function ( ch ) {
252+ var apprChan = channels . filter ( function ( ch ) {
253253 return ch . sid == message . channel ;
254254 } ) ;
255255
@@ -266,17 +266,17 @@ function Twiliobot(configuration) {
266266 } else if ( message . EventType === 'onMemberAdded' ) {
267267
268268 if ( bot . identity && message . user === bot . identity ) {
269- bot . api . channels ( message . channel ) . fetch ( ) . then ( function ( response ) {
269+ bot . api . channels ( message . channel ) . fetch ( ) . then ( function ( response ) {
270270 bot . channels . push ( response ) ;
271271 twilio_botkit . debug ( 'Subscribing to channel because of memberadd.' ) ;
272- } ) . catch ( function ( error ) {
272+ } ) . catch ( function ( error ) {
273273 botkit . log ( error ) ;
274274 } ) ;
275275 } else if ( bot . identity ) {
276276 var channels = bot . channels ;
277277
278278 // if its not in a channel with the bot
279- var apprChan = channels . filter ( function ( ch ) {
279+ var apprChan = channels . filter ( function ( ch ) {
280280 return ch . sid == message . channel ;
281281 } ) ;
282282
@@ -292,26 +292,26 @@ function Twiliobot(configuration) {
292292 }
293293 } else if ( message . EventType === 'onChannelDestroyed' ) {
294294 if ( bot . identity ) {
295- var chan_to_rem = bot . channels . map ( function ( ch ) {
295+ var chan_to_rem = bot . channels . map ( function ( ch ) {
296296 return ch . sid ;
297297 } ) . indexOf ( message . channel ) ;
298298 if ( chan_to_rem !== - 1 ) {
299299 bot . channels . splice ( chan_to_rem , 1 ) ;
300300 twilio_botkit . debug ( 'Unsubscribing from destroyed channel.' ) ;
301301 }
302- message . type = 'channel_destroyed'
302+ message . type = 'channel_destroyed' ;
303303 }
304304 } else if ( message . EventType === 'onChannelAdded' ) {
305305 if ( bot . identity && bot . config . autojoin === true ) {
306306 // join the channel
307307 bot . api . channels ( message . channel ) . members . create ( {
308308 identity : bot . identity
309- } ) . then ( function ( response ) {
310- return bot . api . channels ( message . channel ) . fetch ( ) . then ( function ( response ) {
309+ } ) . then ( function ( response ) {
310+ return bot . api . channels ( message . channel ) . fetch ( ) . then ( function ( response ) {
311311 bot . channels . push ( response ) ;
312312 twilio_botkit . debug ( 'Subscribing to new channel.' ) ;
313- } )
314- } ) . catch ( function ( error ) {
313+ } ) ;
314+ } ) . catch ( function ( error ) {
315315 botkit . log ( error ) ;
316316 } ) ;
317317 message . type = message . EventType ;
0 commit comments