mirror of
https://github.com/house-of-vanity/desubot.git
synced 2025-08-21 15:27:14 +00:00
25
src/main.rs
25
src/main.rs
@@ -1,3 +1,4 @@
|
|||||||
|
#![allow(unreachable_code)]
|
||||||
use std::{env, process};
|
use std::{env, process};
|
||||||
|
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
@@ -16,7 +17,7 @@ use mystem::MyStem;
|
|||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), errors::Error> {
|
async fn main() -> Result<(), errors::Error> {
|
||||||
env_logger::from_env(Env::default().default_filter_or("info")).init();
|
env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();
|
||||||
let mut mystem = match MyStem::new() {
|
let mut mystem = match MyStem::new() {
|
||||||
Ok(mystem) => mystem,
|
Ok(mystem) => mystem,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
@@ -44,16 +45,18 @@ async fn main() -> Result<(), errors::Error> {
|
|||||||
me.first_name,
|
me.first_name,
|
||||||
me.id
|
me.id
|
||||||
);
|
);
|
||||||
while let Some(update) = stream.next().await {
|
loop {
|
||||||
let update = update?;
|
while let Some(update) = stream.next().await {
|
||||||
if let UpdateKind::Message(message) = update.kind {
|
let update = update?;
|
||||||
db::add_conf(message.clone()).await?;
|
if let UpdateKind::Message(message) = update.kind {
|
||||||
db::add_user(message.clone()).await?;
|
db::add_conf(message.clone()).await?;
|
||||||
match handlers::handler(api.clone(), message, token.clone(), &mut mystem, me.clone())
|
db::add_user(message.clone()).await?;
|
||||||
.await
|
match handlers::handler(api.clone(), message, token.clone(), &mut mystem, me.clone())
|
||||||
{
|
.await
|
||||||
Ok(_) => {}
|
{
|
||||||
Err(e) => warn!("An error occurred handling command. {:?}", e),
|
Ok(_) => {}
|
||||||
|
Err(e) => warn!("An error occurred handling command. {:?}", e),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user