Test
This commit is contained in:
parent
858cdb2202
commit
b1d8f88e97
3
index.js
3
index.js
|
@ -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: [
|
||||
|
|
Loading…
Reference in a new issue