Metadata-Version: 2.4
Name: openbot_api
Version: 1.0.0
Summary: Python client for the Openbot ID authorization API
Author: Kafnik
License-Expression: MIT
Keywords: telegram,authorization,fastapi,telebot
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Openbot API 1.0.0

Python library to check Telegram user roles and levels against your Openbot ID server.

## Install

```bash
pip install openbot_api
```

Until the new package is published to PyPI, install the local wheel included in the release archive.

## Usage

```python
import os
import telebot
import openbot_api

bot = telebot.TeleBot(os.environ["TELEGRAM_BOT_TOKEN"])
openbot = openbot_api.OpenbotAPI(api_key=os.environ["OPENBOT_API_KEY"], bot=bot)

@bot.message_handler(commands=["start"])
@openbot.check_level("tester", level=2)
@openbot.check_level("developer", level=2)
def start(message):
    bot.reply_to(message, "✅ Доступ разрешён!")

bot.infinity_polling()
```

Two stacked `check_level` decorators grant access if **either** status and its required level match.

Other methods: `get_user(id)`, `get_status(id)`, `get_level(id)`, `has_level(id, role, level)`, `check_access(id)`, and `require_access()`.

The API key is a secret. Do not commit it to Git, place it in bot source, or share it publicly. The client is intentionally **read-only**: new keys may only be issued by an authorized administrator on the server, not through an unauthenticated public endpoint.

## API keys on Linux server

See `server-key-tools/README.md` in the release archive. Back up your existing key database before replacing any existing files. `api_keys.py` and `manage_keys.py` are server-side tools and must **not** be published as part of the Python package.
