From d0aa721b81638a27db99e902ef8cca64caeaf575 Mon Sep 17 00:00:00 2001 From: Matthieu Jolimaitre Date: Tue, 13 Aug 2024 19:58:33 +0200 Subject: [PATCH] fix attachment looking in fs instead of sending buffer --- src/bot.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bot.ts b/src/bot.ts index 423104b..8425e46 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -19,6 +19,7 @@ import { import { RuleSet } from "./rules.ts"; import { channel, log_from, SimpleResult, split_promise, try_ } from "./utils.ts"; import { StoredUser } from "./state.ts"; +import { Buffer } from "node:buffer"; const log = log_from(import.meta.url); /** @@ -376,7 +377,9 @@ function message_command_response_export_success(count: number, csv: string) { const embed = new EmbedBuilder() .setTitle("`✅`| Export") .setDescription(`\`${count}\` associations exportées.`); - const attachment = new AttachmentBuilder(csv).setName(`export-${Date.now()}.csv`); + const buffer = Buffer.from(csv); + const attachment = new AttachmentBuilder(buffer) + .setName(`export-${Date.now()}.csv`); return { embeds: [embed], files: [attachment] }; }