-
-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit the number of allowed entities/mentions in a message #222
Comments
I like the idea of this new checker |
I'll try to implement it myself and submit the PR. |
Cool. I don't think we want to reimplement |
This issue has been addressed in PR #262 (now merged). Added the ability to limit the number of mentions (@username) in a message with a new '--meta.mentions-limit' parameter. When the limit is exceeded, the message will be treated as spam.
The feature follows the same pattern as the existing links limit. |
I faced a new spam type when the first message contained mass-mention of chat members and it was edited to ad-message immediately after that. Telegram keeps mention notifications even after message is edited, so users go to chat from notification and see ad message.
The classifier doesn't detect such messages as spam, because they contain a lot of random text (usernames) even if the original message contains spam too:
Note: Message without mentions is added to spam samples, and has 99% detection.
Screenshot of how it looks
Each mention in the message is counted as a separate entity of the type
mention
. I suggest a feature request to allow limiting the number of entities by type or specifically restrictingmention
entities.I think it would be useful to block/limit any entity type because spam also contains telegram cashtags ($USD) and hashtags.
Message JSON from Telegram API
Check for entities also allows to update/unify
LinksCheck
function, because each URL in the message is also an entity ofurl
type.tg-spam/lib/tgspam/metachecks.go
Lines 17 to 32 in 60b5c3b
Bot API documentation: https://core.telegram.org/bots/api#messageentity
The text was updated successfully, but these errors were encountered: