mirror of
https://github.com/Noratrieb/discord-court-bot.git
synced 2026-01-16 19:05:01 +01:00
fix some things
This commit is contained in:
parent
afd5e49eda
commit
835665e77f
3 changed files with 162 additions and 51 deletions
|
|
@ -1,5 +1,6 @@
|
|||
use color_eyre::Result;
|
||||
use mongodb::{
|
||||
bson,
|
||||
bson::doc,
|
||||
options::{ClientOptions, Credential},
|
||||
Client, Collection, Database,
|
||||
|
|
@ -98,12 +99,12 @@ impl Mongo {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn add_court_room(&self, guild_id: &str, room: CourtRoom) -> Result<()> {
|
||||
pub async fn add_court_room(&self, guild_id: &str, room: &CourtRoom) -> Result<()> {
|
||||
let _ = self.find_or_insert_state(guild_id).await?;
|
||||
let coll = self.state_coll();
|
||||
coll.update_one(
|
||||
doc! {"guild_id": &guild_id },
|
||||
doc! {"$push": { "court_rooms": &serde_json::to_string(&room).unwrap() }},
|
||||
doc! {"$push": { "court_rooms": bson::to_bson(room).wrap_err("invalid bson for room")? }},
|
||||
None,
|
||||
)
|
||||
.await
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue