(&self, arg: OpWebhookSpecifier)
| 1487 | |
| 1488 | #[allow(async_fn_in_trait)] |
| 1489 | async fn discord_webhook_delete(&self, arg: OpWebhookSpecifier) -> Result<(), anyhow::Error> { |
| 1490 | let rt_ctx = get_rt_ctx(&self.state); |
| 1491 | |
| 1492 | let parsed_id = parse_str_snowflake_id(&arg.webhook_id)?; |
| 1493 | |
| 1494 | discord_request_any(&self.state, async move { |
| 1495 | if arg.token.is_none() { |
| 1496 | // ensure the webhook is part of the current guild |
| 1497 | let webhook = rt_ctx |
| 1498 | .discord_config |
| 1499 | .client |
| 1500 | .webhook(parsed_id.cast()) |
| 1501 | .await? |
| 1502 | .model() |
| 1503 | .await?; |
| 1504 | |
| 1505 | if webhook.guild_id != Some(rt_ctx.guild_id) { |
| 1506 | return Err(anyhow!("This webhook does not belong to this server")); |
| 1507 | } |
| 1508 | } |
| 1509 | let mut req = rt_ctx |
| 1510 | .discord_config |
| 1511 | .client |
| 1512 | .delete_webhook(parsed_id.cast()); |
| 1513 | |
| 1514 | if let Some(token) = &arg.token { |
| 1515 | req = req.token(&token) |
| 1516 | } |
| 1517 | |
| 1518 | Ok(req.await?) |
| 1519 | }) |
| 1520 | .await?; |
| 1521 | |
| 1522 | Ok(()) |
| 1523 | } |
| 1524 | |
| 1525 | #[allow(async_fn_in_trait)] |
| 1526 | async fn discord_webhook_execute( |
nothing calls this directly
no test coverage detected