1
0
forked from bot/app

feat: 提供插件更新功能

This commit is contained in:
远野千束 2024-04-10 12:18:45 +08:00
parent e0dc840197
commit 23353a3673

View File

@ -427,9 +427,10 @@ def npm_install(plugin_package_name) -> tuple[bool, str]:
plugin_package_name: plugin_package_name:
Returns: Returns:
tuple[bool, str]: tuple[bool, str]: 是否成功输出信息
""" """
# 重定向标准输出
buffer = StringIO() buffer = StringIO()
sys.stdout = buffer sys.stdout = buffer
sys.stderr = buffer sys.stderr = buffer
@ -456,9 +457,8 @@ def npm_install(plugin_package_name) -> tuple[bool, str]:
if success: if success:
break break
else: else:
nonebot.logger.warning(f"npm_install failed, try next mirror.") nonebot.logger.warning(f"pip install failed, try next mirror.")
except Exception as e: except Exception as e:
success = False success = False
continue continue