Created
April 19, 2014 06:01
-
-
Save raa0121/11075514 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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