Utilize confy for reading and saving history
This commit is contained in:
parent
f08e60a89d
commit
cbb50e5d53
2 changed files with 12 additions and 66 deletions
src
14
src/bot.rs
14
src/bot.rs
|
@ -96,10 +96,7 @@ pub(crate) async fn run(data: Arc<RwLock<SharedData>>) {
|
|||
|
||||
{
|
||||
let mut write = data.write().await;
|
||||
write.post_history = match SeriesHistory::load_history() {
|
||||
Ok(data) => data,
|
||||
Err(_) => continue,
|
||||
};
|
||||
write.post_history = SeriesHistory::load_history();
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -243,14 +240,7 @@ async fn handle_series(
|
|||
series_history.set_part(post_part_info.as_string().as_str(), part_history);
|
||||
let mut write = data.write().await;
|
||||
write.post_history.set_series(series.slug.as_str(), series_history);
|
||||
let _ = match write.post_history.save_history() {
|
||||
Ok(data) => data,
|
||||
Err(e) => {
|
||||
let err_msg = format!("{e}");
|
||||
write_error(err_msg);
|
||||
return Err(())
|
||||
}
|
||||
};
|
||||
write.post_history.save_history();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue