mirror of
https://github.com/TriM-Organization/LiteyukiBot-TriM.git
synced 2024-11-24 16:15:03 +08:00
🐛 npm
显示异常
This commit is contained in:
parent
4dd3b4aedc
commit
7585a5473d
@ -254,7 +254,7 @@ async def _(result: Arparma, event: T_MessageEvent, bot: T_Bot, npm: Matcher):
|
|||||||
)
|
)
|
||||||
|
|
||||||
elif sc.get("uninstall") and perm_s:
|
elif sc.get("uninstall") and perm_s:
|
||||||
plugin_name: str = result.subcommands["uninstall"].args.get("plugin_name")
|
plugin_name: str = result.subcommands["uninstall"].args.get("plugin_name") # type: ignore
|
||||||
found_installed_plugin: InstalledPlugin = plugin_db.first(InstalledPlugin(), "module_name = ?", plugin_name)
|
found_installed_plugin: InstalledPlugin = plugin_db.first(InstalledPlugin(), "module_name = ?", plugin_name)
|
||||||
if found_installed_plugin:
|
if found_installed_plugin:
|
||||||
plugin_db.delete(InstalledPlugin(), "module_name = ?", plugin_name)
|
plugin_db.delete(InstalledPlugin(), "module_name = ?", plugin_name)
|
||||||
@ -286,16 +286,16 @@ async def _(result: Arparma, event: T_MessageEvent, bot: T_Bot, npm: Matcher):
|
|||||||
store_plugin = await get_store_plugin(storePlugin.name)
|
store_plugin = await get_store_plugin(storePlugin.name)
|
||||||
session_enable = get_plugin_session_enable(event, storePlugin.name)
|
session_enable = get_plugin_session_enable(event, storePlugin.name)
|
||||||
if store_plugin:
|
if store_plugin:
|
||||||
btn_homepage = md.btn_link(ulang.get("npm.homepage"), store_plugin.homepage)
|
# btn_homepage = md.btn_link(ulang.get("npm.homepage"), store_plugin.homepage)
|
||||||
show_name = store_plugin.name
|
show_name = store_plugin.name
|
||||||
elif storePlugin.metadata:
|
elif storePlugin.metadata:
|
||||||
if storePlugin.metadata.extra.get("liteyuki"):
|
# if storePlugin.metadata.extra.get("liteyuki"):
|
||||||
btn_homepage = md.btn_link(ulang.get("npm.homepage"), "https://github.com/snowykami/LiteyukiBot")
|
# btn_homepage = md.btn_link(ulang.get("npm.homepage"), "https://github.com/snowykami/LiteyukiBot")
|
||||||
else:
|
# else:
|
||||||
btn_homepage = ulang.get("npm.homepage")
|
# btn_homepage = ulang.get("npm.homepage")
|
||||||
show_name = storePlugin.metadata.name
|
show_name = storePlugin.metadata.name
|
||||||
else:
|
else:
|
||||||
btn_homepage = ulang.get("npm.homepage")
|
# btn_homepage = ulang.get("npm.homepage")
|
||||||
show_name = storePlugin.name
|
show_name = storePlugin.name
|
||||||
ulang.get("npm.no_description")
|
ulang.get("npm.no_description")
|
||||||
|
|
||||||
@ -304,7 +304,7 @@ async def _(result: Arparma, event: T_MessageEvent, bot: T_Bot, npm: Matcher):
|
|||||||
else:
|
else:
|
||||||
reply += f"**{md.escape(show_name)}**\n"
|
reply += f"**{md.escape(show_name)}**\n"
|
||||||
|
|
||||||
reply += f"\n > {btn_usage} {btn_homepage}"
|
reply += f"\n > {btn_usage}"
|
||||||
|
|
||||||
if permission_oas:
|
if permission_oas:
|
||||||
# 添加启用/停用插件按钮
|
# 添加启用/停用插件按钮
|
||||||
@ -312,7 +312,7 @@ async def _(result: Arparma, event: T_MessageEvent, bot: T_Bot, npm: Matcher):
|
|||||||
text_toggle = ulang.get("npm.disable" if session_enable else "npm.enable")
|
text_toggle = ulang.get("npm.disable" if session_enable else "npm.enable")
|
||||||
can_be_toggle = get_plugin_can_be_toggle(storePlugin.name)
|
can_be_toggle = get_plugin_can_be_toggle(storePlugin.name)
|
||||||
btn_toggle = text_toggle if not can_be_toggle else md.btn_cmd(text_toggle, cmd_toggle)
|
btn_toggle = text_toggle if not can_be_toggle else md.btn_cmd(text_toggle, cmd_toggle)
|
||||||
reply += f" {btn_toggle}"
|
reply += f" {btn_toggle}"
|
||||||
|
|
||||||
if permission_s:
|
if permission_s:
|
||||||
plugin_in_database = plugin_db.first(InstalledPlugin(), "module_name = ?", storePlugin.name)
|
plugin_in_database = plugin_db.first(InstalledPlugin(), "module_name = ?", storePlugin.name)
|
||||||
@ -325,7 +325,7 @@ async def _(result: Arparma, event: T_MessageEvent, bot: T_Bot, npm: Matcher):
|
|||||||
cmd_toggle_global = f"npm {'disable' if global_enable else 'enable'}-global {storePlugin.name}"
|
cmd_toggle_global = f"npm {'disable' if global_enable else 'enable'}-global {storePlugin.name}"
|
||||||
btn_toggle_global = btn_toggle_global_text if not can_be_toggle else md.btn_cmd(btn_toggle_global_text, cmd_toggle_global)
|
btn_toggle_global = btn_toggle_global_text if not can_be_toggle else md.btn_cmd(btn_toggle_global_text, cmd_toggle_global)
|
||||||
|
|
||||||
reply += f" {btn_uninstall} {btn_toggle_global}"
|
reply += f" {btn_uninstall} {btn_toggle_global}"
|
||||||
reply += "\n\n***\n"
|
reply += "\n\n***\n"
|
||||||
# 根据页数添加翻页按钮。第一页显示上一页文本而不是按钮,最后一页显示下一页文本而不是按钮
|
# 根据页数添加翻页按钮。第一页显示上一页文本而不是按钮,最后一页显示下一页文本而不是按钮
|
||||||
btn_prev = md.btn_cmd(ulang.get("npm.prev_page"), f"npm list {page - 1} {num_per_page}") if page > 1 else ulang.get("npm.prev_page")
|
btn_prev = md.btn_cmd(ulang.get("npm.prev_page"), f"npm list {page - 1} {num_per_page}") if page > 1 else ulang.get("npm.prev_page")
|
||||||
@ -335,56 +335,55 @@ async def _(result: Arparma, event: T_MessageEvent, bot: T_Bot, npm: Matcher):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
if await SUPERUSER(bot, event):
|
if await SUPERUSER(bot, event):
|
||||||
btn_enable_global = md.btn_cmd(ulang.get("npm.enable_global"), "npm enable-global", False, False)
|
btn_enable_global = md.btn_cmd(ulang.get("npm.enable_global"), "npm enable-global", False, False)
|
||||||
btn_disable_global = md.btn_cmd(ulang.get("npm.disable_global"), "npm disable-global", False, False)
|
btn_disable_global = md.btn_cmd(ulang.get("npm.disable_global"), "npm disable-global", False, False)
|
||||||
btn_search = md.btn_cmd(ulang.get("npm.search"), "npm search ", False, False)
|
btn_search = md.btn_cmd(ulang.get("npm.search"), "npm search ", False, False)
|
||||||
btn_uninstall_ = md.btn_cmd(ulang.get("npm.uninstall"), "npm uninstall ", False, False)
|
btn_uninstall_ = md.btn_cmd(ulang.get("npm.uninstall"), "npm uninstall ", False, False)
|
||||||
btn_install_ = md.btn_cmd(ulang.get("npm.install"), "npm install ", False, False)
|
btn_install_ = md.btn_cmd(ulang.get("npm.install"), "npm install ", False, False)
|
||||||
btn_update = md.btn_cmd(ulang.get("npm.update_index"), "npm update", False, True)
|
btn_update = md.btn_cmd(ulang.get("npm.update_index"), "npm update", False, True)
|
||||||
btn_list = md.btn_cmd(ulang.get("npm.list_plugins"), "npm list ", False, False)
|
btn_list = md.btn_cmd(ulang.get("npm.list_plugins"), "npm list ", False, False)
|
||||||
btn_disable = md.btn_cmd(ulang.get("npm.disable_session"), "npm disable ", False, False)
|
btn_disable = md.btn_cmd(ulang.get("npm.disable_session"), "npm disable ", False, False)
|
||||||
btn_enable = md.btn_cmd(ulang.get("npm.enable_session"), "npm enable ", False, False)
|
btn_enable = md.btn_cmd(ulang.get("npm.enable_session"), "npm enable ", False, False)
|
||||||
reply = (
|
reply = (
|
||||||
f"\n# **{ulang.get('npm.help')}**"
|
f"\n# **{ulang.get('npm.help')}**"
|
||||||
f"\n{btn_update}"
|
f"\n{btn_update}"
|
||||||
f"\n>*{md.escape('npm update')}*\n"
|
f"\n\n>*{md.escape('npm update')}*\n"
|
||||||
f"\n{btn_install_}"
|
f"\n{btn_install_}"
|
||||||
f"\n>*{md.escape('npm install <plugin_name>')}*\n"
|
f"\n\n>*{md.escape('npm install <plugin_name>')}*\n"
|
||||||
f"\n{btn_uninstall_}"
|
f"\n{btn_uninstall_}"
|
||||||
f"\n>*{md.escape('npm uninstall <plugin_name>')}*\n"
|
f"\n\n>*{md.escape('npm uninstall <plugin_name>')}*\n"
|
||||||
f"\n{btn_search}"
|
f"\n{btn_search}"
|
||||||
f"\n>*{md.escape('npm search <keywords...>')}*\n"
|
f"\n\n>*{md.escape('npm search <keywords...>')}*\n"
|
||||||
f"\n{btn_disable_global}"
|
f"\n{btn_disable_global}"
|
||||||
f"\n>*{md.escape('npm disable-global <plugin_name>')}*\n"
|
f"\n\n>*{md.escape('npm disable-global <plugin_name>')}*\n"
|
||||||
f"\n{btn_enable_global}"
|
f"\n{btn_enable_global}"
|
||||||
f"\n>*{md.escape('npm enable-global <plugin_name>')}*\n"
|
f"\n\n>*{md.escape('npm enable-global <plugin_name>')}*\n"
|
||||||
f"\n{btn_uninstall_}"
|
f"\n{btn_uninstall_}"
|
||||||
f"\n>*{md.escape('npm uninstall <plugin_name>')}*\n"
|
f"\n\n>*{md.escape('npm uninstall <plugin_name>')}*\n"
|
||||||
f"\n{btn_disable}"
|
f"\n{btn_disable}"
|
||||||
f"\n>*{md.escape('npm disable <plugin_name>')}*\n"
|
f"\n\n>*{md.escape('npm disable <plugin_name>')}*\n"
|
||||||
f"\n{btn_enable}"
|
f"\n{btn_enable}"
|
||||||
f"\n>*{md.escape('npm enable <plugin_name>')}*\n"
|
f"\n\n>*{md.escape('npm enable <plugin_name>')}*\n"
|
||||||
f"\n{btn_list}"
|
f"\n{btn_list}"
|
||||||
f"\n>page为页数,num为每页显示数量"
|
f"\n\n>page为页数,num为每页显示数量"
|
||||||
f"\n>*{md.escape('npm list [page] [num]')}*"
|
f"\n\n>*{md.escape('npm list [page] [num]')}*"
|
||||||
)
|
)
|
||||||
await md.send_md(reply, bot, event=event)
|
await md.send_md(reply, bot, event=event)
|
||||||
else:
|
else:
|
||||||
|
|
||||||
btn_list = md.btn_cmd(ulang.get("npm.list_plugins"), "npm list ", False, False)
|
btn_list = md.btn_cmd(ulang.get("npm.list_plugins"), "npm list ", False, False)
|
||||||
btn_disable = md.btn_cmd(ulang.get("npm.disable_session"), "npm disable ", False, False)
|
btn_disable = md.btn_cmd(ulang.get("npm.disable_session"), "npm disable ", False, False)
|
||||||
btn_enable = md.btn_cmd(ulang.get("npm.enable_session"), "npm enable ", False, False)
|
btn_enable = md.btn_cmd(ulang.get("npm.enable_session"), "npm enable ", False, False)
|
||||||
reply = (
|
reply = (
|
||||||
f"\n# **{ulang.get('npm.help')}**"
|
f"\n# **{ulang.get('npm.help')}**"
|
||||||
f"\n{btn_disable}"
|
f"\n{btn_disable}"
|
||||||
f"\n>*{md.escape('npm disable <plugin_name>')}*\n"
|
f"\n\n>*{md.escape('npm disable <plugin_name>')}*\n"
|
||||||
f"\n{btn_enable}"
|
f"\n{btn_enable}"
|
||||||
f"\n>*{md.escape('npm enable <plugin_name>')}*\n"
|
f"\n\n>*{md.escape('npm enable <plugin_name>')}*\n"
|
||||||
f"\n{btn_list}"
|
f"\n{btn_list}"
|
||||||
f"\n>page为页数,num为每页显示数量"
|
f"\n\n>page为页数,num为每页显示数量"
|
||||||
f"\n>*{md.escape('npm list [page] [num]')}*"
|
f"\n\n>*{md.escape('npm list [page] [num]')}*"
|
||||||
)
|
)
|
||||||
|
|
||||||
await md.send_md(reply, bot, event=event)
|
await md.send_md(reply, bot, event=event)
|
||||||
|
|
||||||
|
|
||||||
@ -465,13 +464,23 @@ async def _(result: Arparma, matcher: Matcher, event: T_MessageEvent, bot: T_Bot
|
|||||||
module_name=plugin_name,
|
module_name=plugin_name,
|
||||||
homepage=""
|
homepage=""
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if store_plugin:
|
||||||
|
link = store_plugin.homepage
|
||||||
|
elif loaded_plugin.metadata.extra.get("liteyuki"):
|
||||||
|
link = "https://github.com/snowykami/LiteyukiBot"
|
||||||
|
else:
|
||||||
|
link = None
|
||||||
|
|
||||||
reply = [
|
reply = [
|
||||||
mdc.heading(escape_md(loaded_plugin.metadata.name)),
|
mdc.heading(escape_md(store_plugin.name)),
|
||||||
|
mdc.quote(store_plugin.module_name),
|
||||||
mdc.quote(mdc.bold(ulang.get("npm.author")) + " " +
|
mdc.quote(mdc.bold(ulang.get("npm.author")) + " " +
|
||||||
(mdc.link(store_plugin.author, f"https://github.com/{store_plugin.author}") if store_plugin.author else "Unknown")),
|
(mdc.link(store_plugin.author, f"https://github.com/{store_plugin.author}") if store_plugin.author else "Unknown")),
|
||||||
mdc.quote(mdc.bold(ulang.get("npm.description")) + " " + mdc.paragraph(max(loaded_plugin.metadata.description, store_plugin.desc))),
|
mdc.quote(mdc.bold(ulang.get("npm.description")) + " " + mdc.paragraph(max(loaded_plugin.metadata.description, store_plugin.desc))),
|
||||||
mdc.heading(ulang.get("npm.usage"), 2),
|
mdc.heading(ulang.get("npm.usage"), 2),
|
||||||
mdc.paragraph(escape_md(loaded_plugin.metadata.usage)),
|
mdc.quote(escape_md(loaded_plugin.metadata.usage)),
|
||||||
|
mdc.link(ulang.get("npm.homepage"), link) if link else mdc.paragraph(ulang.get("npm.no_homepage"))
|
||||||
]
|
]
|
||||||
await md.send_md(compile_md(reply), bot, event=event)
|
await md.send_md(compile_md(reply), bot, event=event)
|
||||||
else:
|
else:
|
||||||
|
@ -128,13 +128,8 @@ weather.city_not_found=未找到城市 {CITY}
|
|||||||
weather.weather_not_found=未找到城市 {CITY} 的天气信息
|
weather.weather_not_found=未找到城市 {CITY} 的天气信息
|
||||||
weather.no_key=未设置天气api key,请在配置文件添加weather-key
|
weather.no_key=未设置天气api key,请在配置文件添加weather-key
|
||||||
|
|
||||||
npm.enable_global = 全局启用插件
|
npm.update_index=更新插件商店索引
|
||||||
npm.disable_global = 全局停用插件
|
npm.list_plugins=列出所有插件
|
||||||
npm.search = 搜索插件
|
npm.disable_session=当前会话停用插件
|
||||||
npm.uninstall = 卸载插件
|
npm.enable_session=当前会话启用插件
|
||||||
npm.install = 安装插件
|
npm.help=帮助
|
||||||
npm.update_index = 更新插件商店索引
|
|
||||||
npm.list_plugins = 列出所有插件
|
|
||||||
npm.disable_session = 当前会话停用插件
|
|
||||||
npm.enable_session = 当前会话启用插件
|
|
||||||
npm.help = npm帮助
|
|
||||||
|
Loading…
Reference in New Issue
Block a user