<commit_before>function botAPI(params) {
    'use strict';

    params = params || {};

    const bot_VERSION = '0.1.0';
    const bot_REGEX = function () {
        return {
            'order': new RegExp('(' + bot_name + ')[,\\s]+(\\S+)[,\\s]*([\\S+\\s]*)')
        }
    }

    let bot_obj = {};
    let bot_name = params.name || 'Jadebot',
        bot_exp = 0.00,
        bot_conversation = [];

    return bot_obj = {
        order: function (args) {
            return this.action(args);
        },
        action: function (args) {
            if (_.isString(args)) {
                let matches = args.match(bot_REGEX().order);

                return this.actionExecute({
                    'fn': matches[2],
                    'options': _.split(matches[3], /[,\s]+/)
                })
            }
        },
        actionExecute: function (args) {
            let fn = args.fn || 'actionError',
                options = args.options || {};

            if (fn === 'actionNotFound')
                options = {'msg': "Action not found or error executing."};

            return this[fn](options);
        },
        actionError: function (args) {
            return console.error(args.msg);
        },
        getBotExp: function () {
            return bot_exp;
        },
        updateBotExp: function (args) {
            if (args[0] == 'set')
                bot_exp = _.toNumber(args[1]);

            if (args[0] == 'update')
                bot_exp += _.toNumber(args[1]);

            bot_exp = _.round(bot_exp, 2);

            return this.getBotExp();
        },
        createConversation: function () {
            
        }
    };
}<commit_msg>Start conversation functionality<commit_after>function botAPI(params) {
    'use strict';

    params = params || {};

    const bot_VERSION = '0.1.0';
    const bot_REGEX = function () {
        return {
            'order': new RegExp('(' + bot_name + ')[,\\s]+(\\S+)[,\\s]*([\\S+\\s]*)')
        }
    }

    let bot_obj = {};
    let bot_name = params.name || 'Jadebot',
        bot_exp = 0.00,
        bot_conversation = params.conversation || [];

    let currentContext = {};

    return bot_obj = {
        order: function (args) {
            return this.action(args);
        },
        action: function (args) {
            if (_.isString(args)) {
                let matches = args.match(bot_REGEX().order);

                return this.actionExecute({
                    'fn': matches[2],
                    'options': _.split(matches[3], /[,\s]+/)
                })
            }
        },
        actionExecute: function (args) {
            let fn = args.fn || 'actionError',
                options = args.options || {};

            if (fn === 'actionError')
                options = {'msg': "Action not found or error executing."};

            return this[fn](options);
        },
        actionError: function (args) {
            return console.error(args.msg);
        },
        getBotExp: function () {
            return bot_exp;
        },
        updateBotExp: function (args) {
            if (args[0] == 'set')
                bot_exp = _.toNumber(args[1]);

            if (args[0] == 'update')
                bot_exp += _.toNumber(args[1]);

            bot_exp = _.round(bot_exp, 2);

            return this.getBotExp();
        },
        converse: function (args) {
            let response = currentContext.recipient + ", how may I help you?";

            if (_.isString(args)) {
                this.addToConversation([currentContext.recipient, args]);
            }

            if (currentContext.conversationID === undefined) {
                response = this.beginConversation();
            }

            return response;
        },
        beginConversation: function () {
            let conv = {};

            conv.recipient = undefined;
            conv.memory = [{
                'author': bot_name,
                'msg': 'Hello my name is ' + bot_name + ', how may I be of assistance?'
            }];

            bot_conversation.push(conv);
            currentContext.recipient = conv.recipient;
            currentContext.conversationID = bot_conversation.length-1;
            return conv.memory[0].msg;
        },
        addToConversation: function (args) {
            let memoryItem = {};

            memoryItem = {
                'author': args[0],
                'msg': args[1]
            };

            bot_conversation[currentContext.conversationID].memory.push(memoryItem);
        },
        getConversation: function () {
            return console.debug(bot_conversation);
        }
    };
}
{'fraction_non_alphanumeric': 0.14239621423962143, 'fraction_numerical': 0.006453000645300065, 'mean_word_length': 1.456418383518225, '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': '5185762', 'n_tokens_mistral': 1329, 'n_tokens_neox': 1260, 'n_words': 268}