Fixed panic from messages too long for telegram (prob not good)

This commit is contained in:
emilis 2021-09-23 21:47:37 +02:00
parent af00fc5c4b
commit 9564aeddaa
1 changed files with 2 additions and 2 deletions

View File

@ -98,8 +98,8 @@ async fn main() -> Result<(), Box<dyn Error>> {
)
.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<dyn Error>);