<commit_before>var Hipchat     =   require('hipchatter'),
    hip         =   new Hipchat(process.env.HIPCHAT_API_V2_KEY),
    rooms       =   process.env.HIPCHAT_ROOM_ID.split('-'),
    roomTokens  =   process.env.HIPCHAT_ROOM_TOKEN.split('-'),
    mentionsVar =   process.env.HIPCHAT_ROOM_MENTION.split('-'),
    params      =   { message_format: 'text', color: 'red', notify: true };

var buildMessage = function (oldScore, newScore){

    var message = '';
    if(oldScore > newScore){
        message += 'Your Klout score has decreased from ' + oldScore + ' to ' + newScore + '.' ;
    }else{
        message += 'Your Klout score has increased from ' + oldScore + ' to ' + newScore + '.' ;
    }

    sendMessage(message);
}


function sendMessage(message){

    params.message = message;

    for(var k=0; k < rooms.length; k++){

        params.token = roomTokens[k];

        if(process.env.HIPCHAT_ROOM_MENTION){
            var mentions = 'Alerting';
            for(var j=0; j < mentionsVar.length; j++){
                mentions += ' @' + mentionsVar[j];
            }

            params.message += mentions;
        }

        hip.notify(rooms[k], params, function(err) {
            if(err){
                console.log(err);
            }else{
                console.log('Score changed!. Message sent to Hipchat room.');
            }
        });
    }


}


module.exports.buildMessage = buildMessage;<commit_msg>standarizing core<commit_after>var Hipchat     =   require('hipchatter'),
    hip         =   new Hipchat(),
    rooms       =   process.env.HIPCHAT_ROOM_ID.split('-'),
    roomTokens  =   process.env.HIPCHAT_ROOM_TOKEN.split('-'),
    mentionsVar =   process.env.HIPCHAT_ROOM_MENTION.split('-'),
    params      =   { color: 'red', notify: true };

var Hiplout = function(){}

Hiplout.prototype = {

    buildMessage: function (oldScore, newScore, callback){

        var message = '';
        if(oldScore > newScore){
            message += 'Your Klout score has decreased from ' + oldScore + ' to ' + newScore + '.' ;
        }else{
            message += 'Your Klout score has increased from ' + oldScore + ' to ' + newScore + '.' ;
        }

        callback(message);
    },


    sendMessage: function(message, callback){

        params.message = message;
        params.message_format = 'text';

        for(var k=0; k < rooms.length; k++){

            params.token = roomTokens[k];

            if(process.env.HIPCHAT_ROOM_MENTION){
                var mentions = 'Alerting';
                for(var j=0; j < mentionsVar.length; j++){
                    mentions += ' @' + mentionsVar[j];
                }

                params.message += mentions;
            }

            hip.notify(rooms[k], params, function(err) {
                if(err) callback('Error notifying room: ' + err);
                else callback('Score changed!. Message sent to Hipchat room.');
            });
        }
    }
}

module.exports = Hiplout;
{'fraction_non_alphanumeric': 0.13618022864828513, 'fraction_numerical': 0.0016812373907195697, 'mean_word_length': 1.972027972027972, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '4568612', 'n_tokens_mistral': 937, 'n_tokens_neox': 893, 'n_words': 186}