StomChat is a hybrid Telegram Userbot + Bot system powered by Google Gemini and Groq. It automatically archives dental community chat messages, analyzes media files (images, clinical photos, X-rays, videos), uses agentic search APIs to verify facts, and publishes daily/weekly AI-synthesized digests and knowledge articles to Telegraph and Telegram channels.
- Userbot Listener: Listens to targeted dental chats, groups, and channels to archive messages and media into SQLite.
- Bot Publisher: A dedicated bot client that formats, drafts, and posts summarized digests and Telegraph pages without cluttering your personal userbot session.
- Daily Digest: Auto-compiles daily summaries from dental chat discussions (focusing on cases, queries, clinic issues).
- Weekly Newspaper: Formulates a structured weekly report on dentistry developments and discussed clinical cases.
- Powered by Gemini & Groq: Dynamic multi-key API rotation with built-in cooldowns for 429/timeouts.
- Integrates Tavily Search API and DuckDuckGo API to perform web searches, verify claims made in dental chats, and add authoritative medical references.
- Automatic Frame Extraction: Leverages
OpenCVandFFmpegto extract keyframes from uploaded clinical videos. - X-Ray & Photo Inspection: Inspects dental X-rays, clinic setups, and dental photographs using multimodal Gemini Vision models.
- Automatically compiles long discussions into beautifully formatted Telegraph articles using
html-telegraph-posterand publishes them to channels.
- Core: Python 3.10+
- Telegram Protocol: Telethon (MTProto Client)
- LLM / Vision: Google GenAI SDK (Gemini 1.5 Pro/Flash), Groq, OpenAI API
- Web Search Tools: Tavily API, DuckDuckGo Search API
- Video & Image Processing: OpenCV, Pillow, FFmpeg
- Database: SQLite (via
aiosqlite) - Telemetry & Process Guard:
psutil, custom heartbeat watchdog
- Python 3.10+
- API ID & API Hash from my.telegram.org
- Google Gemini API Key
- Groq API Key (optional, for fast transcripts/LLM tasks)
- Tavily API Key (optional, for web search verification)
- FFmpeg installed in system path
-
Clone the repository:
git clone https://github.com/marko1olo/stomchat.git cd stomchat -
Install dependencies:
pip install -r requirements.txt
-
Configure Environment Variables: Create a
.envfile in the root directory:API_ID=your-telegram-api-id API_HASH=your-telegram-api-hash BOT_TOKEN=your-telegram-bot-token SESSION_NAME=your-userbot-session GEMINI_API_KEY=your-gemini-key TAVILY_API_KEY=your-tavily-key GROQ_API_KEY=your-groq-key REPORT_CHAT_ID=-100xxxxxxxxxx REPORT_HOUR=20
-
Run the Bot:
python main.py
This project is licensed under the MIT License.