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
/**
@@ -102,6 +103,23 @@ module.exports = {
102
103
console . error ( "Log channel not found." ) ;
103
104
}
104
105
}
106
+
107
+ let modLogs = { } ;
108
+ if ( fs . existsSync ( logsFilePath ) ) {
109
+ const data = fs . readFileSync ( logsFilePath ) ;
110
+ modLogs = JSON . parse ( data ) ;
111
+ }
112
+
113
+ if ( ! modLogs [ targetUser . id ] ) modLogs [ targetUser . id ] = [ ] ;
114
+
115
+ modLogs [ targetUser . id ] . push ( {
116
+ type : "UnTimeout" ,
117
+ reason : reason ,
118
+ moderator : interaction . user . id ,
119
+ timestamp : Math . floor ( Date . now ( ) / 1000 ) ,
120
+ } ) ;
121
+
122
+ fs . writeFileSync ( logsFilePath , JSON . stringify ( modLogs , null , 2 ) ) ;
105
123
} catch ( error ) {
106
124
console . log ( `There was an error when untimeoutting: ${ error } ` ) ;
107
125
}
You can’t perform that action at this time.
0 commit comments