(
&self,
guild_id: Id<GuildMarker>,
script_name: String,
)
| 456 | } |
| 457 | |
| 458 | pub async fn del_script( |
| 459 | &self, |
| 460 | guild_id: Id<GuildMarker>, |
| 461 | script_name: String, |
| 462 | ) -> ConfigStoreResult<()> { |
| 463 | let res = sqlx::query!( |
| 464 | "DELETE FROM guild_scripts WHERE guild_id = $1 AND name = $2;", |
| 465 | guild_id.get() as i64, |
| 466 | script_name |
| 467 | ) |
| 468 | .execute(&self.pool) |
| 469 | .await?; |
| 470 | |
| 471 | if res.rows_affected() > 0 { |
| 472 | Ok(()) |
| 473 | } else { |
| 474 | Err(ConfigStoreError::ScriptNotFound) |
| 475 | } |
| 476 | } |
| 477 | |
| 478 | pub async fn list_scripts(&self, guild_id: Id<GuildMarker>) -> ConfigStoreResult<Vec<Script>> { |
| 479 | Self::get_guild_scripts(&mut *self.pool.acquire().await?, guild_id).await |
no test coverage detected