Compare commits

...

4 Commits

Author SHA1 Message Date
Rumio
f24f1e73cc
Merge e6f6ad0559 into eb6d90ae88 2025-10-22 20:57:24 +08:00
molanp
eb6d90ae88
docs(data-source): 更新插件安装函数的参数文档说明 (#2069)
Some checks failed
检查bot是否运行正常 / bot check (push) Has been cancelled
CodeQL Code Security Analysis / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Has been cancelled
CodeQL Code Security Analysis / Analyze (${{ matrix.language }}) (none, python) (push) Has been cancelled
Sequential Lint and Type Check / ruff-call (push) Has been cancelled
Release Drafter / Update Release Draft (push) Has been cancelled
Force Sync to Aliyun / sync (push) Has been cancelled
Update Version / update-version (push) Has been cancelled
Sequential Lint and Type Check / pyright-call (push) Has been cancelled
修改 StoreManager 类中安装插件函数的文档字符串,更新参数列表说
明。将原有的 github_url、module_path、is_dir 参数说明替换为
plugin_info 和 source 参数说明,保持文档与实际函数签名一致。
2025-10-22 20:57:07 +08:00
pre-commit-ci[bot]
e6f6ad0559 🚨 auto fix by pre-commit hooks 2025-10-22 10:22:51 +00:00
webjoin111
6815caf805 🐛 fix(tag): 修复黑名单标签解析逻辑并优化标签详情展示 2025-10-22 18:22:34 +08:00
5 changed files with 59 additions and 31 deletions

View File

@ -263,10 +263,9 @@ class StoreManager:
"""安装插件
参数:
github_url: 仓库地址
module_path: 模块路径
is_dir: 是否是文件夹
plugin_info: 插件信息
is_external: 是否是外部仓库
source:
"""
repo_type = RepoType.GITHUB if is_external else None
if source == "ali":

View File

@ -213,17 +213,31 @@ async def handle_info(name: Match[str], bot: Bot):
msg += f"模式: {mode}\n"
msg += f"描述: {details['description'] or ''}\n"
if details["tag_type"] == "DYNAMIC":
if details["tag_type"] == "STATIC" and details["is_blacklist"]:
msg += f"排除群组 ({len(details['groups'])}个):\n"
if details["groups"]:
msg += "\n".join(f"- {gid}" for gid in details["groups"])
else:
msg += ""
msg += "\n\n"
if details["tag_type"] == "DYNAMIC" and details.get("dynamic_rule"):
msg += f"动态规则: {details['dynamic_rule']}\n"
if details["resolved_groups"] is not None:
msg += f"当前匹配群组 ({len(details['resolved_groups'])}个):\n"
if details["resolved_groups"]:
msg += "\n".join(
f"- {g_name} ({g_id})"
for g_id, g_name in details["resolved_groups"]
)
else:
msg += ""
title = (
"当前生效群组"
if details["tag_type"] == "DYNAMIC" or details["is_blacklist"]
else "关联群组"
)
if details["resolved_groups"] is not None:
msg += f"{title} ({len(details['resolved_groups'])}个):\n"
if details["resolved_groups"]:
msg += "\n".join(
f"- {g_name} ({g_id})" for g_id, g_name in details["resolved_groups"]
)
else:
msg += ""
else:
msg += f"关联群组 ({len(details['groups'])}个):\n"
if details["groups"]:

View File

@ -468,9 +468,7 @@ class SchedulerManager:
"required_permission": required_permission,
"source": source,
"is_one_off": is_one_off,
"execution_options": model_dump(
validated_options, exclude_none=True
),
"execution_options": model_dump(validated_options, exclude_none=True),
}
defaults = {k: v for k, v in defaults.items() if v is not None}

View File

@ -77,6 +77,7 @@ class Trigger:
"""创建一个 Date 触发器配置。"""
return DateTrigger(**kwargs)
class ExecutionOptions(BaseModel):
"""
封装定时任务的执行策略包括重试和回调

View File

@ -234,16 +234,13 @@ class TagManager:
if not tag:
return None
resolved_groups = None
if tag.tag_type == "DYNAMIC" and bot:
resolved_group_ids = await self.resolve_tag_to_group_ids(name, bot=bot)
if resolved_group_ids:
groups_from_db = await GroupConsole.filter(
group_id__in=resolved_group_ids
).all()
resolved_groups = [(g.group_id, g.group_name) for g in groups_from_db]
else:
resolved_groups = []
final_group_ids = await self.resolve_tag_to_group_ids(name, bot=bot)
resolved_groups: list[tuple[str, str]] = []
if final_group_ids:
groups_from_db = await GroupConsole.filter(
group_id__in=final_group_ids
).all()
resolved_groups = [(g.group_id, g.group_name) for g in groups_from_db]
return {
"name": tag.name,
@ -418,18 +415,37 @@ class TagManager:
if not tag:
return []
if tag.tag_type == "DYNAMIC":
associated_groups: set[str] = set()
if tag.tag_type == "STATIC":
associated_groups = {str(link.group_id) for link in tag.groups}
elif tag.tag_type == "DYNAMIC":
if not tag.dynamic_rule or not isinstance(tag.dynamic_rule, dict | str):
return []
associated_groups = await self._resolve_dynamic_tag(tag.dynamic_rule, bot)
dynamic_ids = await self._resolve_dynamic_tag(tag.dynamic_rule, bot)
associated_groups = {str(gid) for gid in dynamic_ids}
else:
associated_groups = {link.group_id for link in tag.groups}
associated_groups = {str(link.group_id) for link in tag.groups}
if tag.is_blacklist:
all_group_ids_from_db = await GroupConsole.all().values_list(
all_groups_query = GroupConsole.all()
if bot:
bot_groups, _ = await PlatformUtils.get_group_list(bot)
bot_group_ids = {str(g.group_id) for g in bot_groups if g.group_id}
if bot_group_ids:
all_groups_query = all_groups_query.filter(
group_id__in=bot_group_ids
)
else:
return []
all_relevant_group_ids_from_db = await all_groups_query.values_list(
"group_id", flat=True
)
return list({str(gid) for gid in all_group_ids_from_db} - associated_groups)
all_relevant_group_ids = {
str(gid) for gid in all_relevant_group_ids_from_db
}
return list(all_relevant_group_ids - associated_groups)
else:
return list(associated_groups)