Skip to content

Commit b2c2cdb

Browse files
authored
Merge pull request #5 from XXXxx7258/path
Path
2 parents 039a297 + 0b08b37 commit b2c2cdb

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

src/recv_handler/message_handler.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,11 @@ async def check_allow_to_chat(self, user_id: int, chat_id: Optional[int], chat_t
5757
logger.warning("群聊在聊天黑名单中,消息被丢弃")
5858
return False
5959
else:
60-
# Telegram 私聊场景:chat.id 是对端用户 ID;from.id 是实际发送者(可能为 bot 自己)。
61-
# 访问控制应基于“对端用户”,因此优先使用 chat_id。
62-
peer_user_id = chat_id if chat_id is not None else user_id
63-
if (
64-
global_config.chat.private_list_type == "whitelist"
65-
and peer_user_id not in global_config.chat.private_list
66-
):
60+
# 私聊 ACL 有意按发送者 user_id 过滤(与上游 main 当前行为保持一致)。
61+
if global_config.chat.private_list_type == "whitelist" and user_id not in global_config.chat.private_list:
6762
logger.warning("私聊不在聊天白名单中,消息被丢弃")
6863
return False
69-
if global_config.chat.private_list_type == "blacklist" and peer_user_id in global_config.chat.private_list:
64+
if global_config.chat.private_list_type == "blacklist" and user_id in global_config.chat.private_list:
7065
logger.warning("私聊在聊天黑名单中,消息被丢弃")
7166
return False
7267
if user_id in global_config.chat.ban_user_id:
@@ -135,7 +130,7 @@ async def handle_update(self, update: Dict[str, Any]) -> None:
135130
logger.warning("处理后消息内容为空")
136131
return
137132
if is_from_bot:
138-
# 不拦截 bot 自发消息;但打标供上游(如需要)区分,避免业务侧误触发循环
133+
# 到达此处说明消息已通过 ACL;这里仅为 bot 自发消息打标,供上游按需区分
139134
additional_config["from_bot"] = True
140135

141136
submit_seg = Seg(type="seglist", data=seg_list)

0 commit comments

Comments
 (0)