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 = result.password;
        
        bot.login();
    });
};

bot.login = function(){
    new plugapi({
        "email": bot.email,
        "password": bot.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();
@@ -607,32 +607,194 @@
  required: true%0A
+        %7D,%0A        room: %7B%0A            description: 'Room Name:'.cyan.bold,%0A            message: 'Please enter a valid room'.red.bold,%0A            required: true%0A
         %7D%0A    %7D%0A
@@ -1239,16 +1239,48 @@
 ssword;%0A
+        bot.room = result.room;%0A
         
@@ -1415,16 +1415,42 @@
 password
+,%0A        %22room%22: bot.room
 %0A    %7D, 

Fix conflict