Commite20a62e4Recorded29 Mar 2026Repositorysigil-telegram
Add README
Changed
README.md | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 71 insertions(+)Diff
README.mdadded
@@ -0,0 +1,71 @@
+1
# sigil-telegram+2
+3
A [Sigil](https://codeberg.org/sigil/sigil) library for the Telegram Bot API. Provides a complete bot framework with long-polling, command/message handlers, inline keyboards, MarkdownV2 formatting, and file uploads.+4
+5
## Features+6
+7
- **Bot framework** -- command, message, and callback handlers with long-polling loop+8
- **Message operations** -- send, edit, delete with MarkdownV2 support+9
- **Media sending** -- photos and documents by URL, file_id, or local file upload+10
- **Inline keyboards** -- button rows with callback data or URLs+11
- **MarkdownV2 formatting** -- bold, italic, code, links, spoilers with auto-escaping+12
- **Authorization** -- restrict by allowed chats and/or allowed users+13
- **Error recovery** -- configurable error handler, automatic retry on poll failure+14
- **Cooperative I/O** -- blocking (`tg-bot-run`) or non-blocking (`tg-bot-tick`)+15
+16
## Usage+17
+18
Add `sigil-telegram` as a dependency in your `package.sgl`:+19
+20
```scheme+21
(from-git url: "codeberg:sigil/sigil-telegram" package: "sigil-telegram")+22
```+23
+24
Then build a bot:+25
+26
```scheme+27
(import (sigil telegram))+28
+29
(define bot (make-tg-bot token: (getenv "TELEGRAM_BOT_TOKEN")))+30
+31
(tg-on-command bot "/hello"+32
(lambda (update)+33
(tg-reply bot update "Hello!")))+34
+35
(tg-on-message bot+36
(lambda (update)+37
(tg-reply bot update+38
(tg-bold "Echo: ")+39
(tg-escape-markdown (tg-message-text (tg-update-message update))))))+40
+41
(tg-bot-run bot)+42
```+43
+44
## Modules+45
+46
| Module | Description |+47
|--------|-------------|+48
| `(sigil telegram)` | Top-level re-exports |+49
| `(sigil telegram types)` | Data types: tg-user, tg-chat, tg-message, tg-update |+50
| `(sigil telegram client)` | Low-level API calls, message/media operations |+51
| `(sigil telegram bot)` | Bot framework, handlers, long-polling loop |+52
| `(sigil telegram format)` | MarkdownV2 formatting and inline keyboards |+53
+54
## Dependencies+55
+56
- sigil-stdlib+57
- sigil-json+58
- sigil-http+59
- sigil-tls+60
- sigil-crypto+61
+62
## Building+63
+64
```bash+65
sigil build --redirects dev-redirects.sgl+66
sigil test+67
```+68
+69
## License+70
+71
BSD-3-Clause