- name
- telegram-group-moderation
- version
- 0.9.0
- description
- Moderate Telegram groups with a bot by receiving message/webhook events, extracting text/caption/media context, applying anti-advertising and anti-contact policies, and deciding whether to pass, delete, warn, mute, ban, or send for manual review. Use when connecting Telegram groups or channels to an existing moderation system, especially when reusing post-content-moderation as the policy core.
- emoji
- 📱
- homepage
- https://github.com/XavierMary56/OmniPublish
- requires
- metadata
- openclaw
- requires
- bins
Telegram Group Moderation
Build Telegram group moderation as an integration layer, not as a replacement for your existing moderation policy skill.
Recommended architecture:
- use
post-content-moderationas the moderation-policy core - use this skill to receive Telegram updates, normalize Telegram payloads, call the moderation core, and execute Telegram moderation actions
Core responsibilities
Use this skill for:
- Telegram Bot webhook integration
- Telegram group message normalization
- extracting text, caption, media URL/file metadata, sender info, and chat info
- mapping moderation results into Telegram actions
- enforcing group-specific whitelist / admin-exemption / punishment rules
- logging moderation decisions for audit
Do not bloat this skill with generic moderation policy text that already belongs in post-content-moderation.
Recommended decision flow
- Receive Telegram update.
- Detect update type:
- message - edited_message - channel_post - edited_channel_post
- Extract moderation input:
- chat_id - message_id - user_id - username / display name - text - caption - photo / video presence - forwarded / reply / sticker / invite-link hints if needed
- Normalize into a moderation payload.
- Call moderation core.
- Map result into Telegram action:
- pass -> no action - reject -> delete / warn / mute / ban depending on rule set - review -> flag to admin channel or log queue
- Persist result and evidence.
Action mapping
Use clear business mapping. Example:
pass-> allowreject+ high risk -> delete message and warn userreject+ repeated violations -> delete and mutereject+ explicit scam/spam pattern -> delete and banreview-> forward summary to admin review channel
Keep action policy configurable per group.
Telegram-specific rule inputs
Add these rule dimensions on top of the generic moderation core:
- allowed chat ids
- admin / moderator user whitelist
- trusted service bots whitelist
- punishment ladder by offense count
- whether edited messages should be re-audited
- whether forwarded posts are allowed
- whether links are fully blocked or only ad-like links are blocked
- whether usernames / bios / display names count as diversion evidence
Media limitations
Telegram integration often needs more than plain text:
- image moderation may require OCR and QR detection
- video moderation may require frame extraction and subtitle/ASR pipeline
- file_id alone is not enough for real moderation; fetch or proxy media only when policy and privacy requirements allow it
If real media inspection is not implemented, document that clearly and avoid claiming full image/video moderation coverage.
Security baseline
- validate Telegram webhook authenticity at the integration layer
- verify chat allowlist before processing
- keep bot token and API keys only in environment variables
- rate-limit admin actions and callback retries
- log delete/mute/ban actions with chat_id, user_id, message_id, and moderation reason
- avoid downloading media to unsafe temp paths
- define retention policy for moderated content snapshots
Bundled references
Read these files as needed:
references/architecture.mdfor recommended system designreferences/telegram-event-mapping.mdfor Telegram update normalizationreferences/action-policy.mdfor pass/reject/review to delete/warn/mute/ban mappingreferences/php-yaf-integration.mdfor PHP 7.3 / Yaf-oriented integration notesreferences/multi-language-integration.mdfor Python, Go, and Java integration guidancereferences/install-and-usage.zh-CN.mdfor practical Chinese installation and configuration guidancereferences/production-rollout.zh-CN.mdfor production rollout boundaries and deployment advicereferences/http-contract-example.jsonfor request/response contract example with moderation corereferences/http-contract-production.zh-CN.mdfor production HTTP contract guidancereferences/http-contract-production-v2.zh-CN.mdfor trace_id-aware production contract guidancereferences/redis-db-offense-store.zh-CN.mdfor Redis/DB offense-count design guidancereferences/db-schema-example.sqlfor default DB offense-log schemareferences/audit-log-schema-example.sqlfor audit-log schemareferences/audit-log-rollout.zh-CN.mdfor audit-log rollout guidancereferences/config-template.env.examplefor environment template hintsreferences/release-notes.zh-CN.mdfor Chinese release notesreferences/clawhub-release-copy.zh-CN.mdfor Chinese release copy and page wording
Bundled scripts
Use bundled scripts as starting points, not production-final code:
scripts/config.phpfor env-driven config layoutscripts/telegram_support.phpfor shared constants and helpersscripts/telegram_webhook_example.phpfor PHP webhook entry examplescripts/telegram_action_example.phpfor PHP Telegram Bot API action callsscripts/python_telegram_webhook_example.pyfor Python webhook/action flow examplescripts/go_telegram_webhook_example.gofor Go webhook/action flow examplescripts/java_telegram_webhook_example.javafor Java webhook/action flow example
Packaging guidance
Keep this skill platform-specific and small:
- Telegram ingress and action logic belongs here
- reusable moderation policy belongs in
post-content-moderation - if you later add Discord/WhatsApp, create separate integration skills instead of mixing all platforms into one