Skip to content

Commit fceb97c

Browse files
authored
Updated kick.js
1 parent 949669e commit fceb97c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/commands/moderation/kick.js

+18
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const fs = require("fs");
99
const path = require("path");
1010

1111
const logChannelsPath = path.join(__dirname, "../logChannels.json");
12+
const logsFilePath = path.join(__dirname, "../modlogs.json");
1213

1314
module.exports = {
1415
/**
@@ -100,6 +101,23 @@ module.exports = {
100101
console.error("Log channel not found.");
101102
}
102103
}
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));
103121
} catch (error) {
104122
console.log(`There was an error when kicking: ${error}`);
105123
await interaction.editReply("An error occurred while trying to kick the user.");

0 commit comments

Comments
 (0)