@@ -7,7 +7,6 @@ const StateHandler = require("./handlers/StateHandler.js");
77const CommandHandler = require ( "./CommandHandler.js" ) ;
88const config = require ( "../../config.json" ) ;
99const Logger = require ( ".././Logger.js" ) ;
10- const path = require ( "node:path" ) ;
1110const fs = require ( "fs" ) ;
1211
1312class DiscordManager extends CommunicationBridge {
@@ -24,7 +23,12 @@ class DiscordManager extends CommunicationBridge {
2423 connect ( ) {
2524 global . imgurUrl = "" ;
2625 global . client = new Client ( {
27- intents : [ GatewayIntentBits . Guilds , GatewayIntentBits . GuildMessages , GatewayIntentBits . MessageContent ] ,
26+ intents : [
27+ GatewayIntentBits . Guilds ,
28+ GatewayIntentBits . GuildMessages ,
29+ GatewayIntentBits . MessageContent ,
30+ GatewayIntentBits . GuildMembers ,
31+ ] ,
2832 } ) ;
2933
3034 this . client = client ;
@@ -48,12 +52,9 @@ class DiscordManager extends CommunicationBridge {
4852 client . commands . set ( command . name , command ) ;
4953 }
5054
51- const eventsPath = path . join ( __dirname , "events" ) ;
52- const eventFiles = fs . readdirSync ( eventsPath ) . filter ( ( file ) => file . endsWith ( ".js" ) ) ;
53-
55+ const eventFiles = fs . readdirSync ( "src/discord/events" ) . filter ( ( file ) => file . endsWith ( ".js" ) ) ;
5456 for ( const file of eventFiles ) {
55- const filePath = path . join ( eventsPath , file ) ;
56- const event = require ( filePath ) ;
57+ const event = require ( `./events/${ file } ` ) ;
5758 event . once
5859 ? client . once ( event . name , ( ...args ) => event . execute ( ...args ) )
5960 : client . on ( event . name , ( ...args ) => event . execute ( ...args ) ) ;
0 commit comments