forked from eternum/minecraftBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathejs.js
More file actions
88 lines (82 loc) · 1.5 KB
/
ejs.js
File metadata and controls
88 lines (82 loc) · 1.5 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// load the things we need
const express = require("express");
const app = express();
var bots = {
nickbot: {
name: "nickbot",
status: "Loading",
health: 11,
hunger: 15,
coords: "0 1 0",
server: {
ip: "mc.hackclub.com",
port: "25565",
},
},
boomer: {
name: "boomer",
status: "inUse",
health: 21,
hunger: 45,
coords: "0 3 0",
server: {
ip: "localhost",
port: "12",
},
},
bot1: {
name: "bot1",
status: "Online",
health: 20,
hunger: 20,
coords: "0 0 0",
server: {
ip: "localhost",
port: "121312",
},
},
bot2: {
name: "bot2",
status: "Online",
health: 20,
hunger: 20,
coords: "0 0 0",
server: {
ip: "mc.google.com",
port: "122333",
},
},
bot3: {
name: "bot3",
status: "Online",
health: 20,
hunger: 20,
coords: "0 0 0",
server: {
ip: "google.hackclub.com",
port: "25555565",
},
},
};
var botURLS = ["/nickbot", "/boomer"];
// set the view engine to ejs
app.set("view engine", "ejs");
// use res.render to load up an ejs view file
// index page
app.use(express.static("static"));
app.get("/", function (req, res) {
res.render("index", {
bots: bots,
});
});
// about page
app.get("/login", function (req, res) {
res.render("login");
});
app.get(botURLS, function (req, res) {
res.render("bot", {
bot: bots[req.url.substring(1)],
});
});
app.listen(3000);
console.log("3000 is the magic port");