fix: multi-group moderation gaps in topic guard and spam handlers#6
Merged
rezhajulio merged 2 commits intomainfrom Mar 6, 2026
Merged
fix: multi-group moderation gaps in topic guard and spam handlers#6rezhajulio merged 2 commits intomainfrom
rezhajulio merged 2 commits intomainfrom
Conversation
- topic_guard: raise ApplicationHandlerStop after handling warning-topic messages to prevent downstream handlers from processing them - topic_guard: handle edited messages (update.message or update.edited_message) - topic_guard: fail-closed on get_chat_member error (delete message in warning topic on API failure), scoped to confirmed warning-topic only - main: register edited_message handler for topic_guard using combined MESSAGE | EDITED_MESSAGE filter at group=-1 - main: add 'edited_message' to allowed_updates in run_polling - main: add periodic admin cache refresh via JobQueue (every 10 minutes) with graceful fallback to cached data on failure - tests: improve coverage from 99% to 99.9% (519 tests, 1 unreachable line) Amp-Thread-ID: https://ampcode.com/threads/T-019cbc2b-3b09-743f-9ecc-eaa7dfd0234c Co-authored-by: Amp <amp@ampcode.com>
…d coverage changes - Handler priority groups: document all 6 groups (-1 through 4) - Topic guard: document edited message handling, ApplicationHandlerStop, fail-closed behavior - Admin cache: document periodic refresh (every 10 min) with graceful fallback - allowed_updates: reflect addition of edited_message - Test coverage: update stats to 519 tests, 99.9% coverage - Test file list: add missing test_check.py, test_duplicate_spam.py - Architecture: reflect all handler modules and their priority groups Amp-Thread-ID: https://ampcode.com/threads/T-019cbc2b-3b09-743f-9ecc-eaa7dfd0234c Co-authored-by: Amp <amp@ampcode.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
Fixes several multi-group moderation gaps where the bot could fail to delete spam messages or protect the warning topic.
Changes
topic_guard.py
ApplicationHandlerStopafter handling warning-topic messages, preventing downstream spam/profile handlers from processing themupdate.edited_messagein addition toupdate.messageget_chat_memberAPI error, delete the message (scoped to confirmed warning-topic messages only)main.py
MESSAGE | EDITED_MESSAGEfilteredited_messagetoallowed_updatesinrun_polling()Tests
anti_spam.pyIssues Addressed
ApplicationHandlerStop)edited_messageupdates never reached the bot (allowed_updatesmissing it)