MCPcopy Create free account
hub / github.com/Botloader/botloader / delete_guild_script

Function delete_guild_script

components/webapi/src/routes/scripts.rs:244–268  ·  view source on GitHub ↗
(
    State(state): State<AppState>,
    Extension(current_guild): Extension<CurrentUserGuild>,
    Path(GuildScriptPathParams { script_id }): Path<GuildScriptPathParams>,
)

Source from the content-addressed store, hash-verified

242}
243
244pub async fn delete_guild_script(
245 State(state): State<AppState>,
246 Extension(current_guild): Extension<CurrentUserGuild>,
247 Path(GuildScriptPathParams { script_id }): Path<GuildScriptPathParams>,
248) -> ApiResult<impl IntoResponse> {
249 let script = state
250 .db
251 .get_script_by_id(current_guild.id, script_id)
252 .await
253 .map_err(|err| {
254 error!(%err, "failed fetching guild script");
255 ApiErrorResponse::InternalError
256 })?;
257
258 state
259 .db
260 .del_script(current_guild.id, script.name.clone())
261 .await
262 .map_err(|err| {
263 error!(%err, "failed deleting guild script");
264 ApiErrorResponse::InternalError
265 })?;
266
267 Ok(Json(script))
268}
269
270pub async fn update_script_plugin(
271 State(state): State<AppState>,

Callers

nothing calls this directly

Calls 2

get_script_by_idMethod · 0.80
del_scriptMethod · 0.80

Tested by

no test coverage detected