-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
44 lines (36 loc) · 1.16 KB
/
main.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
40
41
42
43
44
/* This section of code is used by the install and setup guides, if you modify it make sure you still are hosting a webpage (seen in "show") or Uptime Robot will stop working */
const express = require("express");
const router = express.Router();
const discordBotkit = require("botkit-discord");
const discordBot = require("./bot");
router.get("/guide", function(request, response) {
response.sendFile(__dirname + "/views/index.html");
});
router.get("/domainname", function(request, response) {
let domain = process.env.PROJECT_DOMAIN;
response.status(200).json({
message: domain
});
});
router.get("/botinfo", async function(request, response) {
let authURL;
let domain = process.env.PROJECT_DOMAIN;
let uptime = process.uptime();
try {
authURL =
"https://discordapp.com/api/oauth2/authorize?client_id=" +
discordBot.config.client.user.id +
"&permissions=0&scope=bot";
} catch (e) {
console.error(e);
}
response.status(200).json({
url: authURL,
domain: domain,
uptime: uptime
});
});
router.get("/", function(request, response) {
response.sendFile(__dirname + "/views/index.html");
});
module.exports = router;