11import "dotenv/config" ;
2- import { Client , Collection , LimitedCollection } from "discord.js" ;
32import { MyContext } from "./interfaces" ;
4- import { loadCommands , interactionCreateHandler } from "./handlers/InteractionCreateHandler" ;
5- import { messageHandler } from "./handlers/MessageHandler" ;
6- import { deleteButtonHandler } from "./utils/CommandUtils" ;
3+ import { loadCommands , interactionCreateHandler } from "./handlers/InteractionCreateHandler.js" ;
4+ import { messageHandler } from "./handlers/MessageHandler.js" ;
5+ import { deleteButtonHandler } from "./utils/CommandUtils.js" ;
6+ import {
7+ ActivityType ,
8+ Client ,
9+ Collection ,
10+ GatewayIntentBits ,
11+ LimitedCollection ,
12+ Partials
13+ } from "discord.js" ;
714
815( async function ( ) {
916 const context : MyContext = {
1017 client : new Client ( {
11- intents : [ "GUILDS" , "GUILD_MESSAGES" ] ,
18+ intents : [
19+ GatewayIntentBits . Guilds ,
20+ GatewayIntentBits . GuildMessages
21+ ] ,
1222 presence : {
13- activities : [ { type : "PLAYING" , name : "Read the docs" } ] ,
23+ activities : [ { type : ActivityType . Playing , name : "Read the docs" } ] ,
1424 status : "online" ,
1525 } ,
16- // For DMs, a partial channel object is received, in order to receive dms, CHANNEL partials must be activated
17- partials : [ "CHANNEL" ] ,
26+ // For DMs, a partial channel object is received, in order to
27+ // receive dms, Partials.Channel must be activated
28+ partials : [
29+ Partials . Channel
30+ ] ,
1831 makeCache : ( manager ) => {
1932 //! Disabling these caches will break djs functionality
2033 const unsupportedCaches = [
@@ -30,7 +43,6 @@ import { deleteButtonHandler } from "./utils/CommandUtils";
3043 } ,
3144 } ) ,
3245 commands : {
33- autocompletes : new Collection ( ) ,
3446 buttons : new Collection ( ) ,
3547 selectMenus : new Collection ( ) ,
3648 slashCommands : new Collection ( ) ,
@@ -54,3 +66,15 @@ import { deleteButtonHandler } from "./utils/CommandUtils";
5466
5567 docsBot . login ( process . env . TOKEN ) ;
5668} ) ( ) ;
69+
70+ process . on ( "unhandledRejection" , async ( err ) => {
71+ console . error ( "Top Level Unhandled Promise Rejection:\n" , err )
72+ } )
73+
74+ process . on ( "uncaughtException" , async ( err ) => {
75+ console . error ( "Top Level Uncaught Promise Exception:\n" , err )
76+ } )
77+
78+ process . on ( "uncaughtExceptionMonitor" , async ( err ) => {
79+ console . error ( "Top Level Uncaught Promise Exception (Monitor):\n" , err )
80+ } )
0 commit comments