Skip to content

Instantly share code, notes, and snippets.

@raa0121
Created April 19, 2014 06:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raa0121/11075514 to your computer and use it in GitHub Desktop.
Save raa0121/11075514 to your computer and use it in GitHub Desktop.
var PlugAPI = require('plugapi'),
AUTH = 'BmzRZ0J6sYBAUC3/7C1o4gzZlU8=?_expires=STE0MTIwNDg2NjcKLg==&user_id=Uyc1MzNjZDkxYjNiNzkwMzdiYWI1M2Q5ZDknCnAxCi4=',
ROOM = 'lingr';
var bot = new PlugAPI(AUTH);
bot.connect(ROOM);
bot.on('roomJoin', function(room) {
console.log("Joined " + room);
});
bot.on('chat', function(data) {
if (data.type == 'emote')
console.log(data.from+data.message);
else
console.log(data.from+"> "+data.message);
});
var reconnect = function() { bot.connect(ROOM); };
bot.on('close', reconnect);
bot.on('error', reconnect);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment