A Telegram bot that allows users to write and execute Python code directly within Telegram.
- 📝 Write Code: Submit Python code via text or .py files
▶️ Run Code: Execute Python code and see results instantly- 📚 Examples: Pre-loaded code examples to get started
- ❓ Help: Built-in help and instructions
- 🔒 Safe Execution: Code runs with timeouts and in isolated environment
- Python 3.7+
- A Telegram Bot Token (get from @BotFather)
- Clone this repository:
git clone <repository-url>
cd tg_bot_compiler- Install dependencies:
pip install -r requirements.txt- Set your bot token:
export BOT_TOKEN="your_bot_token_here"Or create a .env file:
BOT_TOKEN=your_bot_token_here
python bot.py- Start a chat with your bot on Telegram
- Send
/startto see the main menu - Use the inline buttons to:
- Write/submit Python code
- Run your code
- View examples
- Get help
/start- Display main menu/help- Show help information/clear- Clear your stored code/cancel- Cancel current operation
- Implement proper sandboxing (e.g., Docker containers)
- Add rate limiting
- Restrict dangerous operations
- Monitor resource usage
- Consider using a code execution API service
MIT License
Feel free to submit issues and enhancement requests!