mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: better error handling
This commit is contained in:
1 parent
c494331470
commit
48241bd0d4
12 files changed
+347
-106
No files matched your search
+6
-10
@@ -1,5 +1,5 @@
|
||||
import { Client, GatewayIntentBits } from 'discord.js';
|
||||
import cleanup, { EXIT_EVENT_NAMES } from './behaviors/cleanup.js';
|
||||
import { registerErrorHandlers } from './behaviors/error.js';
|
||||
import guildMemberAdd from './behaviors/guildMemberAdd.js';
|
||||
import interactionCreate from './behaviors/interactionCreate.js';
|
||||
import ready from './behaviors/ready.js';
|
||||
@@ -13,12 +13,8 @@ const client = new Client({
|
||||
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers],
|
||||
});
|
||||
|
||||
client.on('error', console.error);
|
||||
client.on('ready', ready);
|
||||
client.on('guildMemberAdd', guildMemberAdd);
|
||||
client.on('interactionCreate', interactionCreate);
|
||||
client.login(process.env.DISCORD_TOKEN);
|
||||
|
||||
EXIT_EVENT_NAMES.forEach((exitEventName) =>
|
||||
process.on(exitEventName, () => cleanup(client)),
|
||||
);
|
||||
registerErrorHandlers(client)
|
||||
.on('ready', ready)
|
||||
.on('guildMemberAdd', guildMemberAdd)
|
||||
.on('interactionCreate', interactionCreate)
|
||||
.login(process.env.DISCORD_TOKEN);
|
||||
Reference in new issue
Block a user