diff --git a/eventHandlers/guildMemberAdd.js b/eventHandlers/guildMemberAdd.js index ef39d48..9f9db2e 100644 --- a/eventHandlers/guildMemberAdd.js +++ b/eventHandlers/guildMemberAdd.js @@ -1,3 +1,7 @@ +const path = require('path'); +const fs = require('fs'); +const https = require('https'); + module.exports = (member, db, client) => { if (!member.guild) return; // Ignore DMs if (member.user.bot) return; // Ignore bots @@ -29,7 +33,7 @@ module.exports = (member, db, client) => { member.kick("Listed bad actor").then(() => { client.channels.fetch(config.logChannelId).then(logChan => { logChan.send({ - content: `User <@${member.id}> has been kicked for being a bad actor. Reported by <@${row.reportedBy}>.` + content: `User <@${member.id}> has been kicked. Reported by <@${row.reportedBy}>.` }).catch(console.error); }); } @@ -41,7 +45,7 @@ module.exports = (member, db, client) => { member.ban({ reason: "Listed bad actor" }).then(() => { client.channels.fetch(config.logChannelId).then(logChan => { logChan.send({ - content: `User <@${member.id}> has been banned for being a bad actor. Reported by <@${row.reportedBy}>.` + content: `User <@${member.id}> has been banned. Reported by <@${row.reportedBy}>.` }).catch(console.error); }); }).catch(err => { @@ -66,7 +70,7 @@ module.exports = (member, db, client) => { color: 0xff0000 }], files: row.attachments ? JSON.parse(row.attachments).map(file => ({ - attachment: path.join(__dirname, '../../storage', file), + attachment: path.join(__dirname, '../storage', file), name: file })) : [] }).catch(console.error); diff --git a/interactions/commands/add.js b/interactions/commands/add.js index 7ad79dc..6908250 100644 --- a/interactions/commands/add.js +++ b/interactions/commands/add.js @@ -20,10 +20,11 @@ const execute = async (interaction, db, client) => { const attachments = []; for (let i = 1; i <= 4; i++) { const attachment = interaction.options.getAttachment(`attachment${i}`); - const fileExt = attachment.name ? path.extname(attachment.name) : ''; if (attachment) { + const fileExt = attachment.name ? path.extname(attachment.name) : ''; const url = attachment.url; - const filename = `${user.id}-${i}${attachment}.${fileExt}`; + const filename = `${user}-${i}${fileExt}`; + console.log(filename) const filepath = path.join(__dirname, '../../storage', filename); // Await the download before continuing