Fix auto actions

This commit is contained in:
Christopher Cookman 2025-06-17 16:50:52 -06:00
parent ba9119c643
commit a2f803ef34
2 changed files with 10 additions and 5 deletions

View file

@ -1,3 +1,7 @@
const path = require('path');
const fs = require('fs');
const https = require('https');
module.exports = (member, db, client) => { module.exports = (member, db, client) => {
if (!member.guild) return; // Ignore DMs if (!member.guild) return; // Ignore DMs
if (member.user.bot) return; // Ignore bots if (member.user.bot) return; // Ignore bots
@ -29,7 +33,7 @@ module.exports = (member, db, client) => {
member.kick("Listed bad actor").then(() => { member.kick("Listed bad actor").then(() => {
client.channels.fetch(config.logChannelId).then(logChan => { client.channels.fetch(config.logChannelId).then(logChan => {
logChan.send({ 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); }).catch(console.error);
}); });
} }
@ -41,7 +45,7 @@ module.exports = (member, db, client) => {
member.ban({ reason: "Listed bad actor" }).then(() => { member.ban({ reason: "Listed bad actor" }).then(() => {
client.channels.fetch(config.logChannelId).then(logChan => { client.channels.fetch(config.logChannelId).then(logChan => {
logChan.send({ 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(console.error);
}); });
}).catch(err => { }).catch(err => {
@ -66,7 +70,7 @@ module.exports = (member, db, client) => {
color: 0xff0000 color: 0xff0000
}], }],
files: row.attachments ? JSON.parse(row.attachments).map(file => ({ files: row.attachments ? JSON.parse(row.attachments).map(file => ({
attachment: path.join(__dirname, '../../storage', file), attachment: path.join(__dirname, '../storage', file),
name: file name: file
})) : [] })) : []
}).catch(console.error); }).catch(console.error);

View file

@ -20,10 +20,11 @@ const execute = async (interaction, db, client) => {
const attachments = []; const attachments = [];
for (let i = 1; i <= 4; i++) { for (let i = 1; i <= 4; i++) {
const attachment = interaction.options.getAttachment(`attachment${i}`); const attachment = interaction.options.getAttachment(`attachment${i}`);
const fileExt = attachment.name ? path.extname(attachment.name) : '';
if (attachment) { if (attachment) {
const fileExt = attachment.name ? path.extname(attachment.name) : '';
const url = attachment.url; 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); const filepath = path.join(__dirname, '../../storage', filename);
// Await the download before continuing // Await the download before continuing