From 1d209636b4474fb27ad772308b02474a3c8199de Mon Sep 17 00:00:00 2001 From: lew Date: Fri, 10 Apr 2026 02:42:16 +0100 Subject: [PATCH] feat: send voice notes to Telegram as voice messages --- src/telegram.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/telegram.rs b/src/telegram.rs index ad4dd9d..0b50ded 100644 --- a/src/telegram.rs +++ b/src/telegram.rs @@ -19,7 +19,7 @@ async fn notify(bot: &Bot, chat_id: ChatId, entry: &Entry) { /// Listen for new entries on the channel and send Telegram notifications. pub async fn notification_task(bot: Bot, chat_id: ChatId, mut rx: Receiver<(Entry, Option>, Option>)>) { - while let Some((entry, drawing_bytes, _voice_bytes)) = rx.recv().await { + while let Some((entry, drawing_bytes, voice_bytes)) = rx.recv().await { notify(&bot, chat_id, &entry).await; if let Some(bytes) = drawing_bytes { if let Err(e) = bot.send_photo( @@ -29,6 +29,14 @@ pub async fn notification_task(bot: Bot, chat_id: ChatId, mut rx: Receiver<(Entr tracing::error!("failed to send drawing photo: {e}"); } } + if let Some(bytes) = voice_bytes { + if let Err(e) = bot.send_voice( + chat_id, + teloxide::types::InputFile::memory(bytes).file_name("voice_note.webm"), + ).await { + tracing::error!("failed to send voice note: {e}"); + } + } } }