diff --git a/src/main.rs b/src/main.rs index f1d92ed..0ffc7a7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,7 +8,7 @@ use matrix_sdk::{ }, Error, LoopCtrl, }; -use std::{path::PathBuf, sync::Mutex}; +use std::{path::PathBuf, sync::Mutex, env}; use once_cell::sync::Lazy; pub mod config; @@ -183,7 +183,16 @@ async fn main() -> anyhow::Result<()> { } }; - let _stdin_thread = tokio::spawn(prompt::prompt(client.to_owned())); + // TODO: Better solution for this + let mut no_prompt: bool = false; + match env::var("NO_PROMPT") { + Ok(e) => { if e.to_lowercase().contains("yes") { no_prompt = true; } }, + Err(_e) => () + }; + if !no_prompt { + tokio::spawn(prompt::prompt(client.to_owned())); + } + client.add_event_handler(on_room_message); client .sync_with_result_callback(sync_settings, |sync_result| async move {