Implement chat-specific karma system #355
Open
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