Add local karma functionality for chat-specific karma tracking#338
Open
Add local karma functionality for chat-specific karma tracking#338
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #45
This commit implements local karma feature that allows users to have separate karma values for each chat, in addition to their global karma. Key features implemented: - Local karma storage per chat in user profiles - Local karma commands: 'local karma', 'local +/-', 'local top/bottom' - Chat-specific karma voting and leaderboards - Comprehensive test coverage for local karma functionality - Updated help messages and documentation with local karma commands - Support for Russian and English command aliases The local karma system works independently from global karma: - Users can have different karma values in different chats - Local karma voting follows same rules as global karma (time limits, negative karma restrictions) - Local karma is displayed separately from global karma - Local leaderboards show only participants from current chat All existing global karma functionality remains unchanged and fully compatible. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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