Skip to content

Commit de77cb9

Browse files
committed
fix: restore private list check to upstream behavior
1 parent a7a9ff6 commit de77cb9

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

src/recv_handler/message_handler.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,10 @@ 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+
if global_config.chat.private_list_type == "whitelist" and user_id not in global_config.chat.private_list:
6761
logger.warning("私聊不在聊天白名单中,消息被丢弃")
6862
return False
69-
if global_config.chat.private_list_type == "blacklist" and peer_user_id in global_config.chat.private_list:
63+
if global_config.chat.private_list_type == "blacklist" and user_id in global_config.chat.private_list:
7064
logger.warning("私聊在聊天黑名单中,消息被丢弃")
7165
return False
7266
if user_id in global_config.chat.ban_user_id:

0 commit comments

Comments
 (0)