create BotInstance::update_script
This commit is contained in:
parent
308b15ed69
commit
39e376195c
@ -75,4 +75,19 @@ impl BotInstance {
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn update_script<D: CallDB>(db: &mut D, name: &str, script: &str) -> DbResult<()> {
|
||||
let bi = db.get_collection::<Self>().await;
|
||||
|
||||
bi.update_one(
|
||||
doc! {"name": name},
|
||||
doc! { "$set": {
|
||||
"script": script,
|
||||
"restart_flag": true,
|
||||
}
|
||||
},
|
||||
)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user