Gwuuh
This commit is contained in:
parent
ee2c5488d3
commit
98ca57e4d9
|
@ -52,7 +52,7 @@ module.exports.execute = async (interaction, client, db) => {
|
||||||
|
|
||||||
// Convert rows to CSV format
|
// Convert rows to CSV format
|
||||||
const csvRows = rows.map(row => `${row.timestamp},${row.reading},${row.notes}`);
|
const csvRows = rows.map(row => `${row.timestamp},${row.reading},${row.notes}`);
|
||||||
const msg = rows.map(row => `**ID:** ${row.id}\n**Timestamp:** <t:${Math.floor(row.timestamp/1000)}>\n**Reading:** ${row.reading}\n**Notes:** ${row.notes || 'None'}`).join('\n');
|
const msg = rows.map(row => `**ID:** ${row.id}\n**Timestamp:** <t:${Math.floor(new Date(row.timestamp)/1000)}> **Reading:** ${row.reading} **Notes:** ${row.notes || 'None'}`).join('\n');
|
||||||
const csvContent = `Timestamp,Reading,Notes\n${csvRows.join('\n')}`;
|
const csvContent = `Timestamp,Reading,Notes\n${csvRows.join('\n')}`;
|
||||||
const csvBuffer = Buffer.from(csvContent, 'utf8');
|
const csvBuffer = Buffer.from(csvContent, 'utf8');
|
||||||
const attachment = new Discord.AttachmentBuilder(csvBuffer, { name: `glucose_readings.csv` });
|
const attachment = new Discord.AttachmentBuilder(csvBuffer, { name: `glucose_readings.csv` });
|
||||||
|
|
Loading…
Reference in a new issue