Add some logging
This commit is contained in:
parent
60bdaa17c1
commit
8e9c679c2b
|
|
@ -97,6 +97,7 @@ const execute = async (message) => {
|
||||||
cancel(message.author);
|
cancel(message.author);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const productId = global.productUpdateData[message.author.id].id;
|
||||||
const file = fs.createWriteStream(`./productFiles/${crypto.randomBytes(8).toString('hex')}`);
|
const file = fs.createWriteStream(`./productFiles/${crypto.randomBytes(8).toString('hex')}`);
|
||||||
download(attachment.url, file.path, async (err) => {
|
download(attachment.url, file.path, async (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
@ -105,7 +106,7 @@ const execute = async (message) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const fileType = attachment.name.split('.').pop();
|
const fileType = attachment.name.split('.').pop();
|
||||||
await pool.query('UPDATE products SET file = ?, fileType = ? WHERE id = ?', [file.path.split('/').pop(), fileType, global.productUpdateData[message.author.id].id]);
|
await pool.query('UPDATE products SET file = ?, fileType = ? WHERE id = ?', [file.path.split('/').pop(), fileType, productId]);
|
||||||
message.channel.send('File updated successfully!');
|
message.channel.send('File updated successfully!');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue