mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-09 10:17:56 +08:00
🐛 查询订阅时提示不存在的平台 (#584)
* 🐛 查询订阅时提示不存在的平台 fix #515 * 💄 auto fix by pre-commit hooks * 🐛 删除订阅时,获取详细信息跳过不存在的platform * ✅ 添加对于不存在的平台的单元测试 * 🐛 删除订阅时跳过不存在的platform * 💄 规范化订阅列表的输出 * 💄 规范化订阅列表的输出 * 💄 规范化订阅列表的输出 * 💄 规范化订阅列表的输出 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -52,6 +52,8 @@ async def handle_insert_new_target(platform_name: str, target: T_Target):
|
||||
|
||||
|
||||
async def handle_delete_target(platform_name: str, target: T_Target):
|
||||
if platform_name not in platform_manager:
|
||||
return
|
||||
platform = platform_manager[platform_name]
|
||||
scheduler_obj = scheduler_dict[platform.site]
|
||||
scheduler_obj.delete_schedulable(platform_name, target)
|
||||
|
||||
@@ -28,12 +28,15 @@ def do_del_sub(del_sub: type[Matcher]):
|
||||
"target": sub.target.target,
|
||||
}
|
||||
res += f"{index} {sub.target.platform_name} {sub.target.target_name} {sub.target.target}\n"
|
||||
platform = platform_manager[sub.target.platform_name]
|
||||
if platform.categories:
|
||||
res += " [{}]".format(", ".join(platform.categories[Category(x)] for x in sub.categories))
|
||||
if platform.enable_tag:
|
||||
res += " {}".format(", ".join(sub.tags))
|
||||
res += "\n"
|
||||
if platform := platform_manager.get(sub.target.platform_name):
|
||||
if platform.categories:
|
||||
res += " [{}]".format(", ".join(platform.categories[Category(x)] for x in sub.categories))
|
||||
if platform.enable_tag:
|
||||
res += " {}".format(", ".join(sub.tags))
|
||||
else:
|
||||
res += f" (平台 {sub.target.platform_name} 已失效,请删除此订阅)"
|
||||
if res[-1] != "\n":
|
||||
res += "\n"
|
||||
res += "请输入要删除的订阅的序号\n输入'取消'中止"
|
||||
await MessageFactory(await parse_text(res)).send()
|
||||
|
||||
|
||||
@@ -17,12 +17,15 @@ def do_query_sub(query_sub: type[Matcher]):
|
||||
sub_list = await config.list_subscribe(user_info)
|
||||
res = "订阅的帐号为:\n"
|
||||
for sub in sub_list:
|
||||
res += f"{sub.target.platform_name} {sub.target.target_name} {sub.target.target}"
|
||||
platform = platform_manager[sub.target.platform_name]
|
||||
if platform.categories:
|
||||
res += " [{}]".format(", ".join(platform.categories[Category(x)] for x in sub.categories))
|
||||
if platform.enable_tag:
|
||||
res += " {}".format(", ".join(sub.tags))
|
||||
res += "\n"
|
||||
res += f"{sub.target.platform_name} {sub.target.target_name} {sub.target.target}\n"
|
||||
if platform := platform_manager.get(sub.target.platform_name):
|
||||
if platform.categories:
|
||||
res += " [{}]".format(", ".join(platform.categories[Category(x)] for x in sub.categories))
|
||||
if platform.enable_tag:
|
||||
res += " {}".format(", ".join(sub.tags))
|
||||
else:
|
||||
res += f" (平台 {sub.target.platform_name} 已失效,请删除此订阅)"
|
||||
if res[-1] != "\n":
|
||||
res += "\n"
|
||||
await MessageFactory(await parse_text(res)).send()
|
||||
await query_sub.finish()
|
||||
|
||||
Reference in New Issue
Block a user