forked from pajlada/plugAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrepl.js
More file actions
34 lines (24 loc) · 847 Bytes
/
Copy pathrepl.js
File metadata and controls
34 lines (24 loc) · 847 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
25
26
27
28
29
30
31
32
33
34
(function() {
var AUTH, PlugAPI, ROOM, UPDATECODE, bot, repl;
PlugAPI = require('./src/client.js');
repl = require('repl');
AUTH = 'YOUR AUTH HERE';
ROOM = 'ROOM-URL';
UPDATECODE = 'UPDATECODE';
if (AUTH == 'YOUR AUTH HERE' || ROOM == 'ROOM-URL' || UPDATECODE == 'UPDATECODE') {
console.log('You have not configured the repl.');
console.log('Set the AUTH, ROOM and UPDATECODE variables in repl.js');
process.exit(0);
}
bot = new PlugAPI(AUTH, UPDATECODE);
bot.connect(ROOM);
bot.on('connected', function() {
console.log('[+] Connected to server');
});
bot.on('roomChanged', function() {
var botrepl;
console.log('[+] Joined ' + ROOM);
botrepl = repl.start('bot>');
return botrepl.context.bot = bot;
});
}).call(this);