-
Notifications
You must be signed in to change notification settings - Fork 1
/
bot.js
44 lines (35 loc) · 1.09 KB
/
bot.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
"use strict";
console.clear()
require("dotenv").config();
const Discord = require("discord.js");
const client = new Discord.Client({
intents: [
"GUILDS",
"GUILD_MEMBERS",
"GUILD_EMOJIS_AND_STICKERS",
"GUILD_MESSAGES",
],
});
module.exports = client;
client.ArrayOfApplicationCommands = new Discord.Collection();
require("./handler")(client);
client.login(process.env.TOKEN);
const express = require('express')
const app = express()
const port = 1025
app.get('/stats', (req, res) => {
const format = `de`
const servers = new Intl.NumberFormat(format).format(client.guilds.cache.size)
const users = new Intl.NumberFormat(format).format(client.guilds.cache.reduce((a, g) => a + g.memberCount, 0))
const averageUsers = new Intl.NumberFormat(format).format(((client.guilds.cache.reduce((a, g) => a + g.memberCount, 0)) / client.guilds.cache.size).toFixed(0))
const json = {
bot: client.user.username,
servers: servers,
users: users,
averageUsers: averageUsers,
}
res.send(json)
})
app.listen(port, () => {
console.log(`API launched on port ${port}`)
})