This Telegram bot transforms official news into anonymous insider-style posts for your Telegram channel. It uses OpenAI's GPT-4o to create compelling, mysterious content formatted as insider leaks from government and military sources.
- Receives forwarded news messages from authorized users
- Uses OpenAI GPT-4o to transform the content into insider-style posts
- Publishes the transformed content to a specified Telegram channel
- Includes rate limiting to avoid OpenAI API request limits
- Implements user authorization to secure bot access
- Uses asynchronous processing for better performance
- Comprehensive logging for all operations
- Python 3.8 or higher
- A Telegram Bot token (obtained from BotFather)
- OpenAI API key
- A Telegram channel where the bot is admin
-
Clone or download this repository
-
Install dependencies
pip install -r requirements.txt
-
Configure environment variables
Edit the
.envfile in the project directory and add your credentials:TELEGRAM_BOT_TOKEN=your_telegram_bot_token OPENAI_API_KEY=your_openai_api_key TELEGRAM_CHANNEL_ID=your_channel_id ADMIN_USER_ID=your_telegram_user_ids- TELEGRAM_BOT_TOKEN: Obtain from BotFather
- OPENAI_API_KEY: Get from the OpenAI Dashboard
- TELEGRAM_CHANNEL_ID: The ID of your channel (usually starts with
-100) - ADMIN_USER_ID: Your Telegram user IDs (comma-separated, can be obtained from @userinfobot)
-
Make your bot an admin of the target channel
-
Build the Docker image
./build.sh
-
Run the Docker container with the .env file
docker run --env-file .env -d --name fabrika-troliv fabrika-troliv:latest
This command will start the Docker container and load the environment variables from the
.envfile.
-
Start the bot
python bot.py
-
Interacting with the bot
- Send
/startto the bot to verify it's working - Forward any news article to the bot
- The bot will process the text, transform it into an insider-style post, and publish it to your channel
- You'll receive a confirmation message when the post is published
- Send
The generated posts follow this format:
- A mysterious introduction hinting at leaked information
- A clear statement about the event based on "leaked" data
- Confirmation through indirect facts or statements
- Strategic analysis in a numbered list or brief points
- Conclusion with a hint about future events or leaks
To stop the bot, press Ctrl+C in the terminal where it's running, or use the following commands to find and kill the process:
# Find the process ID
ps aux | grep "python" | grep "bot.py"
# Kill the process
kill -9 <PID>Logs are stored in bot.log in the project directory. Check this file for debugging information and operation history.
If the bot doesn't respond:
- Check that all environment variables are correctly set in the
.envfile - Ensure the bot is an admin in your Telegram channel
- Verify your OpenAI API key is valid and has sufficient quota
- Check the
bot.logfile for error messages - Make sure you're using the correct Telegram user ID for authorization
- Keep your
.envfile secure and never commit it to public repositories - The bot only accepts commands from the authorized admin user ID
- Rate limiting is implemented to prevent excessive API usage
This project is for personal use.