diff --git a/skills/slash_commands.js b/skills/slash_commands.js index 83272c4..c4ff992 100644 --- a/skills/slash_commands.js +++ b/skills/slash_commands.js @@ -296,23 +296,28 @@ function getFlags(controller, bot, message, cb) { } function logOut(controller, bot, message){ - let user = message.user_id - // console.log(user) - var userChannels = [] - bot.api.channels.list({token:bot.config.token}, function(err,response){ - response.channels.forEach((item) => { - if(item.members.includes(user)){ - userChannels.push(item.id) - // console.log("channels: "+ userChannels) - } - }) - userChannels.forEach((channel)=> { - bot.api.channels.leave({token:bot.config.bot.app_token, channel: channel, user: user}, function(err,response){ - // console.log(err, response) - }) - }) - bot.replyPublic(message, 'You have logged out! Thank you so much for volunteering your time - you are so appreciated!') - }) + let user = message.user_id + // console.log(user) + var userChannels = [] + bot.api.channels.list( + {token:bot.config.bot.app_token}, + (err,response) => { + response.channels.forEach((item) => { + if(item.members.includes(user)){ + userChannels.push(item.id) + // console.log("channels: "+ userChannels) + } + }) + userChannels.forEach((channel) => { + bot.api.channels.leave({ + token:bot.config.bot.app_token, + channel: channel, + user: user}, (err,response) => { + // console.log(err, response) + }) + }) + bot.replyPublic(message, 'You have logged out! Thank you so much for volunteering your time - you are so appreciated!') + }) }