diff --git a/main.py b/main.py index 4df8811..3d342a2 100644 --- a/main.py +++ b/main.py @@ -916,11 +916,22 @@ async def handle_issue_comment(payload: dict[str, Any]) -> None: if not repo_full_name or not pr_number: return msg = f"Новый комментарий в PR {repo_full_name}#{pr_number}: {body}" - for chat_id in await get_pr_participant_chat_ids( + recipient_chat_ids = await get_pr_participant_chat_ids( repo_full_name, int(pr_number), exclude_login=commenter_login, - ): + ) + if not recipient_chat_ids: + log_warn( + f"[notify] issue_comment без получателей для {repo_full_name}#{pr_number}. " + f"commenter={commenter_login}" + ) + return + log_info( + f"[notify] issue_comment для {repo_full_name}#{pr_number}, " + f"commenter={commenter_login}, получателей={len(recipient_chat_ids)}" + ) + for chat_id in recipient_chat_ids: await telegram_client.send_message(chat_id, msg) @@ -936,12 +947,23 @@ async def handle_pull_request_comment(payload: dict[str, Any]) -> None: if not repo_full_name or not pr_number or not body: return msg = f"Новый комментарий в PR {repo_full_name}#{pr_number}: {body}" - for chat_id in await get_pr_participant_chat_ids( + recipient_chat_ids = await get_pr_participant_chat_ids( repo_full_name, int(pr_number), pull_request=pull_request, exclude_login=commenter_login, - ): + ) + if not recipient_chat_ids: + log_warn( + f"[notify] pull_request_comment без получателей для {repo_full_name}#{pr_number}. " + f"commenter={commenter_login}" + ) + return + log_info( + f"[notify] pull_request_comment для {repo_full_name}#{pr_number}, " + f"commenter={commenter_login}, получателей={len(recipient_chat_ids)}" + ) + for chat_id in recipient_chat_ids: await telegram_client.send_message(chat_id, msg)