/[sudobot]/trunk/src/events/ready/ReadyEvent.ts
ViewVC logotype

Contents of /trunk/src/events/ready/ReadyEvent.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 372 - (show annotations)
Mon Jul 29 17:29:50 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: application/typescript
File size: 1123 byte(s)
fix(errors): error handler
1 import BaseEvent from '../../utils/structures/BaseEvent';
2 import DiscordClient from '../../client/Client';
3 import { runTimeouts } from '../../utils/setTimeout';
4 import { LogLevel } from '../../services/DebugLogger';
5 import { exit } from 'process';
6
7 export default class ReadyEvent extends BaseEvent {
8 constructor() {
9 super('ready');
10 }
11
12 async run(client: DiscordClient) {
13 console.log(`\nLogged in as ${client.user!.tag}!`);
14 await client.server.run();
15
16 runTimeouts();
17 client.startupManager.boot();
18 client.randomStatus.update();
19
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 }
30 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26