summary refs log tree commit diff
path: root/src/main.rs
blob: e2a90283310b72627d89da3b94155990e1a849f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
mod mattermost;

use tokio::{self};
use tracing::{debug, info};

struct Vav{

}
#[async_trait::async_trait]
impl mattermost::Handler for Vav{
    async fn handle(&self,message:serde_json::Value,client: & mattermost::Client) {
        debug!("{message:?}");
    }
}

#[tokio::main(worker_threads = 2)]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    tracing_subscriber::fmt::init();
    let login = std::env::var("USER_MAIL")?;
    let password = std::env::var("USER_PASSWORD")?;
    let auth = mattermost::AuthData { login, password };
    let mut client = mattermost::Client::new(auth, "https://mattermost.continuum.ii.uni.wroc.pl");
    client.update_bearer_token().await?;
    client.handle_websocket_stream(Vav{}).await?;
    Ok(())
}