I'm trying to pull users data and than use returned result in another function. I'm trying to implement it using async/await but with no success.
const userAllowedToDeploy = (user_id, project) => {
controller.storage.users.get(user_id, async function(err, user) {
result = await (some calculations related to returned user here);
return result;
});
});
controller.hears(['^deploy (\\w+)'], 'direct_mention, mention', function(bot, message) {
let channel = message.channel;
let project = message.match[1];
result = userAllowedToDeploy(message.user, project)
console.log('final result: ' + result);
But for some reason final result is undefined