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 @@ -10,6 +10,7 @@ const fs = require("fs");
10
10
const path = require ( "path" ) ;
11
11
12
12
const logChannelsPath = path . join ( __dirname , "../logChannels.json" ) ;
13
+ const logsFilePath = path . join ( __dirname , "../modlogs.json" ) ;
13
14
14
15
module . exports = {
15
16
/**
@@ -125,6 +126,23 @@ module.exports = {
125
126
console . error ( "Log channel not found." ) ;
126
127
}
127
128
}
129
+
130
+ let modLogs = { } ;
131
+ if ( fs . existsSync ( logsFilePath ) ) {
132
+ const data = fs . readFileSync ( logsFilePath ) ;
133
+ modLogs = JSON . parse ( data ) ;
134
+ }
135
+
136
+ if ( ! modLogs [ targetUser . id ] ) modLogs [ targetUser . id ] = [ ] ;
137
+
138
+ modLogs [ targetUser . id ] . push ( {
139
+ type : "Timeout" ,
140
+ reason : reason ,
141
+ moderator : interaction . user . id ,
142
+ timestamp : Math . floor ( Date . now ( ) / 1000 ) ,
143
+ } ) ;
144
+
145
+ fs . writeFileSync ( logsFilePath , JSON . stringify ( modLogs , null , 2 ) ) ;
128
146
} catch ( error ) {
129
147
console . log ( `There was an error when timing out: ${ error } ` ) ;
130
148
}
You can’t perform that action at this time.
0 commit comments