-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
65 lines (54 loc) · 1.8 KB
/
index.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
const http = require('http');
const express = require('express');
const app = express();
app.get("/", (request, response) => {
console.log(Date.now() + " Ping Received");
response.send(`Website is online! Use https://uptimerobot.com/ to make it 24/7!`)
});
app.listen(process.env.PORT);
setInterval(() => {
http.get(`http://${process.env.PROJECT_DOMAIN}.repl.co/`); // so, if you are using glitch or another hosting prover change the repl.co to whatever host you're using.
}, 280000);
const Discord = require("discord.js");
const fs = require("fs");
const client = new Discord.Client();
const config = require("./config.json"); // config.json is where you will put your token and prefix.
client.config = config;
client.on('ready', () => {
client.user.setStatus("available");
let statuses = [
"The worlds simplist Discord Bot (I hope)", // you can remove the credits, idm.
"github.com/oofquest btw",
"Simple.",
"github.com/oofquest/discord-bot"
];
let x = 0;
setInterval(() => {
if (x === 3) {
x = 0;
} else {
x = x + 1;
}
let status = statuses[x];
client.user.setActivity(status);
}, 10000);
fs.readdir("./events/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
const event = require(`./events/${file}`);
let eventName = file.split(".")[0];
client.on(eventName, event.bind(null, client));
});
});
client.commands = new Discord.Collection();
fs.readdir("./commands/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
if (!file.endsWith(".js")) return;
let props = require(`./commands/${file}`);
let commandName = file.split(".")[0];
console.log(`I've loaded the ${commandName}!`);
client.commands.set(commandName, props);
});
});
client.login(config.token);