summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index d4f30c4..e2a9028 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -3,8 +3,17 @@ mod mattermost;
 use tokio::{self};
 use tracing::{debug, info};
 
-#[tokio::main(worker_threads = 2)]
+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")?;
@@ -12,6 +21,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
     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().await?;
+    client.handle_websocket_stream(Vav{}).await?;
     Ok(())
 }