<commit_before>var prompt = require('prompt');
var plugapi = require('plugapi');

prompt.message = '';
prompt.delimiter = '';

var credentials_schema = {
    properties: {
        email: {
            description: 'Email:'.cyan.bold,
            pattern: /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
            message: 'Please enter a valid emailadress'.red.bold,
            required: true
        },
        password: {
            description: 'Password:'.cyan.bold,
            hidden: true,
            required: true
        }
    }
};

var bot = {};

bot.init = function(){
    console.log('Please enter the login credentials for the bot:');
    
    prompt.get(credentials_schema, function(err, result){
        if(err){ console.log(err); return; }
        
        bot.email = result.email;
        bot.password = <PASSWORD>;
        
        bot.login();
    });
};

bot.login = function(){
    new plugapi({
        "email": bot.email,
        "password": <PASSWORD>
    }, function(api){
        bot.api = api;
    });
    
    var i = 0;
    
    process.stdout.write('Connecting');
    
    (function check(){
        if(bot.api === undefined){
            if(i++ < 10){
                process.stdout.write('.');
                setTimeout(check, 1000);
            } else {
                console.log('\nCould not login with the credentials you supplied.');
                bot.init();
            }
        } else {
            bot.connect();
        }
    })();
};

bot.connect = function(){
    console.log('\nYou has been LOGGED IN bitch!');
};

prompt.start();

bot.init();<commit_msg>Added ability to join rooms<commit_after>var prompt = require('prompt');
var plugapi = require('plugapi');

prompt.message = '';
prompt.delimiter = '';

var credentials_schema = {
    properties: {
        email: {
            description: 'Email:'.cyan.bold,
            pattern: /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
            message: 'Please enter a valid emailadress'.red.bold,
            required: true
        },
        password: {
            description: 'Password:'.cyan.bold,
            hidden: true,
            required: true
        }
    }
};

var room_schema = {
    properties: {
        room: {
            description: 'Room:'.cyan.bold,
            required: true
        }
    }
};

var bot = {};

bot.init = function(){
    console.log('Please enter the login credentials for the bot:');
    
    prompt.get(credentials_schema, function(err, result){
        if(err){ console.log(err); return; }
        
        bot.email = result.email;
        bot.password = <PASSWORD>;
        
        bot.login();
    });
};

bot.login = function(){
    new plugapi({
        "email": bot.email,
        "password": <PASSWORD>.password
    }, function(api){
        bot.api = api;
    });
    
    var i = 0;
    
    process.stdout.write('Connecting');
    
    (function check(){
        if(bot.api === undefined){
            if(i++ < 10){
                process.stdout.write('.');
                setTimeout(check, 1000);
            } else {
                console.log('\nCould not login with the credentials you supplied.');
                bot.init();
            }
        } else {
            bot.connect();
        }
    })();
};

bot.connect = function(){
    prompt.get(room_schema, function(err, result){
        if(err){ console.log(err); return; }
        
        bot.room = result.roomd;
        
        bot.api.connect(result.room);
    });
};

prompt.start();

bot.init();
{'fraction_non_alphanumeric': 0.20207944548120502, 'fraction_numerical': 0.01386296987470008, 'mean_word_length': 1.7406866325785244, 'pattern_counts': {'":': 4, '<': 13, '<?xml version=': 0, '>': 11, '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': '1380768', 'n_tokens_mistral': 1226, 'n_tokens_neox': 1194, 'n_words': 214}