Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

tg_bot_compiler

Telegram Python Compiler Bot

A Telegram bot that allows users to write and execute Python code directly within Telegram.

Features

  • 📝 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

Setup

Prerequisites

  • Python 3.7+
  • A Telegram Bot Token (get from @BotFather)

Installation

  1. Clone this repository:
git clone <repository-url>
cd tg_bot_compiler
  1. Install dependencies:
pip install -r requirements.txt
  1. Set your bot token:
export BOT_TOKEN="your_bot_token_here"

Or create a .env file:

BOT_TOKEN=your_bot_token_here

Running the Bot

python bot.py

Usage

  1. Start a chat with your bot on Telegram
  2. Send /start to see the main menu
  3. Use the inline buttons to:
    • Write/submit Python code
    • Run your code
    • View examples
    • Get help

Commands

  • /start - Display main menu
  • /help - Show help information
  • /clear - Clear your stored code
  • /cancel - Cancel current operation

Security Notes

⚠️ Important: This bot executes user-submitted code. For production use:

  • Implement proper sandboxing (e.g., Docker containers)
  • Add rate limiting
  • Restrict dangerous operations
  • Monitor resource usage
  • Consider using a code execution API service

License

MIT License

Contributing

Feel free to submit issues and enhancement requests!

About

bot to compile python`s scrypts

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages