From fa4c9b9ec44ec19b81a0715128ffa2ce8505606d Mon Sep 17 00:00:00 2001 From: asonix Date: Fri, 17 Oct 2025 09:39:24 -0500 Subject: [PATCH] Chunk telegram responses with size 50 --- src/telegram.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/telegram.rs b/src/telegram.rs index 273ce99..b5b41b7 100644 --- a/src/telegram.rs +++ b/src/telegram.rs @@ -107,17 +107,23 @@ async fn answer(bot: Bot, msg: Message, cmd: Command, db: Db) -> ResponseResult< } Command::ListAllowed => { if let Ok(allowed) = db.allows().await { - bot.send_message(msg.chat.id, allowed.join("\n")).await?; + for chunk in allowed.chunks(50) { + bot.send_message(msg.chat.id, chunk.join("\n")).await?; + } } } Command::ListBlocks => { if let Ok(blocks) = db.blocks().await { - bot.send_message(msg.chat.id, blocks.join("\n")).await?; + for chunk in blocks.chunks(50) { + bot.send_message(msg.chat.id, chunk.join("\n")).await?; + } } } Command::ListConnected => { if let Ok(connected) = db.connected_ids().await { - bot.send_message(msg.chat.id, connected.join("\n")).await?; + for chunk in connected.chunks(50) { + bot.send_message(msg.chat.id, chunk.join("\n")).await?; + } } } _ => {