File tree 1 file changed +18
-0
lines changed
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ const fs = require("fs");
9
9
const path = require ( "path" ) ;
10
10
11
11
const logChannelsPath = path . join ( __dirname , "../logChannels.json" ) ;
12
+ const logsFilePath = path . join ( __dirname , "../modlogs.json" ) ;
12
13
13
14
module . exports = {
14
15
/**
@@ -100,6 +101,23 @@ module.exports = {
100
101
console . error ( "Log channel not found." ) ;
101
102
}
102
103
}
104
+
105
+ let modLogs = { } ;
106
+ if ( fs . existsSync ( logsFilePath ) ) {
107
+ const data = fs . readFileSync ( logsFilePath ) ;
108
+ modLogs = JSON . parse ( data ) ;
109
+ }
110
+
111
+ if ( ! modLogs [ targetUser . id ] ) modLogs [ targetUser . id ] = [ ] ;
112
+
113
+ modLogs [ targetUser . id ] . push ( {
114
+ type : "Kick" ,
115
+ reason : reason ,
116
+ moderator : interaction . user . id ,
117
+ timestamp : Math . floor ( Date . now ( ) / 1000 ) ,
118
+ } ) ;
119
+
120
+ fs . writeFileSync ( logsFilePath , JSON . stringify ( modLogs , null , 2 ) ) ;
103
121
} catch ( error ) {
104
122
console . log ( `There was an error when kicking: ${ error } ` ) ;
105
123
await interaction . editReply ( "An error occurred while trying to kick the user." ) ;
You can’t perform that action at this time.
0 commit comments