<commit_before>'use strict';

function CategoryMenuResponse() {
}

CategoryMenuResponse.prototype = {
    getResponse: function (categories) {
        var response = {
            attachment: {
                type: "template",
                payload: {
                    template_type: "button",
                    text: "What do you want to do next?",
                    buttons: [
                        {
                            type: "postback",
                            title: "Pizza",
                            payload: "category_1"
                        },
                        {
                            type: "postback",
                            title: "Paste",
                            payload: "category_2"
                        },
                        {
                            type: "postback",
                            title: "Ciorbe",
                            payload: "category_3"
                        }
                    ]
                }
            }
        };
        console.log("1st", response);
        if (categories !== undefined) {
            categories.forEach(function (category) {
                var newButton = {
                    type: "postback",
                    title: category.title,
                    payload: category.name
                };
                response.attachment.payload.buttons.add(newButton);
            });
        }
        console.log("2st", response);
        return JSON.stringify(response);
    }
};

/**
 * @returns {CategoryMenuResponse}
 */
module.exports.getInstance = function () {
    return new CategoryMenuResponse();
};<commit_msg>read categories from api<commit_after>'use strict';

function CategoryMenuResponse() {
}

CategoryMenuResponse.prototype = {
    getResponse: function (categories) {
        var response = {
            attachment: {
                type: "template",
                payload: {
                    template_type: "button",
                    text: "What do you want to do next?",
                    buttons: [
                        {
                            type: "postback",
                            title: "Pizza",
                            payload: "category_1"
                        },
                        {
                            type: "postback",
                            title: "Paste",
                            payload: "category_2"
                        },
                        {
                            type: "postback",
                            title: "Ciorbe",
                            payload: "category_3"
                        }
                    ]
                }
            }
        };
        console.log("1st", response);
        if (categories !== undefined) {
            categories.forEach(function (category) {
                var newButton = {
                    type: "postback",
                    title: category.title,
                    payload: category.name
                };
                console.log("new button", newButton);
                response.attachment.payload.buttons.add(newButton);
            });
        }
        console.log("2st", response);
        return JSON.stringify(response);
    }
};

/**
 * @returns {CategoryMenuResponse}
 */
module.exports.getInstance = function () {
    return new CategoryMenuResponse();
};
{'fraction_non_alphanumeric': 0.0964317310527868, 'fraction_numerical': 0.002948982601002654, 'mean_word_length': 0.9142212189616253, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2260718', 'n_tokens_mistral': 755, 'n_tokens_neox': 713, 'n_words': 146}