diff --git a/src/bot/main.rs b/src/bot/main.rs index 2459f032b92fd02ab5edaee9a127ab4143294720..fd91a2b3dbf0a85d63528da3c69fd4c440f5c280 100644 --- a/src/bot/main.rs +++ b/src/bot/main.rs @@ -117,12 +117,18 @@ async fn run(args: BotConfig, client: Client) -> anyhow::Result<()> { .add_filter(TextFilter(&[".rl"], TextMatchMethod::IStartsWith)), ]; + let mut errors_count = 0; + loop { // Get new update let update = client.next_update().await; if update.is_err() { log::error!("{}", update.unwrap_err()); - break; + errors_count += 1; + if errors_count > 10 { + break; + } + continue; } // We get update if there's no error let Some(update_data) = update.ok().and_then(|inner|inner) else{