Support for export plug-in list for fast migration. (#112)

 支持导出插件列表进行快速迁移。
This commit is contained in:
Xtao_dada 2021-07-23 22:12:24 +08:00 committed by GitHub
parent 6b502a1478
commit 3b3b7f86e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 3 deletions

View File

@ -282,7 +282,7 @@ hitokoto_type_meme: trembling
# plugin
# apt
apt_des: Used to manage plugins installed to PagerMaid-Modify.
apt_parameters: "{update|search|show|status|install|remove|enable|disable|upload} <plugin name/file>"
apt_parameters: "{update|search|show|status|install|remove|enable|disable|upload|export} <plugin name/file>"
apt_processing: Installing plugins...
apt_no_py: Something went wrong ~ Failed to get the plug-in file from the attachment.
apt_plugin: plugin

View File

@ -295,7 +295,7 @@ hitokoto_type_meme: 抖机灵
# plugin
## apt
apt_des: 用于管理安装到 PagerMaid-Modify 的插件。
apt_parameters: "{update|search|show|status|install|remove|enable|disable|upload} <插件名称/文件>"
apt_parameters: "{update|search|show|status|install|remove|enable|disable|upload|export} <插件名称/文件>"
apt_processing: 安装插件中 . . .
apt_no_py: 出错了呜呜呜 ~ 无法从附件获取插件文件。
apt_plugin: 插件

View File

@ -277,7 +277,7 @@ hitokoto_type_meme: 迷因
# plugin
# apt
apt_des: 用於管理插件。
apt_parameters: "{update|search|show|status|install|remove|enable|disable|upload} <插件名稱/文件>"
apt_parameters: "{update|search|show|status|install|remove|enable|disable|upload|export} <插件名稱/文件>"
apt_processing: 安裝插件中…
apt_no_py: Error無法獲取插件文件。
apt_plugin: 插件

View File

@ -348,5 +348,26 @@ async def plugin(context):
await context.edit(lang('apt_search_not_found'))
else:
await context.edit(search_result)
elif context.parameter[0] == "export":
if not exists(f"{plugin_directory}version.json"):
await context.edit(lang('apt_why_not_install_a_plugin'))
return
await context.edit(lang('stats_loading'))
list_plugin = []
with open(f"{plugin_directory}version.json", 'r', encoding="utf-8") as f:
version_json = json.load(f)
temp, plugin_list = get_html(f"{git_source}list.json")
plugin_online = json.loads(plugin_list)['list']
for key, value in version_json.items():
if value == "0.0":
continue
for i in plugin_online:
if key == i['name']:
list_plugin.append(key)
break
if len(list_plugin) == 0:
await context.edit(lang('apt_why_not_install_a_plugin'))
else:
await context.edit('-apt install ' + ' '.join(list_plugin))
else:
await context.edit(lang('arg_error'))