async function playGame()

in chat-bot/bot/bot.js [166:177]


async function playGame(intentRequest) {
    const sessionAttributes = intentRequest.sessionAttributes || {};
    const slots = intentRequest.currentIntent.slots;

    if (Object.keys(sessionAttributes).length == 0) {
        return await startGame(intentRequest);
    } else if (parseInt(sessionAttributes.currentQuestion, 10) < MAX_QUESTIONS) {
        return await nextQuestion(intentRequest);
    } else {
        return await finishGame(intentRequest);
    }
}