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