Skip to content

Add function to select and accept best friend request - #27

Open
konard wants to merge 3 commits into
mainfrom
issue-12-94d352c3
Open

Add function to select and accept best friend request#27
konard wants to merge 3 commits into
mainfrom
issue-12-94d352c3

Conversation

@konard

@konard konard commented Oct 17, 2025

Copy link
Copy Markdown
Owner

Summary

Implements a function that selects and accepts the best match from incoming friend requests based on the following criteria:

  • User is online - Only considers users who are currently online
  • User has maximum common friends - Prioritizes users with the most mutual friends
  • User is not blocked or deactivated - Filters out deactivated or blocked accounts

Implementation Details

Files Added

  • Application/acceptBestFriendRequest.js - VK API execute script that:

    • Fetches up to 100 incoming friend requests with extended information
    • Filters for online, non-deactivated users
    • Calculates mutual friends count for each eligible user
    • Selects the user with the maximum mutual friends
    • Accepts the friend request from the selected user
  • accept-best-friend-request.sh - Shell script to invoke the function via VK API

  • experiments/test-best-friend-request-logic.js - Test script that validates the selection algorithm with mock data

How It Works

The algorithm iterates through all incoming friend requests and:

  1. Checks if the user is not deactivated
  2. Checks if the user is currently online
  3. For eligible users, counts mutual friends
  4. Tracks the user with the maximum mutual friends
  5. Accepts the friend request from the best match

Usage

./accept-best-friend-request.sh

Related

Fixes #12

🤖 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
konard and others added 2 commits October 17, 2025 19:10
Implements selection of best match from incoming friend requests based on:
- User is online
- User has maximum common friends
- User is not blocked or deactivated

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

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Make function that will select best match from friends requests Add function to select and accept best friend request Oct 17, 2025
@konard
konard marked this pull request as ready for review October 17, 2025 16:11
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.

Make function that will select best match from friends requests

1 participant