Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 14, 2025

Summary

Implements the ability to treat a simple "+" message as an upvote for the previous non-command message in the VK bot, addressing issue #7.

Changes Made

  • New Pattern: Added UPVOTE_PREVIOUS regex pattern to match standalone "+" messages (with optional whitespace)
  • Message History: Added get_conversation_messages() method to retrieve recent conversation history via VK API
  • Upvote Logic: Implemented upvote_previous() method that:
    • Finds the most recent non-command message in the conversation
    • Applies karma upvote using existing collective vote mechanism (+0 karma)
    • Validates user permissions and voting limits
    • Prevents self-upvoting
    • Shows appropriate error messages when needed
  • Integration: Registered the new pattern and handler in the bot's command system
  • Testing: Added comprehensive pattern validation tests

Technical Details

  • Uses existing karma system infrastructure (collective votes, time limits, user validation)
  • Leverages VK API messages.getHistory to analyze conversation history
  • Searches backwards through up to 20 recent messages to find the target
  • Filters out bot messages, system messages, and all registered commands
  • Maintains all existing karma system constraints and protections

Test Results

  • Pattern matching: ✅ All test cases pass
  • Python syntax validation: ✅ No errors
  • Integration with existing commands: ✅ Successfully registered

🤖 Generated with Claude Code


Resolves #7

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

Issue: #7
@konard konard self-assigned this Sep 14, 2025
- Add UPVOTE_PREVIOUS pattern to match simple "+" messages
- Add get_conversation_messages method to retrieve message history
- Implement upvote_previous method to find and upvote previous non-command messages
- Integrate with existing karma system using collective vote mechanism
- Add comprehensive pattern tests

Fixes #7

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

Co-Authored-By: Claude <[email protected]>
@konard konard changed the title [WIP] Treat + in the message as upvote for previous non-command message Implement upvote functionality for "+" messages Sep 14, 2025
@konard konard marked this pull request as ready for review September 14, 2025 03:52
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.

Treat "+" in the message as upvote for previous non-command message

2 participants