-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
87 lines (59 loc) · 2.4 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/* eslint-disable no-unused-vars */
const Discord = require('discord.js');
const { join, format } = require('path');
const Client = require('./client/client');
const SettingsProvider = require('./client/settings-provider');
const CommandsModule = require('./client/modules/commands');
const config = require('./config.json');
const moment = require('moment');
const { AutoPoster } = require('topgg-autoposter')
require("dotenv").config();
// LTS here just means that moment will
// format the time in [H:M:S AM/PM]
const time = moment().format("LTS")
// to do, trim off the unnecessary guilds and perms
// spoilers i didnt
const clientOptions = {
intents: [
Discord.Intents.FLAGS.GUILDS,
Discord.Intents.FLAGS.GUILD_MESSAGES,
Discord.Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS,
Discord.Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Discord.Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Discord.Intents.FLAGS.DIRECT_MESSAGES,
Discord.Intents.FLAGS.DIRECT_MESSAGE_REACTIONS,
],
};
const settings = new SettingsProvider(config);
const client = new Client(clientOptions, settings);
const commandsModule = new CommandsModule();
commandsModule.loadFromDirectory(join(__dirname, 'commands'));
// sends server count to top.gg
const poster = AutoPoster(config.topggToken, client.client)
poster.on('posted', (stats) => { // ran when succesfully posted
console.log(`Posted stats to Top.gg | ${stats.serverCount} servers`)
})
// ... gets member count
let getMemberCount = () => {
return client.client.guilds.cache.map(g => g.memberCount).reduce((a, b) => a + b);
}
async function bootstrap() {
await client.registerModule('commands', commandsModule);
client.registerEvent('ready', async () => {
// do i really have to explain when this shit runs
console.log(`[${time}] Ready!`);
client.client.user.setActivity(`Should I add AI to Ben and make it sentient?`)
//console.log(`serving ${client.client.guilds.cache.size} mfs [${getMemberCount()}]`)
});
//when mfs add the bot to their server
client.registerEvent('guildCreate', () => {
//console.log(`[${time}] Some mf really added this mf to their server 💀 [${/*client.client.guilds.cache.size*/}] [${getMemberCount()}]`);
});
//when bozos kick ben
client.registerEvent('guildDelete', () => {
console.log(`[${time}] Kicked didnt ask []`);
//${/*client.client.guilds.cache.size*/ }
});
await client.init();
}
bootstrap();