Grr
This commit is contained in:
parent
20a03cc625
commit
06cbf5c69a
|
@ -133,7 +133,6 @@ const execute = async (message) => {
|
|||
message.channel.send('Category updated!');
|
||||
break;
|
||||
case "delete": // Delete
|
||||
const product = await global.productUpdateData[message.author.id].id;
|
||||
console.log(product);
|
||||
if (message.content.toLowerCase() === 'cancel') {
|
||||
cancel(message.author);
|
||||
|
@ -145,15 +144,16 @@ const execute = async (message) => {
|
|||
}
|
||||
// Proceed with deletion
|
||||
message.channel.send('Deletion Confirmed. Starting deletion process...').then(async msg => {
|
||||
let pid = global.productUpdateData[message.author.id].id;
|
||||
let curMsg = msg.content;
|
||||
// Delete fileAuth
|
||||
curMsg = curMsg + '\nDeleting file authorizations...'
|
||||
await msg.edit(curMsg);
|
||||
await pool.query('DELETE FROM fileAuth WHERE product = ?', [product]);
|
||||
await pool.query('DELETE FROM fileAuth WHERE product = ?', [pid]);
|
||||
// Delete file
|
||||
curMsg = curMsg + '\nDeleting product file...'
|
||||
await msg.edit(curMsg);
|
||||
const [product] = await pool.query('SELECT file FROM products WHERE id = ?', [global.productUpdateData[message.author.id].id]);
|
||||
const [product] = await pool.query('SELECT file FROM products WHERE id = ?', [pid]);
|
||||
if (product) {
|
||||
const safeFileId = path.basename(product.file);
|
||||
const filePath = path.join(__dirname, '../productFiles', safeFileId); // Code we use in the CDN route
|
||||
|
@ -169,11 +169,11 @@ const execute = async (message) => {
|
|||
// Delete purchases
|
||||
curMsg = curMsg + '\nDeleting purchases...';
|
||||
await msg.edit(curMsg);
|
||||
await pool.query('DELETE FROM purchases WHERE productId = ?', [global.productUpdateData[message.author.id].id]);
|
||||
await pool.query('DELETE FROM purchases WHERE productId = ?', [pid]);
|
||||
// Delete product
|
||||
curMsg = curMsg + '\nDeleting product...';
|
||||
await msg.edit(curMsg);
|
||||
await pool.query('DELETE FROM products WHERE id = ?', [global.productUpdateData[message.author.id].id]);
|
||||
await pool.query('DELETE FROM products WHERE id = ?', [pid]);
|
||||
curMsg = curMsg + '\nProduct deletion complete.';
|
||||
await msg.edit(curMsg);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue