Make the AI fix it ffs

This commit is contained in:
Christopher Cookman 2025-09-15 07:32:37 -06:00
parent 67ccac5f1e
commit 0c52ab99e0

View file

@ -35,7 +35,8 @@ const cancel = (user) => {
} }
const execute = async (message) => { const execute = async (message) => {
switch (global.productUpdateData[message.author.id].type) { const userData = global.productUpdateData[message.author.id];
switch (userData?.type) {
case "name": // Name case "name": // Name
const newName = message.content.trim(); const newName = message.content.trim();
if (newName.toLowerCase() === 'cancel') { if (newName.toLowerCase() === 'cancel') {
@ -142,15 +143,15 @@ const execute = async (message) => {
return; return;
} }
// Proceed with deletion // Proceed with deletion
const pid = userData.id;
message.channel.send('Deletion Confirmed. Starting deletion process...').then(async msg => { message.channel.send('Deletion Confirmed. Starting deletion process...').then(async msg => {
let pid = global.productUpdateData[message.author.id].id;
let curMsg = msg.content; let curMsg = msg.content;
// Delete fileAuth // Delete fileAuth
curMsg = curMsg + '\nDeleting file authorizations...' curMsg = curMsg + '\nDeleting file authorizations...';
await msg.edit(curMsg); await msg.edit(curMsg);
await pool.query('DELETE FROM fileAuth WHERE product = ?', [pid]); await pool.query('DELETE FROM fileAuth WHERE product = ?', [pid]);
// Delete file // Delete file
curMsg = curMsg + '\nDeleting product file...' curMsg = curMsg + '\nDeleting product file...';
await msg.edit(curMsg); await msg.edit(curMsg);
const [product] = await pool.query('SELECT file FROM products WHERE id = ?', [pid]); const [product] = await pool.query('SELECT file FROM products WHERE id = ?', [pid]);
if (product) { if (product) {
@ -185,4 +186,4 @@ const execute = async (message) => {
delete global.productUpdateData[message.author.id]; delete global.productUpdateData[message.author.id];
delete global.dmHandlers[message.author.id]; delete global.dmHandlers[message.author.id];
} }
module.exports = execute module.exports = execute