mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-19 16:58: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
|
target
|
||||||
.env
|
.env
|
||||||
*.toml
|
*.yaml
|
||||||
cargo-remote
|
cargo-remote
|
||||||
|
|
|
@ -27,7 +27,10 @@ where
|
||||||
{
|
{
|
||||||
fn insert_into(data: &mut ShareMap, path: impl AsRef<Path>) -> Result<(), Error> {
|
fn insert_into(data: &mut ShareMap, path: impl AsRef<Path>) -> Result<(), Error> {
|
||||||
let db = FileDatabase::<T, Ron>::from_path(path, T::default())?;
|
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);
|
data.insert::<DB<T>>(db);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -52,10 +55,10 @@ pub fn setup_db(client: &mut Client) -> Result<(), Error> {
|
||||||
PathBuf::from("data")
|
PathBuf::from("data")
|
||||||
});
|
});
|
||||||
let mut data = client.data.write();
|
let mut data = client.data.write();
|
||||||
SoftBans::insert_into(&mut *data, &path.join("soft_bans.toml"))?;
|
SoftBans::insert_into(&mut *data, &path.join("soft_bans.yaml"))?;
|
||||||
OsuSavedUsers::insert_into(&mut *data, &path.join("osu_saved_users.toml"))?;
|
OsuSavedUsers::insert_into(&mut *data, &path.join("osu_saved_users.yaml"))?;
|
||||||
OsuLastBeatmap::insert_into(&mut *data, &path.join("last_beatmaps.toml"))?;
|
OsuLastBeatmap::insert_into(&mut *data, &path.join("last_beatmaps.yaml"))?;
|
||||||
AnnouncerChannels::insert_into(&mut *data, &path.join("announcers.toml"))?;
|
AnnouncerChannels::insert_into(&mut *data, &path.join("announcers.yaml"))?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue