MCPcopy
hub / github.com/AstrBotDevs/AstrBot / update_command

Function update_command

astrbot/dashboard/api/extensions.py:107–136  ·  view source on GitHub ↗
(
    command_id: str,
    payload: CommandUpdateRequest,
    _auth: AuthContext = Depends(require_tool_scope),
    service: CommandService = Depends(get_command_service),
)

Source from the content-addressed store, hash-verified

105
106@router.patch("/commands/{command_id:path}")
107async def update_command(
108 command_id: str,
109 payload: CommandUpdateRequest,
110 _auth: AuthContext = Depends(require_tool_scope),
111 service: CommandService = Depends(get_command_service),
112):
113 if payload.enabled is not None:
114 return await _toggle_command(
115 CommandToggleRequest(
116 handler_full_name=command_id,
117 enabled=payload.enabled,
118 ),
119 service,
120 )
121 if payload.alias is not None:
122 return await _rename_command(
123 CommandRenameRequest(
124 handler_full_name=command_id,
125 new_name=payload.alias,
126 aliases=payload.aliases,
127 ),
128 service,
129 )
130 return await _update_command_permission(
131 CommandPermissionRequest(
132 handler_full_name=command_id,
133 permission=payload.permission_group or "",
134 ),
135 service,
136 )
137
138
139@legacy_router.get("/commands")

Callers

nothing calls this directly

Calls 6

_toggle_commandFunction · 0.85
_rename_commandFunction · 0.85

Tested by

no test coverage detected