Metadata-Version: 2.4
Name: pymaxbot
Version: 0.1.6
Summary: Python SDK for MAX messenger bot API
License: MIT License
        
        Copyright (c) 2026 Sergey Kurilenko
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/svkurick/max_bot
Project-URL: Repository, https://github.com/svkurick/max_bot
Project-URL: Issues, https://github.com/svkurick/max_bot/issues
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx
Dynamic: license-file

# pymaxbot

Python SDK для создания ботов в мессенджере [MAX](https://max.ru).

## Установка

```bash
pip install pymaxbot
```

## Быстрый старт

```python
import asyncio
from max_bot import Bot, Dispatcher, run_polling

bot = Bot(token="YOUR_BOT_TOKEN")
dp = Dispatcher(bot)


@dp.message(commands=["start"])
async def start(msg):
    await msg.answer("Привет! Я эхо-бот.")


@dp.message()
async def echo(msg):
    await msg.answer(f"Вы написали: {msg.text}")


asyncio.run(run_polling(bot, dp))
```

## Возможности

- Отправка текстовых сообщений с поддержкой HTML-форматирования
- Inline-кнопки и обработка callback-нажатий
- Отправка изображений (одно или несколько)
- Отправка файлов/документов
- Удаление сообщений
- Маршрутизация по командам и payload-ам через `Dispatcher`
- Long polling из коробки

## Примеры

### Inline-кнопки

```python
@dp.message(commands=["menu"])
async def menu(msg):
    await msg.answer(
        "Выберите вариант:",
        buttons=[
            [{"text": "Вариант А", "payload": "option_a"},
             {"text": "Вариант Б", "payload": "option_b"}],
            [{"text": "Отмена", "payload": "cancel"}],
        ]
    )


@dp.callback(payloads=["option_a", "option_b"])
async def on_option(cb):
    await cb.answer()
    await cb.reply(f"Вы выбрали: <b>{cb.payload}</b>", format="html")
```

### Отправка изображений

```python
@dp.message(commands=["photo"])
async def photo(msg):
    await msg.send_image("image.jpg", text="Подпись к фото")
```

### Отправка файлов

```python
@dp.message(commands=["doc"])
async def doc(msg):
    await msg.send_document("report.pdf")
```

### Удаление сообщения

```python
@dp.message(commands=["del"])
async def delete(msg):
    sent = await msg.answer("Удалится через 3 секунды...")
    await asyncio.sleep(3)
    await sent.delete()
```

## Ссылки

- [Репозиторий на GitHub](https://github.com/svkurick/max_bot)
- [Сообщить об ошибке](https://github.com/svkurick/max_bot/issues)
