-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbot.js
More file actions
24 lines (20 loc) · 951 Bytes
/
bot.js
File metadata and controls
24 lines (20 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var PlugAPI = require('./plugapi'); // git clone (or unzip) into the same directory as your .js file. There should be plugapi/package.json, for example (and other files)
var ROOM = 'chillout-mixer-ambient-triphop';
//Plug changed the update code again, as well as how it is stored, which broke my static method which could be used to get it. So, for now, it must be hardcoded.
Current update code: h90
// Instead of providing the AUTH, you can use this static method to get the AUTH cookie via twitter login credentials:
PlugAPI.getAuth({
username: 'PlugBotCity3',
password: 'goodboy'
}, function(err, auth) { // if err is defined, an error occurred, most likely incorrect login
if(err) {
console.log("An error occurred: " + err);
return;
}
var bot = new PlugAPI(auth, '4w@fWs$');
bot.connect(ROOM);
}
bot.on('chat', function (data) {
if (data.type == 'userJoin')
bot.chat("Welcome!" + @ username);
});