File tree 1 file changed +19
-1
lines changed
1 file changed +19
-1
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
/**
@@ -80,8 +81,25 @@ module.exports = {
80
81
console . error ( "Log channel not found." ) ;
81
82
}
82
83
}
84
+
85
+ let modLogs = { } ;
86
+ if ( fs . existsSync ( logsFilePath ) ) {
87
+ const data = fs . readFileSync ( logsFilePath ) ;
88
+ modLogs = JSON . parse ( data ) ;
89
+ }
90
+
91
+ if ( ! modLogs [ targetUser . id ] ) modLogs [ targetUser . id ] = [ ] ;
92
+
93
+ modLogs [ targetUser . id ] . push ( {
94
+ type : "Unban" ,
95
+ reason : reason ,
96
+ moderator : interaction . user . id ,
97
+ timestamp : Math . floor ( Date . now ( ) / 1000 ) ,
98
+ } ) ;
99
+
100
+ fs . writeFileSync ( logsFilePath , JSON . stringify ( modLogs , null , 2 ) ) ;
83
101
} catch ( error ) {
84
- console . error ( " Error unbanning user:" , error ) ;
102
+ console . error ( ` Error unbanning user:, ${ error } ` ) ;
85
103
await interaction . editReply ( "An error occurred while trying to unban the user." ) ;
86
104
}
87
105
} ,
You can’t perform that action at this time.
0 commit comments