Bandaid solution for no prompt

This commit is contained in:
0xf8 2023-04-19 22:26:47 -04:00
parent 16bb6a48a2
commit 033f41b0ac
Signed by: 0xf8
GPG Key ID: 446580D758689584

View File

@ -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 {