Metadata-Version: 2.4
Name: tg-notify
Version: 0.1.7
Summary: Rate-limited Telegram notifications with priority queue
Project-URL: Homepage, https://cmdop.com/skills/tg-notify/
Author-email: CMDOP Team <team@cmdop.com>
License-Expression: MIT
Keywords: bot,cmdop,notifications,queue,rate-limit,telegram
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.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Communications :: Chat
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: pytelegrambotapi>=4.0.0
Requires-Dist: pyyaml>=6.0
Provides-Extra: dev
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# tg-notify

> **[CMDOP Skill](https://cmdop.com/skills/tg-notify/)** — install and use via [CMDOP agent](https://cmdop.com):
> ```
> cmdop-skill install tg-notify
> ```
Rate-limited Telegram notifications with priority queue.

## Install

```bash
pip install tg-notify
```

## Quick Start

```bash
export TELEGRAM_BOT_TOKEN="your-bot-token"
export TELEGRAM_CHAT_ID="-1001234567890"
```

```python
from tg_notify import send_telegram_message

send_telegram_message("Hello from tg-notify!")
```

## Shortcuts

```python
from tg_notify import send_error, send_success, send_warning, send_info, send_stats, send_alert

send_error("DB connection failed", {"host": "db.example.com"})
send_success("Deploy complete", {"version": "1.2.3"})
send_warning("Disk usage high", {"usage": "89%"})
send_info("New user registered", {"email": "user@example.com"})
send_stats("Daily Report", {"users": 1500, "revenue": "$3200"})
send_alert("Server down!", {"server": "prod-1"})
```

## TelegramSender

```python
from tg_notify import TelegramSender

sender = TelegramSender(bot_token="your-token", chat_id=-123456)
sender.send_message("Hello!")
sender.send_photo("chart.png", caption="Daily stats")
sender.send_document("report.pdf")
```

## Priority Queue

Messages are queued with 4 priority levels and rate-limited to 20 msg/sec:

| Priority | Use case |
|---|---|
| `CRITICAL` (1) | Security alerts, system down |
| `HIGH` (2) | Errors, important warnings |
| `NORMAL` (3) | Info, success messages |
| `LOW` (4) | Stats, debug |

Auto-cleanup drops low-priority messages when queue fills up.

```python
from tg_notify import telegram_queue

# Flush before exit (CLI scripts)
telegram_queue.flush(timeout=5)
```

## License

MIT
