Open
Conversation
Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: #8
This commit addresses issue #8 "Should the rating be splited in different chats?" by implementing a chat-specific karma system instead of the previous global karma. ## Key Changes ### Data Structure Changes - Modified karma storage from `karma: 0` to `karma: {chat_id: karma_value}` - Modified supporters from `supporters: []` to `supporters: {chat_id: [user_ids]}` - Modified opponents from `opponents: []` to `opponents: {chat_id: [user_ids]}` ### New Features - Users now have separate karma scores for each chat - Voting in one chat doesn't affect karma in other chats - Rankings show chat-specific karma instead of global karma - Backward compatibility with existing global karma data ### Modified Files - `data_service.py`: Added chat-specific karma, supporters, opponents methods - `data_builder.py`: Updated karma calculation and display for chat-specific data - `commands_builder.py`: Updated message builders to use chat-specific karma - `commands.py`: Updated all karma-related commands to use chat-specific data ### Backward Compatibility - Automatically migrates old integer karma to new dict format - Supports both old and new data formats during transition - Existing data remains functional while gaining new chat-specific features ### Testing - Added validation scripts to verify implementation logic - Confirmed Python syntax validity across all modified files 🤖 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 a chat-specific karma system to address issue #8 "Should the rating be splited in different chats?".
Previously, the VK bot used a global karma system where users had a single karma score across all chats. Now users have separate karma scores for each chat, making ratings truly chat-specific.
🔧 Key Changes
Data Structure Migration
karma: 10(global integer)karma: {2000000001: 10, 2000000002: -2}(per-chat dictionary)Same approach applied to supporters and opponents arrays.
Core Features
Modified Files
python/modules/data_service.py: Added chat-specific karma/supporters/opponents methodspython/modules/data_builder.py: Updated karma calculations for chat-specific datapython/modules/commands_builder.py: Updated message builders to use chat-specific karmapython/modules/commands.py: Updated karma commands to use chat-specific data🧪 Testing
🔄 Migration Strategy
The implementation automatically handles migration:
{current_chat: karma_value}📋 Examples
Before (Global Karma)
After (Chat-Specific Karma)
✅ Answer to Issue #8
Question: "Should the rating be splited in different chats?"
Answer: YES - This PR implements exactly that! Ratings are now split across different chats, giving users separate karma scores per chat.
🤖 Generated with Claude Code
Resolves #8