881b409ebc
* feat: improve plugin failure handling and extension list UX * fix: address plugin review comments * fix: clear stale reload feedback on failed plugin reload * fix: refine extension i18n and uninstall flow * fix: refresh extension list after install failure * feat: add random plugin visibility controls in market * refactor: extract extension helpers and simplify uninstall flow * refactor: improve failed plugin diagnostics and uninstall flow * refactor: streamline extension uninstall flow * fix: harden failed plugin install tracking and cleanup * refactor: simplify extension flows and remove unused timed message * fix: improve failed uninstall idempotency and extension error handling * refactor: unify extension install-uninstall orchestration
19 lines
673 B
Python
19 lines
673 B
Python
"""Shared plugin error message templates for star manager flows."""
|
|
|
|
PLUGIN_ERROR_TEMPLATES = {
|
|
"not_found_in_failed_list": "插件不存在于失败列表中。",
|
|
"reserved_plugin_cannot_uninstall": "该插件是 AstrBot 保留插件,无法卸载。",
|
|
"failed_plugin_dir_remove_error": (
|
|
"移除失败插件成功,但是删除插件文件夹失败: {error}。"
|
|
"您可以手动删除该文件夹,位于 addons/plugins/ 下。"
|
|
),
|
|
}
|
|
|
|
|
|
def format_plugin_error(key: str, **kwargs) -> str:
|
|
template = PLUGIN_ERROR_TEMPLATES.get(key, key)
|
|
try:
|
|
return template.format(**kwargs)
|
|
except Exception:
|
|
return template
|