Skip to content

VK User Bot: Accept friend requests automatically - #306

Open
konard wants to merge 3 commits into
mainfrom
issue-93-0407119a
Open

VK User Bot: Accept friend requests automatically#306
konard wants to merge 3 commits into
mainfrom
issue-93-0407119a

Conversation

@konard

@konard konard commented Sep 13, 2025

Copy link
Copy Markdown
Member

🤖 AI-Powered Solution

This pull request automatically solves issue #93 by implementing friend request auto-acceptance functionality for the VK User Bot.

📋 Issue Reference

Fixes #93

✅ Implementation Summary

Added friend request auto-acceptance functionality to the VK User Bot:

New Features

  • Background monitoring: Automatically checks for new friend requests every 30 seconds (configurable)
  • Automatic acceptance: Immediately accepts all pending friend requests using VK User API
  • Error handling: Comprehensive error handling for all VK API error codes (blocked users, not found, too many friends, etc.)
  • Configurable: Can be enabled/disabled and check interval can be adjusted
  • Logging: Detailed logging of all friend request operations

Files Modified

  • python/userbot.py: Extended UserBot class with friend request methods
  • python/__main__.py: Integrated friend request monitoring into bot startup
  • python/config.py: Added configuration options
  • python/README.md: Updated documentation with setup instructions

Files Added

  • python/test_friend_requests.py: Test script to verify functionality

🛠️ Technical Implementation

UserBot Class Extensions

  1. get_friend_requests() - Retrieves pending friend request user IDs
  2. accept_friend_request(user_id) - Accepts individual friend requests
  3. check_and_accept_friend_requests() - Checks and accepts all pending requests
  4. start_friend_request_monitor() - Starts background monitoring thread
  5. stop_friend_request_monitor() - Stops background monitoring

Configuration Options

FRIEND_REQUEST_AUTO_ACCEPT = True  # Enable/disable feature
FRIEND_REQUEST_CHECK_INTERVAL = 30  # Check interval in seconds

🧪 Testing

Run the test script to verify functionality:

cd python
python3 test_friend_requests.py

📚 Usage

  1. Set USER_TOKEN in tokens.py with VK user token (requires "friends" permission)
  2. Ensure FRIEND_REQUEST_AUTO_ACCEPT = True in config.py (default)
  3. Start the bot: python3 __main__.py

The bot will automatically:

  • Start friend request monitoring on startup
  • Check for new requests every 30 seconds
  • Accept all pending friend requests
  • Log all operations and errors

🔒 Security & Error Handling

The implementation handles all VK API error scenarios:

  • User blocked/blocking situations
  • Invalid user IDs
  • Rate limiting
  • API permission issues
  • Network errors

🤖 Generated with Claude Code

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

Issue: #93
@konard konard self-assigned this Sep 13, 2025
- Extended UserBot class with friend request handling methods
- Added background monitoring thread with configurable intervals
- Integrated friend request monitoring into main bot startup
- Added comprehensive error handling for VK API responses
- Created test script for functionality verification
- Updated documentation with setup and usage instructions
- Added configuration options for enabling/disabling feature

Resolves #93

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

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] VK User Bot: Accept friend requests automatically VK User Bot: Accept friend requests automatically Sep 13, 2025
@konard
konard marked this pull request as ready for review September 13, 2025 10:47
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.

VK User Bot: Accept friend requests automatically

1 participant