mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-18 16:28:55 +00:00
Move to yaml
This commit is contained in:
parent
c46385271e
commit
91c8ceb91c
2 changed files with 9 additions and 6 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,4 +1,4 @@
|
|||
target
|
||||
.env
|
||||
*.toml
|
||||
*.yaml
|
||||
cargo-remote
|
||||
|
|
|
@ -27,7 +27,10 @@ where
|
|||
{
|
||||
fn insert_into(data: &mut ShareMap, path: impl AsRef<Path>) -> Result<(), Error> {
|
||||
let db = FileDatabase::<T, Ron>::from_path(path, T::default())?;
|
||||
db.load().or_else(|_| db.save())?;
|
||||
db.load().or_else(|e| {
|
||||
dbg!(e);
|
||||
db.save()
|
||||
})?;
|
||||
data.insert::<DB<T>>(db);
|
||||
Ok(())
|
||||
}
|
||||
|
@ -52,10 +55,10 @@ pub fn setup_db(client: &mut Client) -> Result<(), Error> {
|
|||
PathBuf::from("data")
|
||||
});
|
||||
let mut data = client.data.write();
|
||||
SoftBans::insert_into(&mut *data, &path.join("soft_bans.toml"))?;
|
||||
OsuSavedUsers::insert_into(&mut *data, &path.join("osu_saved_users.toml"))?;
|
||||
OsuLastBeatmap::insert_into(&mut *data, &path.join("last_beatmaps.toml"))?;
|
||||
AnnouncerChannels::insert_into(&mut *data, &path.join("announcers.toml"))?;
|
||||
SoftBans::insert_into(&mut *data, &path.join("soft_bans.yaml"))?;
|
||||
OsuSavedUsers::insert_into(&mut *data, &path.join("osu_saved_users.yaml"))?;
|
||||
OsuLastBeatmap::insert_into(&mut *data, &path.join("last_beatmaps.yaml"))?;
|
||||
AnnouncerChannels::insert_into(&mut *data, &path.join("announcers.yaml"))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue