fix: dont inline the image in telegram response

This commit is contained in:
max_richter 2025-05-09 19:46:41 +02:00
parent 46519ef1ea
commit a414a80766
Signed by: max
GPG Key ID: 51973802EF3F77C5

View File

@ -63,9 +63,7 @@ bot.command("end", async (ctx) => {
task.noteName.replace(/\.md$/, "")
}/photo-${photoIndex}.jpg`;
finalNote += `![image](data:image/jpeg;base64,${
btoa(String.fromCharCode(...(entry.content as Uint8Array)))
})\n\n`;
finalNote += `**Photo**:\n ${photoUrl}\n\n`;
photoTasks.push({
content: entry.content as Uint8Array,
path: photoUrl,
@ -80,11 +78,17 @@ bot.command("end", async (ctx) => {
await createDocument(task.noteName, finalNote, "text/markdown");
delete activeTasks[ctx.chat.id.toString()];
await ctx.reply("Note complete. Here is your markdown:");
await ctx.reply(finalNote);
await ctx.reply(finalNote, { parse_mode: "MarkdownV2" });
} catch (error) {
console.error("Error creating document:", error);
await ctx.reply("Error creating document:");
await ctx.reply(JSON.stringify(error));
if (error instanceof Error) {
await ctx.reply(error?.toString());
}else if (error instanceof Response) {
await ctx.reply(error?.statusText);
}else if (typeof error === "string") {
await ctx.reply(error);
}
}
});