Bugfix for moved history.toml

This commit is contained in:
Neshura 2023-12-30 00:53:00 +01:00
parent 9c15ea791f
commit 0f1de67db6
Signed by: Neshura
GPG key ID: B6983AAA6B9A7A6C
3 changed files with 8 additions and 5 deletions

View file

@ -49,6 +49,9 @@ pub(crate) async fn run(data: Arc<RwLock<SharedData>>) {
write.start = Utc::now(); write.start = Utc::now();
} }
let info_msg = "Bot init successful, starting normal operations".to_owned();
write_info(info_msg);
loop { loop {
idle(&data).await; idle(&data).await;

View file

@ -46,14 +46,14 @@ pub(crate) async fn login(config: &Config) -> Result<Lemmy, ()> {
None => { None => {
let err_msg = "Login did not return JWT token. Are the credentials valid?".to_owned(); let err_msg = "Login did not return JWT token. Are the credentials valid?".to_owned();
write_error(err_msg); write_error(err_msg);
return Err(()) Err(())
} }
} }
}, },
status => { status => {
let err_msg = format!("Unexpected HTTP Status '{}' during Login", status); let err_msg = format!("Unexpected HTTP Status '{}' during Login", status);
write_error(err_msg); write_error(err_msg);
return Err(()) Err(())
} }
} }
} }

View file

@ -17,10 +17,10 @@ impl SeriesHistory {
let config_dir = path.parent().expect("Something went wrong with confy"); let config_dir = path.parent().expect("Something went wrong with confy");
let path = format!("{}/history.toml", config_dir.to_str().expect("Conversion to str should not fail for a dir"));
match Path::new(format!("{}/history.toml", config_dir.to_str().expect("Conversion to str should not fail for a dir")).as_str()).exists() { match Path::new(path.as_str()).exists() {
true => { true => {
let file_contents: String = match fs::read_to_string("history.toml") { let file_contents: String = match fs::read_to_string(path.as_str()) {
Ok(data) => data, Ok(data) => data,
Err(e) => { Err(e) => {
let err_msg = format!("{e}"); let err_msg = format!("{e}");