Dev.to
7/6/2026

Building an Asynchronous Python Telegram Bot for Automated AI Chat Moderation Using ChatGPT
Short summary
Build a Python Telegram bot powered by ChatGPT that analyzes message context to detect toxicity in real time, catching sarcasm and hidden harassment beyond keyword filtering. The system automatically deletes toxic messages and applies 15-minute mutes to break argument momentum. A strict two-word prompt engineering approach minimizes API costs while maintaining sub-400ms response times.
- •Context-aware moderation detects sarcasm and intent, not just keywords
- •Auto-delete and temporary mutes enforce moderation without permanent bans
- •Optimized prompt engineering minimizes API costs and latency
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



