Add local karma functionality for chat-specific karma tracking #338
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
🎯 Summary
This PR implements local karma functionality that allows users to have separate karma values for each chat, in addition to their global karma.
Fixes #45
✨ Features Implemented
Core Functionality
local_karmadictionary storing karma values per chat IDCommands Added
local karma/локальная карма- Display local karma for current chatlocal +/-- Vote to change local karma in current chatlocal +[NUMBER]/local -[NUMBER]- Transfer specific amount of local karmalocal top/локальный топ- Show local karma leaderboard for current chatlocal bottom/локальный низ- Show reverse local karma leaderboardTechnical Implementation
local_karmafield to user data structure as dict:{chat_id: karma_value}BetterBotBaseDataServicefor local karma operationsTesting
Test4LocalKarma) covering:Documentation
🔧 Technical Details
Data Structure
Key Methods Added
BetterBotBaseDataService.get_local_karma(user, chat_id)BetterBotBaseDataService.set_local_karma(user, chat_id, karma_value)DataBuilder.build_local_karma(user, data, chat_id)DataBuilder.get_users_sorted_by_local_karma(vk, data, peer_id, chat_id)Commands.local_karma_message(),apply_local_karma(),local_top()Backward Compatibility
✅ All existing global karma functionality preserved
✅ No breaking changes to existing commands or data structures
✅ Local karma is purely additive feature
🧪 Testing Strategy
📖 Usage Examples
Basic Local Karma
Local Leaderboards
🚀 Ready for Review
All implementation is complete with comprehensive testing and documentation.
🤖 Generated with Claude Code