From 9564aeddaa15de2cbf1d810322e207c01c95dcec Mon Sep 17 00:00:00 2001 From: emilis Date: Thu, 23 Sep 2021 21:47:37 +0200 Subject: [PATCH] Fixed panic from messages too long for telegram (prob not good) --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 8ae2e4e..f16afb1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -98,8 +98,8 @@ async fn main() -> Result<(), Box> { ) .into_stream() .try_filter(|message| { - let not_empty = !message.is_empty(); - async move { not_empty } + let criteria = !message.is_empty() && message.chars().count() <= 4096; + async move { criteria } }), ) .map_err(|e| Box::new(e) as Box);