-
Notifications
You must be signed in to change notification settings - Fork 10
/
test.js
39 lines (33 loc) · 1.08 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const LiveLook = require('./');
let livelook = new LiveLook({
username: 'toadtripler',
password: 'DEFINITELY TRIPLES TOADS',
sharedFolder: './mp3s',
description: 'not responsible for toad-related mutations',
autojoin: [ 'nicotine' ]
});
livelook.on('error', err => console.error(err));
livelook.login((err, res) => {
if (err) {
return console.error(err);
} else if (!res.success) {
return console.log('invalid password lol');
}
livelook.on('sayChatroom', msg => {
if (msg.room) {
console.log(`[${msg.room}] <${msg.username}> ${msg.message}`);
} else {
console.log(`<${msg.username}> ${msg.message}`);
}
});
livelook.on('messageUser', msg => {
console.log(`<${msg.username}> ${msg.message}`);
livelook.messageUser(msg.username, 'hey fug you guy xD');
});
setTimeout(() => {
//livelook.getPeerAddress('frogdoubler', console.log);
livelook.connectToPeerUsername('fourfish', (err, peer) => {
console.log(err, peer);
});
}, 1000);
});