AI-powered content curation from Telegram to Discord
Drop a link in Telegram β Get an AI-researched summary in Discord
An AI-powered bot that takes links from Telegram, researches the content using GPT-4, and posts organized summaries to Discord with automatic tagging.
This project uses open-source tools by @kingbootoshi:
- feather-ai - Lightweight AI agent framework with auto-executing tools
π€ AI-Powered Research: Automatically extracts and summarizes content from GitHub repos, articles, and other links π Smart Summaries: GPT-4 generates engaging Discord posts with bullet points and "Why it matters" sections π·οΈ Auto-Tagging: Automatically categorizes content with Forum tags (Forum mode only) π± Multi-Platform: Receives links via Telegram, posts to Discord π Smart URL Handling: Converts arXiv PDF links to abstract pages, handles shortened URLs
- Posts to Discord Forum channels as organized threads
- Auto-tags content with 7 categories:
- AI Agents
- Image/Video/Audio
- LLMs & Chat
- Dev Tools
- Research/Papers
- Web/Mobile Design
- Open Source
- Searchable and organized by category
- Posts to regular Discord text channels
- Clean, simple messages without threading
- No tagging or categorization
- Easier setup and management
- Clone the repository:
git clone https://github.com/Mikehutu/Telegram-Discord-Agent.git
cd Telegram-Discord-Agent- Install dependencies:
npm install-
Set up your environment variables (see Environment Variables section below)
-
Start the bot in your preferred mode:
Forum Mode:
npm run dev # Development
npm start # ProductionSimple Mode:
npm run simple-dev # Development
npm run simple # ProductionCreate a .env file with the following variables:
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
OPENROUTER_API_KEY=your_openrouter_api_key
DISCORD_BOT_TOKEN=your_discord_bot_token# OpenRouter model to use for content summarization and knowledge extraction
# Default: openai/gpt-4.1-mini
# Examples: anthropic/claude-3-haiku, meta-llama/llama-3.1-8b-instruct, etc.
AI_MODEL=openai/gpt-4.1-mini# Comma-separated list of authorized Telegram user IDs
# If not set, all users can use the bot
TELEGRAM_AUTHORIZED_USERS=
# Comma-separated list of authorized Telegram chat IDs
# If not set, all chats can be used (but still subject to user authorization)
# For private chats, chat ID is the same as user ID
TELEGRAM_AUTHORIZED_CHATS=DISCORD_FORUM_CHANNEL_ID=your_forum_channel_idDISCORD_CHANNEL_ID=your_regular_channel_idNote: Use DISCORD_FORUM_CHANNEL_ID for Forum mode OR DISCORD_CHANNEL_ID for Simple mode - not both.
- Message @BotFather on Telegram
- Send
/newbotand follow the prompts - Copy your bot token to the
.envfile asTELEGRAM_BOT_TOKEN - Add the bot to your desired Telegram chat
To prevent unauthorized users from using your bot, you can restrict access using user IDs and chat IDs:
Easiest Method - Use the /status command:
- Add your bot to a private chat or group
- Send
/statusto the bot (this command works even with authorization enabled) - The bot will reply with your user ID and chat ID
Manual Method:
-
Get your User ID:
- Start a private chat with @userinfobot
- Send any message to get your user ID
-
Get your Chat ID (for group chats):
- Add your bot to the Telegram group/chat
- Send a message in the group
- Visit:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates - Look for the
"chat":{"id":...}field in the response
-
Configure Authorization:
# Comma-separated list of authorized Telegram user IDs TELEGRAM_AUTHORIZED_USERS=123456789,987654321 # Comma-separated list of authorized Telegram chat IDs TELEGRAM_AUTHORIZED_CHATS=-1001234567890
If these variables are not set, the bot will accept messages from all users (not recommended for public use).
- Go to Discord Developer Portal
- Create a new application and bot
- Copy the bot token to your
.envfile asDISCORD_BOT_TOKEN - Enable "Message Content Intent" under Bot settings (required to read messages)
- Invite the bot to your Discord server with appropriate permissions:
- Forum Mode: "Send Messages" and "Create Public Threads"
- Simple Mode: "Send Messages"
- Create a Forum channel in Discord
- Add these tags to your Forum channel:
ai agentsimage/video/audiollmschatdev toolsresearch/papersweb/mobile design
- Right-click the Forum channel β Copy Channel ID
- Add to
.envasDISCORD_FORUM_CHANNEL_ID
- Use any existing text channel or create a new one
- Right-click the channel β Copy Channel ID
- Add to
.envasDISCORD_CHANNEL_ID
- Send any URL to your Telegram bot
- The bot will:
- Research the link content
- Generate an AI summary with GPT-4
- Post to Discord with appropriate formatting
Forum Mode:
π§΅ Thread: "Anthropic's Constitutional AI Paper"
π·οΈ Tags: Research/Papers, AI Agents
π **Anthropic's Constitutional AI Paper**
β’ Novel approach to training helpful, harmless AI assistants
β’ Uses AI feedback instead of human feedback for safety training
β’ Significantly reduces harmful outputs while maintaining helpfulness
π‘ **Why it matters**: This could be a breakthrough for scaling AI safety...
π https://arxiv.org/abs/2212.08073
Simple Mode:
π **Anthropic's Constitutional AI Paper**
β’ Novel approach to training helpful, harmless AI assistants
β’ Uses AI feedback instead of human feedback for safety training
β’ Significantly reduces harmful outputs while maintaining helpfulness
π‘ **Why it matters**: This could be a breakthrough for scaling AI safety...
π https://arxiv.org/abs/2212.08073
- Link Detection: Bot monitors your Telegram chat for URLs
- Content Research: Extracts titles, descriptions, and metadata from links
- AI Summary: GPT-4 generates engaging Discord posts with proper formatting
- Smart Posting:
- Forum Mode: Creates organized threads with auto-tags
- Simple Mode: Posts directly to channel
The bot doesn't use web search - instead, it directly fetches content from each URL:
- GitHub Repositories: Uses the GitHub API to fetch repository metadata (stars, forks, language, topics) and README content
- Other Websites: Uses web scraping to fetch the webpage and extract titles, descriptions, and metadata
- Supported Platforms: GitHub, arXiv, Medium, HuggingFace, Reddit, Hacker News, and general webpages
The AI then reads this extracted content and generates the summary bullet points and "Why it matters" section.
When running this bot publicly, keep these security and cost considerations in mind:
- Always set
TELEGRAM_AUTHORIZED_USERS- Without this, anyone who knows your Telegram bot token can use it - Set
TELEGRAM_AUTHORIZED_CHATSfor group chats to restrict which conversations the bot responds to - Never share your API keys publicly
- Each link triggers an AI call (costs money via OpenRouter)
- Consider adding rate limiting for production use
- Monitor your OpenRouter usage regularly
- The bot fetches content from any URL shared in authorized chats
- Only run with trusted users to avoid abuse
- Consider implementing rate limits per user if running publicly
- Keep your
.envfile private and never commit it - Use separate API keys for development vs production
- Monitor your bot's activity regularly
- Docker
- Docker Compose (optional)
- Clone and configure:
git clone https://github.com/Mikehutu/Telegram-Discord-Agent.git
cd Telegram-Discord-Agent-
Create a
.envfile with your credentials (see Environment Variables section) -
Build and run with Docker Compose:
docker-compose up -d- View logs:
docker-compose logs -f# Build the image
docker build -t telegram-discord-curator .
# Run the container
docker run -d \
--name telegram-curator \
--env TELEGRAM_BOT_TOKEN=your_token \
--env DISCORD_BOT_TOKEN=your_token \
--env OPENROUTER_API_KEY=your_key \
--env DISCORD_CHANNEL_ID=your_channel \
telegram-discord-curatorcurator_data- Persistent data storage
default- Forum modesimple- Simple mode (run withdocker-compose --profile simple up)
Feel free to submit issues and enhancement requests!
MIT License - feel free to use and modify as needed.