Skip to content

kalanakt/Pyrogram-Telegram-Bot-Template

Repository files navigation

Pyrogram Telegram Python Bot Template

This is a template for creating Telegram bots using Pyrogram, MongoDB, and Python.

Getting Started

Prerequisites

  • Python 3.7 or higher
  • Pyrogram library
  • MongoDB

Installing

  1. Clone the repository:

    git clone https://github.com/kalanakt/Pyrogram-Telegram-Bot-Template telegrambot
    cd telegrambot
  2. Install the dependencies:

    #optional
    python3 -m venv env
    source env/bin/activate # in mac OS
    env/Scripts/activate.bat #In CMD
    env/Scripts/Activate.ps1 #In Powershel
    pip install -r requirements.txt
  3. Set up your MongoDB database and get the connection URI.

  4. Create a .env file in the project root and add your MongoDB connection URI and your Telegram bot token:

    DATABASE_URI=your-mongodb-connection-uri
    DATABASE_NAME=your-database-name
    API_ID=your-api-id
    API_HASH=your-api-hash
    BOT_TOKEN=your-bot-token
    
  5. Run the bot:

    python bot.py

Features

  • Pyrogram framework for interacting with the Telegram API.
  • MongoDB for storing data.
  • Easily extendable for adding more features.

Contributing

Contributions are welcome! Please follow the standard guidelines when contributing.

License

This project is licensed under the MIT License.