Repository navigation
Let /spam ai run without the /spam master switch - #21
Merged
Merged
Conversation
The global spam_words.txt substring-matches common words, so admins who only want the paid AI check had no way to get it without the word list. - /spam ai on|renew no longer requires the master switch. - With the master switch off and AI running, messages skip the link, mention and keyword checks and go straight to the AI; groups with neither on still return before the admin lookup. - Turning the master switch off says when the AI check keeps running. - Status, expiry reminder and help texts no longer promise keyword filtering as the fallback when the master switch is off. Co-Authored-By: Claude <noreply@anthropic.com>
The master switch is saved before the AI status lookup that decides whether to add the "AI still running" note. If that lookup raised, the shared handler told the admin the whole operation failed, and a retry would turn the filter back on. Treat an unreadable status as "not running" and only log it.
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
The global
spam_words.txtsubstring-matches common words such asad,DM, 投资 and 充值, so it produces many false positives. Admins who only wanted the paid AI check could not get it without that list:/spam ai onrequired the/spammaster switch, and the master switch always turns on the global list unless the group has custom keywords.The AI check is now its own switch.
Behaviour
/spammaster/spam ai/spam ai on|renewno longer requires the master switch. It still requires the bot's delete-messages right.Cost
process_messagenow calls the newspam_ai.handlers.is_running(chat_id)before the admin lookup. That function wrapsjudge.is_configured()and the cachedoperations.is_checking. Groups with neither switch on still return before anyget_chat_membercall. Groups with the master switch on never callis_runningon that early path.Texts
/spam aistatus with the master switch off says that only AI runs. Its "service unavailable" and "daily limit" notes then say 「不检查消息」 instead of promising keyword filtering./spam help, the plain-text help andresources/docs/spam.mdsay that AI can run on its own.Not changed
dkgks/tgforwarder) is old web-censorship vocabulary without Telegram ad terms. It was shelved.Test plan
uv run pytest -q: 1224 passed, 68 skippeduv run ruff check src testsis_runninggating./spam ai onin a group with/spamoff and check that a spam message is deleted with the warning and buttons