1 |
rakin |
51 |
import BaseEvent from '../../utils/structures/BaseEvent'; |
2 |
|
|
import DiscordClient from '../../client/Client'; |
3 |
|
|
import { runTimeouts } from '../../utils/setTimeout'; |
4 |
rakin |
77 |
import { LogLevel } from '../../services/DebugLogger'; |
5 |
rakin |
148 |
import BannedGuild from '../../models/BannedGuild'; |
6 |
rakin |
77 |
import { exit } from 'process'; |
7 |
rakin |
51 |
|
8 |
|
|
export default class ReadyEvent extends BaseEvent { |
9 |
|
|
constructor() { |
10 |
|
|
super('ready'); |
11 |
|
|
} |
12 |
|
|
|
13 |
|
|
async run(client: DiscordClient) { |
14 |
rakin |
58 |
console.log(`\nLogged in as ${client.user!.tag}!`); |
15 |
rakin |
51 |
client.server.run(); |
16 |
|
|
runTimeouts(); |
17 |
rakin |
58 |
client.startupManager.boot(); |
18 |
rakin |
71 |
client.randomStatus.update(); |
19 |
rakin |
77 |
|
20 |
|
|
for (const guild of client.guilds.cache.toJSON()) { |
21 |
|
|
console.log(guild.id + ' ' + guild.name); |
22 |
|
|
|
23 |
|
|
if (!client.config.props[guild.id]) { |
24 |
|
|
console.log('Unauthorized guilds found! Please run the cli with `guildpurge` command to remove unauthorized guilds.'); |
25 |
|
|
await client.debugLogger.logLeaveJoin(LogLevel.CRITICAL, `Unauthorized guild detected: ${guild.name} [ID: ${guild.id}]`); |
26 |
|
|
exit(-1); |
27 |
|
|
} |
28 |
|
|
} |
29 |
rakin |
51 |
} |
30 |
|
|
} |