# Noizu.Telegram

Telegram Bot API client for Elixir, over [Req](https://hex.pm/packages/req).
Mirrors the layout of `noizu_discord` (client / request / error / pagination).

## Installation

```elixir
def deps do
  [{:noizu_telegram, "~> 0.1.0"}]
end
```

## Configuration

The bot token is read from `TELEGRAM_BOT_TOKEN` (or passed per call via
`client:` opt / app env `:noizu_telegram, :client`). **The token is part of the
Bot API URL path** (`https://api.telegram.org/bot<token>/<method>`), so it is
redacted from every error message, inspect output, and exception.

## Usage

```elixir
{:ok, me} = Noizu.Telegram.Bot.get_me()

{:ok, msg} =
  Noizu.Telegram.Messages.send_message(-1001234567890, "deploy done",
    link_preview: false,
    disable_notification: true
  )

{:ok, updates} = Noizu.Telegram.Updates.get_updates(offset: 12_345, timeout: 25)

:ok = Noizu.Telegram.Webhook.set("https://example.test/hook", secret_token: "s3cret")
true = Noizu.Telegram.Webhook.valid_secret?("s3cret", conn_req_header)
```

Rate limiting: a 429 response carries Telegram's `parameters.retry_after`
(seconds); `Noizu.Telegram.Error` exposes it as `:retry_after` and the request
engine retries the call after that delay (bounded attempts).

MarkdownV2 escaping: `Noizu.Telegram.Markdown.escape_v2/1` escapes the
MarkdownV2 reserved characters so arbitrary text renders literally.

## Env vars

| var | purpose |
|---|---|
| `TELEGRAM_BOT_TOKEN` | bot token (default client) |

## License

MIT — see [LICENSE](LICENSE).
