Skip to content

Filter out deactivated users before adding friends#25

Open
konard wants to merge 3 commits intomainfrom
issue-9-261f600c
Open

Filter out deactivated users before adding friends#25
konard wants to merge 3 commits intomainfrom
issue-9-261f600c

Conversation

@konard
Copy link
Copy Markdown
Owner

@konard konard commented Oct 17, 2025

Summary

Fixes #9 - Prevents error 177 "Cannot add this user to friends as user not found" by checking user status before attempting to add them as friends.

Problem

The acceptAllFriendRequests.js script was encountering error 177 when trying to add deactivated (deleted or banned) users as friends. The VK API returns this error when attempting to add users who:

  • Have deleted accounts
  • Have been banned
  • Are blocked
  • Have certain privacy restrictions

Solution

Added user verification using API.users.get() with the deactivated field before attempting to add friends:

  1. Fetch user information for all friend requests with the deactivated field
  2. Filter out users who have the deactivated status (values: "deleted" or "banned")
  3. Only add active users as friends
  4. Return the list of successfully added users instead of all requests

Changes

  • Modified Application/acceptAllFriendRequests.js to check user status before adding
  • Returns array of successfully added user IDs instead of all request IDs

Testing

The solution follows the same pattern used in other scripts in the repository (e.g., deleteFirstDeactivatedFriend.js) for checking deactivated users.


🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: undefined
@konard konard self-assigned this Oct 17, 2025
This commit fixes issue #9 by checking user status before attempting to add them as friends. The solution:

1. Fetches user information with the 'deactivated' field
2. Filters out users with deactivated status (deleted or banned)
3. Only adds active users to avoid error 177 "Cannot add this user to friends as user not found"
4. Returns the list of successfully added users

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Add users that are not blocked or deactivated (Cannot add this user to friends as user not found error) Filter out deactivated users before adding friends Oct 17, 2025
@konard konard marked this pull request as ready for review October 17, 2025 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add users that are not blocked or deactivated (Cannot add this user to friends as user not found error)

1 participant