From 033f41b0aceb85c0b7d432e40fe20452c1531521 Mon Sep 17 00:00:00 2001 From: 0xf8 <0xf8.dev@proton.me> Date: Wed, 19 Apr 2023 22:26:47 -0400 Subject: [PATCH] Bandaid solution for no prompt --- src/main.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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 {