This commit is contained in:
Christopher Cookman 2024-06-11 15:21:30 -06:00
parent 858cdb2202
commit b1d8f88e97
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -49,7 +49,7 @@ const cdrPool = mariadb.createPool(config.cdrdb);
const json2csv = (obj) => {
let csv = "";
for (let key in obj) {
csv += `${key},${obj[key]}\n`;
csv += `${JSON.stringify(obj[key])}\n`;
}
return csv;
}
@ -1335,6 +1335,7 @@ dcClient.on('interactionCreate', async interaction => {
// put fields at the top of the csv
result.unshift(fields);
const csv = json2csv(result);
console.log(JSON.stringify(result)) // debug
const buffer = Buffer.from(csv, 'utf-8');
interaction.editReply({
files: [