chore(fmt): Format the code
Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
parent
25d94ccc40
commit
9100ebcb11
2 changed files with 8 additions and 7 deletions
12
src/api.rs
12
src/api.rs
|
@ -23,17 +23,17 @@ use crate::PingList;
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct AppState {
|
pub(crate) struct AppState {
|
||||||
/// Clean text bot usernames
|
/// Clean text bot usernames
|
||||||
pub bots: Vec<String>,
|
pub bots: Vec<String>,
|
||||||
/// Sha256 tokens
|
/// Sha256 tokens
|
||||||
pub tokens: Vec<String>,
|
pub tokens: Vec<String>,
|
||||||
/// The telegram clinet
|
/// The telegram clinet
|
||||||
tg_client: grammers_client::Client,
|
tg_client: grammers_client::Client,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(serde::Serialize)]
|
#[derive(serde::Serialize)]
|
||||||
struct MessageSchema<'a> {
|
struct MessageSchema<'a> {
|
||||||
message: &'a str,
|
message: &'a str,
|
||||||
status: bool,
|
status: bool,
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
status_code: StatusCode,
|
status_code: StatusCode,
|
||||||
}
|
}
|
||||||
|
@ -46,11 +46,11 @@ impl AppState {
|
||||||
client: grammers_client::Client,
|
client: grammers_client::Client,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
bots: bots
|
bots: bots
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|b| b.trim_start_matches('@').trim().to_lowercase())
|
.map(|b| b.trim_start_matches('@').trim().to_lowercase())
|
||||||
.collect(),
|
.collect(),
|
||||||
tokens: tokens
|
tokens: tokens
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|t| sha256::digest(t.trim()))
|
.map(|t| sha256::digest(t.trim()))
|
||||||
.collect(),
|
.collect(),
|
||||||
|
|
|
@ -25,7 +25,7 @@ mod superbot;
|
||||||
#[derive(Default, Clone)]
|
#[derive(Default, Clone)]
|
||||||
pub(crate) struct PingedBot {
|
pub(crate) struct PingedBot {
|
||||||
telegram_id: u64,
|
telegram_id: u64,
|
||||||
ping_in: i64,
|
ping_in: i64,
|
||||||
is_response: bool,
|
is_response: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@ impl PingList for Mutex<Vec<PingedBot>> {
|
||||||
log::debug!("Response status: {result}");
|
log::debug!("Response status: {result}");
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_res(&self, telegram_id: u64) {
|
fn new_res(&self, telegram_id: u64) {
|
||||||
log::debug!("New res from: {telegram_id}");
|
log::debug!("New res from: {telegram_id}");
|
||||||
let mut bots = self.lock().unwrap();
|
let mut bots = self.lock().unwrap();
|
||||||
|
|
Loading…
Reference in a new issue