mirror of
https://github.com/Nezumi-2711/astrbot_plugin_qq_group_daily_analysis.git
synced 2026-09-22 13:38:43 +00:00
fix: 统一test权限判定并支持TG话题父级匹配
This commit is contained in:
@@ -919,7 +919,13 @@ class QQGroupDailyAnalysis(Star):
|
|||||||
yield event.plain_result("✅ 已重新加载配置并重启定时任务")
|
yield event.plain_result("✅ 已重新加载配置并重启定时任务")
|
||||||
|
|
||||||
elif action == "test":
|
elif action == "test":
|
||||||
if not self.config_manager.is_group_allowed(group_id):
|
check_target = getattr(event, "unified_msg_origin", None)
|
||||||
|
if not check_target:
|
||||||
|
check_target = (
|
||||||
|
f"{self._get_platform_id_from_event(event)}:GroupMessage:{group_id}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if not self.config_manager.is_group_allowed(check_target):
|
||||||
yield event.plain_result("❌ 请先启用当前群的分析功能")
|
yield event.plain_result("❌ 请先启用当前群的分析功能")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -62,11 +62,19 @@ class ConfigManager:
|
|||||||
target = str(group_id_or_umo)
|
target = str(group_id_or_umo)
|
||||||
|
|
||||||
target_simple_id = target.split(":")[-1] if ":" in target else target
|
target_simple_id = target.split(":")[-1] if ":" in target else target
|
||||||
|
target_parent_id = (
|
||||||
|
target_simple_id.split("#", 1)[0]
|
||||||
|
if "#" in target_simple_id
|
||||||
|
else target_simple_id
|
||||||
|
)
|
||||||
|
|
||||||
def _is_match(item: str, target: str, target_simple_id: str) -> bool:
|
def _is_match(item: str, target: str, target_simple_id: str) -> bool:
|
||||||
if ":" in item:
|
if ":" in item:
|
||||||
return item == target
|
return item == target
|
||||||
return item == target_simple_id
|
if item == target_simple_id:
|
||||||
|
return True
|
||||||
|
# 允许 Telegram 话题会话通过父群 ID 命中简单群号白/黑名单
|
||||||
|
return "#" in target_simple_id and item == target_parent_id
|
||||||
|
|
||||||
is_in_list = any(_is_match(item, target, target_simple_id) for item in glist)
|
is_in_list = any(_is_match(item, target, target_simple_id) for item in glist)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user