Stop pinging Telegram
Turns out grammers does it by itself
This commit is contained in:
parent
9993e52e0d
commit
8c2db3c958
15
src/main.rs
15
src/main.rs
|
@ -4,8 +4,7 @@ mod utils;
|
||||||
mod workers;
|
mod workers;
|
||||||
use grammers_client::{types::chat::PackedChat, Client, Config, InputMessage, Update};
|
use grammers_client::{types::chat::PackedChat, Client, Config, InputMessage, Update};
|
||||||
use grammers_session::Session;
|
use grammers_session::Session;
|
||||||
use grammers_tl_types::functions::Ping;
|
use rand::{thread_rng, Rng};
|
||||||
use rand::{random, thread_rng, Rng};
|
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use reqwest::ClientBuilder;
|
use reqwest::ClientBuilder;
|
||||||
use std::collections::{HashSet, VecDeque};
|
use std::collections::{HashSet, VecDeque};
|
||||||
|
@ -60,18 +59,6 @@ async fn async_main() {
|
||||||
eprintln!("Failed to save session: {:?}", err);
|
eprintln!("Failed to save session: {:?}", err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
|
||||||
let tclient = tclient.clone();
|
|
||||||
tokio::task::spawn(async move {
|
|
||||||
loop {
|
|
||||||
let ping_id = random();
|
|
||||||
if let Err(err) = tclient.invoke(&Ping { ping_id }).await {
|
|
||||||
eprintln!("Failed to ping Telegram: {:?}", err);
|
|
||||||
}
|
|
||||||
sleep(Duration::from_secs(60)).await;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if config::STORAGE_CHAT.is_none() {
|
if config::STORAGE_CHAT.is_none() {
|
||||||
while let Some(update) = tclient
|
while let Some(update) = tclient
|
||||||
.next_update()
|
.next_update()
|
||||||
|
|
Loading…
Reference in New Issue