feat: some more logs
This commit is contained in:
parent
a414a80766
commit
9dc01a59be
@ -39,6 +39,8 @@ bot.command("end", async (ctx) => {
|
|||||||
const task = activeTasks[ctx.chat.id.toString()];
|
const task = activeTasks[ctx.chat.id.toString()];
|
||||||
if (!task) return ctx.reply("No active note found.");
|
if (!task) return ctx.reply("No active note found.");
|
||||||
|
|
||||||
|
console.log("Ending note", task.noteName);
|
||||||
|
|
||||||
let finalNote = `# ${task.noteName}\n\n`;
|
let finalNote = `# ${task.noteName}\n\n`;
|
||||||
|
|
||||||
const photoTasks: { content: Uint8Array; path: string }[] = [];
|
const photoTasks: { content: Uint8Array; path: string }[] = [];
|
||||||
@ -49,19 +51,20 @@ bot.command("end", async (ctx) => {
|
|||||||
finalNote += entry.content + "\n\n";
|
finalNote += entry.content + "\n\n";
|
||||||
} else if (entry.type === "voice") {
|
} else if (entry.type === "voice") {
|
||||||
try {
|
try {
|
||||||
|
console.log("Converting OGG to MP3");
|
||||||
const mp3Data = await convertOggToMp3(entry.content as Uint8Array);
|
const mp3Data = await convertOggToMp3(entry.content as Uint8Array);
|
||||||
|
console.log("Finished converting OGG to MP3, transcribing...");
|
||||||
const transcript = await transcribe(mp3Data);
|
const transcript = await transcribe(mp3Data);
|
||||||
finalNote += `**Voice Transcript:**\n${transcript}\n\n`;
|
finalNote += `**Voice Transcript:**\n${transcript}\n\n`;
|
||||||
|
console.log("Finished transcribing");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
finalNote += "**[Voice message could not be transcribed]**\n\n";
|
finalNote += "**[Voice message could not be transcribed]**\n\n";
|
||||||
}
|
}
|
||||||
} else if (entry.type === "photo") {
|
} else if (entry.type === "photo") {
|
||||||
photoIndex++;
|
|
||||||
|
|
||||||
const photoUrl = `${
|
const photoUrl = `${
|
||||||
task.noteName.replace(/\.md$/, "")
|
task.noteName.replace(/\.md$/, "")
|
||||||
}/photo-${photoIndex}.jpg`;
|
}/photo-${photoIndex++}.jpg`;
|
||||||
|
|
||||||
finalNote += `**Photo**:\n ${photoUrl}\n\n`;
|
finalNote += `**Photo**:\n ${photoUrl}\n\n`;
|
||||||
photoTasks.push({
|
photoTasks.push({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user