forked from chrisinajar/plugapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrepl.js
More file actions
33 lines (24 loc) · 696 Bytes
/
repl.js
File metadata and controls
33 lines (24 loc) · 696 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
(function() {
var AUTH, PlugAPI, ROOM, bot, repl,
_this = this;
PlugAPI = require("./src/index.js");
repl = require("repl");
AUTH = "YOUR AUTH HERE";
ROOM = "ROOM-URL";
if(AUTH == "YOUR AUTH HERE" || ROOM == "ROOM-URL"){
console.log("You have not configured the repl.");
console.log("Set the AUTH and ROOM variables in repl.js");
process.exit(0);
}
bot = new PlugAPI(AUTH);
bot.connect();
bot.on("connected", function() {
return bot.joinRoom(ROOM);
});
bot.on("roomChanged", function() {
var botrepl;
console.log("[+] Joined " + ROOM);
botrepl = repl.start("bot>");
return botrepl.context.bot = bot;
});
}).call(this);