Metadata-Version: 2.4
Name: autopaybot
Version: 0.1.32
Summary: A powerful, automated payment gateway bot for Telegram.
Author-email: AvtoPaymentBot <multicode.me@gmail.com>
License: MIT License
Project-URL: Repository, https://github.com/themirmakhmudov/AutoPay-API
Keywords: telegram,bot,payment,gateway,aiogram,fastapi
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastapi
Requires-Dist: uvicorn
Requires-Dist: sqlalchemy
Requires-Dist: pydantic
Requires-Dist: pydantic-settings
Requires-Dist: telethon
Requires-Dist: cryptography
Requires-Dist: psycopg2-binary
Requires-Dist: asyncpg
Requires-Dist: websockets
Requires-Dist: httpx
Requires-Dist: slowapi
Requires-Dist: python-dotenv
Requires-Dist: alembic
Requires-Dist: sentry-sdk
Requires-Dist: aiogram>=3.4.0
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-asyncio; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Dynamic: license-file

# AutopayBot

**A powerful, automated payment gateway bot for Telegram.**

AutopayBot provides an end-to-end framework to process, track, and manage Telegram-based payments easily. It connects seamlessly to multiple merchant accounts, offering rich features like webhooks, automated receipt tracking, and admin management.

[![PyPI Version](https://img.shields.io/pypi/v/autopaybot.svg)](https://pypi.org/project/autopaybot/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python versions](https://img.shields.io/pypi/pyversions/autopaybot.svg)](https://pypi.org/project/autopaybot/)

## 🚀 Features

- **Multi-Merchant Support:** Connect multiple Telegram bot sessions to act as payment gateways simultaneously.
- **Automated Webhooks:** Instant and reliable callbacks for successful payments.
- **Built-in Admin Dashboard:** Rich UI for managing merchants, tracking revenue, and broadcasting messages.
- **Database Flexibility:** Supports PostgreSQL and SQLite (via SQLAlchemy).
- **Interactive CLI:** Built-in commands for quick deployments, database migrations, and testing.

---

## 🛠 Installation

Install directly via `pip`:

```bash
pip install autopaybot
```

> **Note:** Requires Python 3.11 or higher.

---

## ⚙️ Quick Start

AutopayBot comes with an interactive CLI to get you started in seconds.

### 1. Initialize Configuration
Run the `init` command to generate your `.env` configuration file interactively:
```bash
autopay init
```

### 2. Setup the Database
Run migrations to set up the default database (SQLite out of the box, configurable via `.env`):
```bash
autopay upgrade
```

### 3. Start the Server and Worker
Boot up the REST API and the background Telegram userbot workers simultaneously:
```bash
autopay start
```

---

## 🔧 Environment Variables

You can configure the bot by editing the `.env` file generated by `autopay init`:

| Variable                 | Description                                                        |
|--------------------------|--------------------------------------------------------------------|
| `TELEGRAM_API_ID`        | Your Telegram App API ID (from my.telegram.org)                    |
| `TELEGRAM_API_HASH`      | Your Telegram App API Hash                                         |
| `MANAGEMENT_BOT_TOKEN`   | The `@BotFather` token for your central admin/merchant bot         |
| `ADMIN_TELEGRAM_IDS`     | Comma-separated Telegram User IDs for system administrators        |
| `DATABASE_URL`           | Database connection string (e.g., `sqlite:///payment_system.db`)   |
| `API_KEY`                | Secret key used to secure incoming REST API requests               |

---

## 🌐 Production Deployment

AutopayBot provides an automated wizard to generate a `docker-compose.yml` stack, including an Nginx reverse proxy and Cloudflare Tunnel configuration.

Run the deploy command in your target directory:
```bash
autopay deploy
```
Then start the stack:
```bash
docker compose up -d
```

---

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
