MCPcopy Index your code
hub / github.com/AstrBotDevs/AstrBot / update

Function update

astrbot/cli/commands/cmd_plug.py:217–252  ·  view source on GitHub ↗

Update plugins

(name: str, proxy: str | None)

Source from the content-addressed store, hash-verified

215@click.argument("name", required=False)
216@click.option("--proxy", help="GitHub proxy address")
217def update(name: str, proxy: str | None) -> None:
218 """Update plugins"""
219 base_path = _get_data_path()
220 plug_path = base_path / "plugins"
221 plugins = build_plug_list(base_path / "plugins")
222
223 if name:
224 plugin = next(
225 (
226 p
227 for p in plugins
228 if p["name"] == name and p["status"] == PluginStatus.NEED_UPDATE
229 ),
230 None,
231 )
232
233 if not plugin:
234 raise click.ClickException(
235 f"Plugin {name} does not need updating or cannot be updated"
236 )
237
238 manage_plugin(plugin, plug_path, is_update=True, proxy=proxy)
239 else:
240 need_update_plugins = [
241 p for p in plugins if p["status"] == PluginStatus.NEED_UPDATE
242 ]
243
244 if not need_update_plugins:
245 click.echo("No plugins need updating")
246 return
247
248 click.echo(f"Found {len(need_update_plugins)} plugin(s) needing update")
249 for plugin in need_update_plugins:
250 plugin_name = plugin["name"]
251 click.echo(f"Updating plugin {plugin_name}...")
252 manage_plugin(plugin, plug_path, is_update=True, proxy=proxy)
253
254
255@plug.command()

Callers 13

update_kb_statsMethod · 0.50
update_conversationMethod · 0.50
touch_api_keyMethod · 0.50
revoke_api_keyMethod · 0.50
update_personaMethod · 0.50
update_persona_folderMethod · 0.50
delete_persona_folderMethod · 0.50
update_chatui_projectMethod · 0.50

Calls 3

_get_data_pathFunction · 0.85
build_plug_listFunction · 0.85
manage_pluginFunction · 0.85

Tested by

no test coverage detected