@xbibzlibrary/telebibz 0.3.2 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +34 -1
  2. package/README.id.md +65 -5
  3. package/README.md +46 -6
  4. package/README.zh-CN.md +75 -15
  5. package/dist/src/api/client.d.ts.map +1 -1
  6. package/dist/src/api/client.js +12 -0
  7. package/dist/src/api/client.js.map +1 -1
  8. package/dist/src/context/context.d.ts +46 -1
  9. package/dist/src/context/context.d.ts.map +1 -1
  10. package/dist/src/context/context.js +107 -0
  11. package/dist/src/context/context.js.map +1 -1
  12. package/dist/src/core/bot.d.ts +48 -3
  13. package/dist/src/core/bot.d.ts.map +1 -1
  14. package/dist/src/core/bot.js +95 -7
  15. package/dist/src/core/bot.js.map +1 -1
  16. package/dist/src/core/webhook-reply.d.ts +34 -0
  17. package/dist/src/core/webhook-reply.d.ts.map +1 -0
  18. package/dist/src/core/webhook-reply.js +37 -0
  19. package/dist/src/core/webhook-reply.js.map +1 -0
  20. package/dist/src/index.d.ts +2 -1
  21. package/dist/src/index.d.ts.map +1 -1
  22. package/dist/src/index.js +2 -1
  23. package/dist/src/index.js.map +1 -1
  24. package/dist/src/observability/logger.d.ts.map +1 -1
  25. package/dist/src/observability/logger.js +4 -1
  26. package/dist/src/observability/logger.js.map +1 -1
  27. package/dist/src/webhook/handler.d.ts +8 -0
  28. package/dist/src/webhook/handler.d.ts.map +1 -1
  29. package/dist/src/webhook/handler.js +26 -6
  30. package/dist/src/webhook/handler.js.map +1 -1
  31. package/dist-cjs/src/api/client.js +12 -0
  32. package/dist-cjs/src/context/context.js +107 -0
  33. package/dist-cjs/src/core/bot.js +97 -8
  34. package/dist-cjs/src/core/webhook-reply.js +42 -0
  35. package/dist-cjs/src/index.js +7 -1
  36. package/dist-cjs/src/observability/logger.js +4 -1
  37. package/dist-cjs/src/webhook/handler.js +26 -6
  38. package/docs/API.id.md +48 -4
  39. package/docs/API.md +48 -4
  40. package/docs/API.zh-CN.md +48 -4
  41. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,6 +1,39 @@
1
1
  # Changelog
2
2
 
3
- ## 0.3.0 — 2026-08-29
3
+ ## 0.4.2 — 2026-08-29
4
+
5
+ ### Added
6
+
7
+ - `bot.action(pattern, handler)` as a drop-in Telegraf alias for `bot.callback(...)`, so handlers written for Telegraf register unchanged.
8
+ - Graceful shutdown: `bot.stop()` drains in-flight update handlers (bounded by `handlerTimeout`) before stopping the plugin manager, so active conversations are never truncated mid-write. A handler calling `stop()` from inside itself is excluded from the drain set, so Telegraf-style stop-from-handler never deadlocks.
9
+ - Library-only benchmark suite: `npm run benchmark` measures the update pipeline, per-chat serialization, router dispatch, webhook round trips, and broadcast fan-out against `MockTransport` — no token or network required.
10
+
11
+ ### Fixed
12
+
13
+ - Logger level `silent` printed every message (including errors) because its priority sorted above all message levels; it now emits nothing.
14
+ - `printTeleBibzBanner()` and the other branding helpers documented as exported (`runStartupSequence()`, `startTeleBibzBanner()`, `paintRainbow()`, `printStatusLine()`) are now actually exported from the package entry point.
15
+ - `handlerTimeout` of `0` (or any non-finite value) now disables the timeout guard, alongside `Infinity`.
16
+
17
+ ### Changed
18
+
19
+ - README (all three languages): new complete "API surface" index, a Wizards section in the Indonesian and Simplified Chinese READMEs, the `imgbs.com` banner everywhere, fully localized code examples and sections, and a rewritten release-automation section describing the Conventional Commits versioning rules.
20
+
21
+ ## 0.4.1 — 2026-08-29
22
+
23
+ ### Added
24
+
25
+ - Full Telegraf-parity context surface: moderation (`banChatMember`, `unbanChatMember`, `restrictChatMember`, `promoteChatMember`, `banChatSenderChat`, `unbanChatSenderChat`), chat management (`setChatTitle/Description/Photo`, `deleteChatPhoto`, `setChatPermissions`, `leaveChat`, `unpinAllChatMessages`, `setChatStickerSet`, `deleteChatStickerSet`), member info (`getChatAdministrators`, `getChatMemberCount`, `getChatMember`), invite links (`exportChatInviteLink`, `createChatInviteLink`, `editChatInviteLink`, `revokeChatInviteLink`), join requests (`approveChatJoinRequest`, `declineChatJoinRequest`), polls and live location (`replyWithQuiz`, `stopPoll`, `editMessageLiveLocation`, `stopMessageLiveLocation`), games and payments (`replyWithGame`, `setGameScore`, `getGameHighScores`, `replyWithInvoice`), and the full forum-topic set (`createForumTopic` through `unhideGeneralForumTopic`). Every method acts on `ctx.chat` and accepts native Telegram parameters via `extra`.
26
+ - Opt-in Telegraf-style webhook replies: `createWebhookHandler(bot, { webhookReply: true })` (and `bot.handleUpdate(update, { webhookReply })` for custom servers) answers the first API call through the webhook HTTP response itself; the call resolves with `true`, later calls go through the transport, and the lazy `getMe` never claims the slot. Concurrency-safe via `AsyncLocalStorage`.
27
+ - `handlerTimeout` (default `90000`, Telegraf's value; `Infinity` disables): hung updates reject `handleUpdate()` with `UpdateTimeoutError` and flow through `update:error`/`bot:error`/the `catch()` boundary while the handler keeps running; per-chat ordering is unaffected.
28
+ - `contextType` bot option to plug in a custom `Context` subclass (Telegraf's `contextType`), and `dropPendingUpdates` on `start()`/`launch()` to drop Telegram-held updates before the first `getUpdates` call.
29
+
30
+ ## 0.3.2 — 2026-08-29
31
+
32
+ ### Changed
33
+
34
+ - README logo image URL updated.
35
+
36
+ ## 0.3.1 — 2026-08-29
4
37
 
5
38
  ### Added
6
39
 
package/README.id.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # telebibz
2
2
 
3
- ![telebibz logo](https://cdn.jsdelivr.net/npm/@xbibzlibrary/telebibz@latest/assets/telebibz-logo.png)
3
+ ![telebibz logo](https://imgbs.com/uploads/telebibz-d7b30671.png)
4
4
 
5
5
  [![CI](https://github.com/XbibzOfficial777/telebibz/actions/workflows/ci.yml/badge.svg)](https://github.com/XbibzOfficial777/telebibz/actions/workflows/ci.yml)
6
6
  [![npm version](https://img.shields.io/npm/v/@xbibzlibrary/telebibz)](https://www.npmjs.com/package/@xbibzlibrary/telebibz)
@@ -65,8 +65,9 @@ bot.use(async (ctx, next) => {
65
65
  });
66
66
 
67
67
  bot.command("help", async (ctx) => { await ctx.reply("Bantuan tersedia."); });
68
- bot.onRegex(/^order:(\\d+)$/, async (ctx) => { await ctx.reply("Order diterima."); });
68
+ bot.onRegex(/^order:(\d+)$/, async (ctx) => { await ctx.reply("Order diterima."); });
69
69
  bot.callback("profile:*", async (ctx) => { await ctx.answerCallbackQuery("Dibuka."); });
70
+ bot.action("menu:open", async (ctx) => { await ctx.answerCallbackQuery("Menu dibuka."); });
70
71
  bot.on("message:photo", async (ctx) => { await ctx.reply("Foto yang bagus."); });
71
72
  bot.on(["message:text", "callback_query:data"], async (ctx) => { await ctx.reply("Diterima."); });
72
73
  bot.hears("ping", async (ctx) => { await ctx.reply("pong"); });
@@ -109,6 +110,26 @@ Builder hanya menghasilkan payload keyboard native Telegram. UI HTML/CSS memerlu
109
110
 
110
111
  Logger mengeluarkan baris terminal yang ringkas dan mudah dibaca dengan level berwarna serta konteks terstruktur. Level log: `silent`, `error`, `warn`, `info`, `debug`, dan `trace`; nilai sensitif di-redact; error dicetak merah lengkap dengan stack. Gunakan `format: "json"` untuk log terstruktur, dan `includeUpdateContent: true` hanya bila teks pesan atau data callback memang diperlukan.
111
112
 
113
+ ## Wizard dan conversation multi-langkah
114
+
115
+ Gunakan `Wizard` bersama `bot.useWizard()` sehingga setiap balasan teks berikutnya dari chat/user yang sama otomatis diarahkan ke langkah yang sedang aktif. Key dihasilkan dari chat dan pengirim Telegram; tidak perlu key manual.
116
+
117
+ ```ts
118
+ import { Bot, Wizard } from "@xbibzlibrary/telebibz";
119
+
120
+ const wizard = new Wizard()
121
+ .step({ id: "prompt-name", run: async (flow) => { flow.next(); await flow.ctx.reply("Siapa nama kamu?"); } })
122
+ .step({ id: "name", run: async (flow) => { flow.set("name", flow.ctx.message?.text?.trim()); flow.next(); await flow.ctx.reply("Berapa umur kamu?"); } })
123
+ .step({ id: "age", run: (flow) => { const age = Number(flow.ctx.message?.text?.trim()); if (!Number.isInteger(age)) return; flow.set("age", age); flow.next(); } });
124
+
125
+ const bot = new Bot(process.env.TELEGRAM_BOT_TOKEN!);
126
+ bot.useWizard(wizard);
127
+ bot.command("start", async (ctx) => { await wizard.run(ctx); });
128
+ await bot.start();
129
+ ```
130
+
131
+ `Wizard` mempertahankan `ConversationManager` defaultnya antar update dan menandai conversation selesai tepat setelah langkah terakhir. Gunakan `/cancel` untuk membatalkan wizard yang sedang berjalan.
132
+
112
133
  ## Webhook
113
134
 
114
135
  ```ts
@@ -126,9 +147,10 @@ const handler = createWebhookHandler(bot, {
126
147
 
127
148
  telebibz dibangun untuk burst 1000+ pesan tanpa cooldown buatan:
128
149
 
129
- - **Paralel antar chat, berurutan per chat.** Setiap batch `getUpdates` (dan setiap request webhook) diproses secara konkuren — update dari chat berbeda tidak pernah saling mengantre, sementara update dari chat yang sama menjaga urutan kedatangannya sehingga session, wizard, dan conversation tetap benar dan penulisan session tidak pernah hilang. Burst konkuren hanya memicu satu inisialisasi `getMe`.
130
- - **Tidak ada throttling proaktif.** Permintaan keluar tidak pernah ditunda oleh library. Ketika Telegram menjawab 429, transport menunggu tepat jendela `retry_after` yang diperintahkan Telegram ("flood gate" global melindungi seluruh trafik) lalu otomatis retry — sehingga burst tetap terkirim lengkap, bukan gagal.
150
+ - **Paralel antar chat, berurutan per chat.** Setiap batch `getUpdates` (dan setiap request webhook) diproses secara konkuren — update dari chat berbeda tidak pernah saling mengantre, sementara update dari chat yang sama menjaga urutan kedatangannya sehingga session, wizard, dan conversation tetap benar dan penulisan session tidak pernah hilang. Burst konkuren hanya memicu satu inisialisasi `getMe`. Jika Anda mengelola loop polling sendiri, umpankan batch yang sudah diambil lewat `bot.handleUpdates()`.
151
+ - **Tidak ada throttling proaktif.** Permintaan keluar tidak pernah ditunda oleh library. Ketika Telegram menjawab 429, transport menunggu tepat jendela `retry_after` yang diperintahkan Telegram ("flood gate" global melindungi seluruh trafik) lalu otomatis retry — sehingga burst tetap terkirim lengkap, bukan gagal. Untuk batasan downstream Anda sendiri, `Limiter` dan `mapWithConcurrency()` mengatur laju beban kerja apa pun.
131
152
  - **Broadcast ke 1000+ user sekaligus.** `bot.broadcast()` langsung mencoba semua chat, me-retry 429 sesuai `retry_after` dari Telegram sendiri, dan mengembalikan laporan lengkap.
153
+ - **Shutdown yang anggun.** `bot.stop()` lebih dulu menunggu handler yang sedang berjalan selesai (dibatasi `handlerTimeout`) dan baru kemudian menghentikan plugin manager — conversation yang aktif tidak pernah terpotong di tengah penulisan.
132
154
 
133
155
  ```ts
134
156
  const report = await bot.broadcast(
@@ -141,6 +163,20 @@ console.log(`Terkirim ${report.delivered}/${report.total} dalam ${report.duratio
141
163
 
142
164
  Batasi pekerjaan simultan dengan `new Bot({ ..., updates: { concurrency: 64 } })` atau `broadcast(..., { concurrency: 64 })` jika downstream Anda (database, API) membutuhkannya — secara default keduanya berjalan sepenuhnya paralel.
143
165
 
166
+ ## Paritas penuh Telegraf di permukaan context
167
+
168
+ Semua shortcut context Telegraf tersedia, ditambah tambahan yang menutupi apa yang oleh inti Telegraf diserahkan ke ekosistem plugin-nya:
169
+
170
+ - **Moderasi & admin** — `ctx.banChatMember`, `ctx.unbanChatMember`, `ctx.restrictChatMember`, `ctx.promoteChatMember`, `ctx.banChatSenderChat`, `ctx.unbanChatSenderChat`
171
+ - **Manajemen chat** — `ctx.setChatTitle/Description/Photo`, `ctx.setChatPermissions`, `ctx.leaveChat`, `ctx.unpinAllChatMessages`, `ctx.setChatStickerSet`, `ctx.deleteChatStickerSet`
172
+ - **Info** — `ctx.getChatAdministrators`, `ctx.getChatMemberCount`, `ctx.getChatMember`
173
+ - **Invite link & join request** — `ctx.exportChatInviteLink`, `ctx.createChatInviteLink`, `ctx.editChatInviteLink`, `ctx.revokeChatInviteLink`, `ctx.approveChatJoinRequest`, `ctx.declineChatJoinRequest`
174
+ - **Poll, game, pembayaran** — `ctx.replyWithQuiz`, `ctx.stopPoll`, `ctx.editMessageLiveLocation`, `ctx.stopMessageLiveLocation`, `ctx.replyWithGame`, `ctx.setGameScore`, `ctx.getGameHighScores`, `ctx.replyWithInvoice`
175
+ - **Forum topic** — `ctx.createForumTopic`, `ctx.closeForumTopic`, `ctx.editGeneralForumTopic`, dan sembilan lainnya
176
+ - **Opsi launch** — `handlerTimeout` (default 90 detik, seperti Telegraf) melempar `UpdateTimeoutError` untuk update yang menggantung sementara handler tetap berjalan; `0` menonaktifkan timeout; `contextType` memasang subclass `Context` Anda sendiri; `dropPendingUpdates` di `start()`/`launch()`
177
+ - **Webhook reply** — opt-in `webhookReply: true` menjawab panggilan API pertama lewat respons HTTP webhook itu sendiri (ala Telegraf), dengan `getMe` malas yang tidak pernah mengklaim slot
178
+ - **Alias handler drop-in** — `bot.action(...)` mendaftarkan handler callback query sama seperti `bot.callback(...)`, sehingga handler yang ditulis untuk Telegraf bisa dipindahkan tanpa perubahan
179
+
144
180
  ## State, queue, scheduler, dan cache
145
181
 
146
182
  Paket menyediakan `MemoryStorage` dengan TTL dan pembaruan atomik, `JsonFileStorage`, `RedisStorage`, `SqlStorage`, `MongoStorage`, persistent application state storage, session bot, conversation dan form berbasis Storage, menu berbasis permission, pagination `MenuController`, `MemoryCache`, token-bucket limiter, task queue dengan retry/backoff/concurrency/delay/cancel, serta scheduler interval, one-shot, dan cron lima field lengkap. Adapter Redis, SQL, dan Mongo memakai driver kecil sehingga core package tetap tanpa runtime dependency vendor.
@@ -198,13 +234,37 @@ E2E Telegram nyata memerlukan `TELEGRAM_BOT_TOKEN` dan `TELEGRAM_TEST_CHAT_ID`.
198
234
 
199
235
  `validateWebAppInitData()` memverifikasi signature dan expiration Telegram Web App. `PaymentsClient` menyediakan wrapper invoice link, invoice, jawaban pre-checkout, jawaban Web App query, transaksi Stars, dan refund Stars. Gunakan `TelegramTypes` serta alias seperti `TelegramUser`, `TelegramMessage`, dan `TelegramUpdate` untuk full Telegram declaration surface yang divendor.
200
236
 
237
+ ## Permukaan API
238
+
239
+ Semua yang tercantum di bawah diekspor dari entry point package kecuali disebutkan subpath-nya. Signature lengkap setiap export terdokumentasi di [docs/API.id.md](docs/API.id.md) (juga [docs/API.md](docs/API.md) dan [docs/API.zh-CN.md](docs/API.zh-CN.md)).
240
+
241
+ | Area | Export |
242
+ |---|---|
243
+ | Bot & lifecycle | `Bot` dengan `on`, `onText`, `onRegex`, `command`, `hears`, `callback`, `action`, `catch`, `use`, `usePlugin`, `useWizard`, `handleUpdate`, `handleUpdates`, `start`/`launch`, `stop`, `restart`, `init`, `health`, `broadcast`, `getMe`, `setCommands`, `deleteCommands`; `UpdateTimeoutError` |
244
+ | Context | `Context`, `ContextOptions`, opsi launch `contextType`; ~80 shortcut di `ctx` untuk balasan, aksi admin, manajemen chat, invite link, poll, game, pembayaran, dan forum topic |
245
+ | Telegram API | `ApiClient` dengan `call()`, `request()`, `raw()`, dan `methods` (seluruh generated Bot API method); `FetchTransport` dengan retry 429/5xx otomatis dan flood gate global |
246
+ | Error | `TelegramError` dengan taksonomi `kind` (`retryable`, `rate-limit`, `authentication`, `validation`, `network`, `server`, `unknown`) dan `retryAfter`, plus `TelegramRateLimitError`, `TelegramAuthError`, `TelegramValidationError`, `TelegramNetworkError` |
247
+ | Router & middleware | `Router`, `compose`, 24 filter update (`message:photo`, `callback_query:data`, …), `matchMode` (`first`/`all`) |
248
+ | Keyboard | `InlineKeyboard`, `ReplyKeyboard`, `removeKeyboard()`, `forceReply()` |
249
+ | Storage | `MemoryStorage` (TTL, serialisasi per-key), `JsonFileStorage`, `RedisStorage`, `SqlStorage`, `MongoStorage`, beserta driver interface kecil yang menjadi dasarnya |
250
+ | Cache & limiting | `MemoryCache`, `TokenBucketLimiter`, `Limiter`, `mapWithConcurrency()` |
251
+ | Queue & scheduler | `TaskQueue` (prioritas, retry, backoff, delay, cancel), `Scheduler` (interval, one-shot, cron), `parseCronExpression()`, `nextCronOccurrence()` |
252
+ | State & dialog | `Wizard`, `ConversationManager`, `ConversationFlow`, `Form` dengan `validators`, `Menu` berbasis permission, `MenuController`, `paginate()` |
253
+ | Webhook | `createWebhookHandler()` (Request/Response Web), `webhookCallback()` untuk Express/Koa/Fastify/Node `http`, `runWithWebhookReply()`, `claimWebhookReply()` |
254
+ | Web App & pembayaran | `parseWebAppInitData()`, `validateWebAppInitData()`, `PaymentsClient`, `TelegramTypes` (deklarasi Telegram yang dibundel) |
255
+ | Observability | `Logger` (level, redaction, format JSON), `EventBus` dengan event map `update:*`, `bot:*`, `broadcast:*`, `redact()` |
256
+ | Terminal | `printTeleBibzBanner()`, `printTerminalBranding()`, `buildTerminalBranding()`, `runStartupSequence()`, `startTeleBibzBanner()`, `paintRainbow()`, `printStatusLine()` |
257
+ | Utilitas teks | `splitMessage()`, `splitCaption()`, `escapeMarkdownV2()`, `escapeHtml()`, `md`, `html`, `template()` |
258
+ | Testing (`@xbibzlibrary/telebibz/testing`) | `MockTransport`, `createTestBot()`, `createMockUpdate()`, `createMockCallbackUpdate()`, `createMockContext()` |
259
+ | CLI (`telebibz …`) | `init`, `doctor`, `build`, `test`, `start`, `webhook`, `generate` |
260
+
201
261
  ## API target dan batasan
202
262
 
203
263
  Daftar method dihasilkan dari dokumentasi Telegram Bot API saat skema diperbarui. Akses runtime tersedia untuk method resmi yang terdeteksi, sedangkan inferensi parameter/result khusus dipusatkan pada core method map. Full declaration Telegram untuk object, union, enum, dan method tersedia melalui `TelegramTypes`. Lihat [FEATURE_MATRIX.md](FEATURE_MATRIX.md) untuk status implementasi dan `docs/API.id.md` untuk referensi API lengkap.
204
264
 
205
265
  ## Otomatisasi release
206
266
 
207
- Repository GitHub menyediakan CI dan workflow auto-publish. Setiap push ke `main` menjalankan quality gates, memilih patch version yang belum dipakai, membuat commit dan tag, menerbitkan package ke npmjs, lalu membuat GitHub Release. Karena source repository bersifat private, workflow menggunakan `--provenance=false`. GitHub Packages tersedia sebagai opsi terpisah jika organisasi GitHub dengan scope `xbibzlibrary` dibuat kemudian. Konfigurasikan secret `NPM_TOKEN` pada GitHub Actions sebelum mengandalkan publish otomatis. Lihat [RELEASE_AUTOMATION.md](RELEASE_AUTOMATION.md) dan panduan [GitHub Packages](docs/GITHUB_PACKAGES.id.md).
267
+ Repository GitHub menyediakan CI dan workflow auto-publish. Setiap push ke `main` menjalankan quality gates lalu menurunkan versi berikutnya dari Conventional Commits yang didorong: commit `feat:` dan breaking change menaikkan minor selama package belum 1.0 (footer `BREAKING-CHANGE` atau subjek `type!:` menaikkan major mulai 1.0.0), sisanya menaikkan patch. Versi yang sudah dideklarasikan di `package.json` lebih tinggi dari npm diterbitkan persis apa adanya, dan workflow tidak pernah menerbitkan versi yang kurang dari atau sama dengan rilis npm terbaru. Workflow membuat commit versi, tag, menerbitkan ke npm (dengan provenance dinonaktifkan lewat `--provenance=false`), lalu membuat GitHub Release. Commit yang memuat `[skip release]` tidak memicu penerbitan. Konfigurasikan secret `NPM_TOKEN` pada GitHub Actions sebelum mengandalkan publish otomatis. Lihat [RELEASE_AUTOMATION.md](RELEASE_AUTOMATION.md) dan panduan [GitHub Packages](docs/GITHUB_PACKAGES.id.md).
208
268
 
209
269
  ## Policy project dan kontribusi
210
270
 
package/README.md CHANGED
@@ -67,8 +67,9 @@ bot.use(async (ctx, next) => {
67
67
  });
68
68
 
69
69
  bot.command("help", async (ctx) => { await ctx.reply("Help is available."); });
70
- bot.onRegex(/^order:(\\d+)$/, async (ctx) => { await ctx.reply("Order received."); });
70
+ bot.onRegex(/^order:(\d+)$/, async (ctx) => { await ctx.reply("Order received."); });
71
71
  bot.callback("profile:*", async (ctx) => { await ctx.answerCallbackQuery("Opened."); });
72
+ bot.action("menu:open", async (ctx) => { await ctx.answerCallbackQuery("Menu opened."); });
72
73
  bot.on("message:photo", async (ctx) => { await ctx.reply("Nice photo."); });
73
74
  bot.on(["message:text", "callback_query:data"], async (ctx) => { await ctx.reply("Got it."); });
74
75
  bot.hears("ping", async (ctx) => { await ctx.reply("pong"); });
@@ -125,8 +126,8 @@ Use `Wizard` with `bot.useWizard()` so every subsequent text reply from the same
125
126
  import { Bot, Wizard } from "@xbibzlibrary/telebibz";
126
127
 
127
128
  const wizard = new Wizard()
128
- .step({ id: "prompt-name", run: async (flow) => { flow.next(); await flow.ctx.reply("Siapa nama kamu?"); } })
129
- .step({ id: "name", run: async (flow) => { flow.set("name", flow.ctx.message?.text?.trim()); flow.next(); await flow.ctx.reply("Berapa umur kamu?"); } })
129
+ .step({ id: "prompt-name", run: async (flow) => { flow.next(); await flow.ctx.reply("What is your name?"); } })
130
+ .step({ id: "name", run: async (flow) => { flow.set("name", flow.ctx.message?.text?.trim()); flow.next(); await flow.ctx.reply("How old are you?"); } })
130
131
  .step({ id: "age", run: (flow) => { const age = Number(flow.ctx.message?.text?.trim()); if (!Number.isInteger(age)) return; flow.set("age", age); flow.next(); } });
131
132
 
132
133
  const bot = new Bot(process.env.TELEGRAM_BOT_TOKEN!);
@@ -154,9 +155,10 @@ const handler = createWebhookHandler(bot, {
154
155
 
155
156
  telebibz is built for bursts of 1000+ messages with no artificial cooldown:
156
157
 
157
- - **Parallel across chats, ordered per chat.** Every `getUpdates` batch (and every webhook request) is processed concurrently — updates from different chats never queue behind each other, while updates from the same chat keep their arrival order so sessions, wizards, and conversations stay correct and session writes are never lost. A concurrent burst triggers exactly one `getMe` initialization.
158
- - **No proactive throttling.** Outgoing requests are never delayed by the library. When Telegram answers 429, the transport waits exactly the `retry_after` window Telegram ordered (a global "flood gate" protects all in-flight traffic) and retries automatically — so bursts deliver completely instead of failing.
158
+ - **Parallel across chats, ordered per chat.** Every `getUpdates` batch (and every webhook request) is processed concurrently — updates from different chats never queue behind each other, while updates from the same chat keep their arrival order so sessions, wizards, and conversations stay correct and session writes are never lost. A concurrent burst triggers exactly one `getMe` initialization. Feed pre-fetched batches yourself with `bot.handleUpdates()` when you own the polling loop.
159
+ - **No proactive throttling.** Outgoing requests are never delayed by the library. When Telegram answers 429, the transport waits exactly the `retry_after` window Telegram ordered (a global "flood gate" protects all in-flight traffic) and retries automatically — so bursts deliver completely instead of failing. For your own downstream limits, `Limiter` and `mapWithConcurrency()` rate-shape any workload.
159
160
  - **Broadcast to 1000+ users at once.** `bot.broadcast()` attempts every chat immediately, retries 429s per Telegram's own `retry_after`, and returns a full report.
161
+ - **Graceful shutdown.** `bot.stop()` first waits for in-flight handlers to finish (bounded by `handlerTimeout`) and only then stops the plugin manager — active conversations are never truncated mid-write.
160
162
 
161
163
  ```ts
162
164
  const report = await bot.broadcast(
@@ -169,6 +171,20 @@ console.log(`Delivered ${report.delivered}/${report.total} in ${report.durationM
169
171
 
170
172
  Cap simultaneous work with `new Bot({ ..., updates: { concurrency: 64 } })` or `broadcast(..., { concurrency: 64 })` when your own downstream (database, API) needs it — by default both run fully parallel.
171
173
 
174
+ ## Full Telegraf parity on the context surface
175
+
176
+ Every Telegraf context shortcut is available, plus additions that cover what the Telegraf core leaves to its plugin ecosystem:
177
+
178
+ - **Moderation & admin** — `ctx.banChatMember`, `ctx.unbanChatMember`, `ctx.restrictChatMember`, `ctx.promoteChatMember`, `ctx.banChatSenderChat`, `ctx.unbanChatSenderChat`
179
+ - **Chat management** — `ctx.setChatTitle/Description/Photo`, `ctx.setChatPermissions`, `ctx.leaveChat`, `ctx.unpinAllChatMessages`, `ctx.setChatStickerSet`, `ctx.deleteChatStickerSet`
180
+ - **Info** — `ctx.getChatAdministrators`, `ctx.getChatMemberCount`, `ctx.getChatMember`
181
+ - **Invite links & join requests** — `ctx.exportChatInviteLink`, `ctx.createChatInviteLink`, `ctx.editChatInviteLink`, `ctx.revokeChatInviteLink`, `ctx.approveChatJoinRequest`, `ctx.declineChatJoinRequest`
182
+ - **Polls, games, payments** — `ctx.replyWithQuiz`, `ctx.stopPoll`, `ctx.editMessageLiveLocation`, `ctx.stopMessageLiveLocation`, `ctx.replyWithGame`, `ctx.setGameScore`, `ctx.getGameHighScores`, `ctx.replyWithInvoice`
183
+ - **Forum topics** — `ctx.createForumTopic`, `ctx.closeForumTopic`, `ctx.editGeneralForumTopic`, and nine more
184
+ - **Launch options** — `handlerTimeout` (default 90s, like Telegraf) rejects hung updates with `UpdateTimeoutError` while the handler keeps running; `0` disables the timeout; `contextType` plugs in your own `Context` subclass; `dropPendingUpdates` on `start()/launch()`
185
+ - **Webhook replies** — opt-in `webhookReply: true` answers the first API call through the webhook HTTP response itself (Telegraf-style), with the lazy `getMe` never claiming the slot
186
+ - **Drop-in handler aliases** — `bot.action(...)` registers a callback-query handler just like `bot.callback(...)`, so handlers written for Telegraf migrate unchanged
187
+
172
188
  ## State, queue, scheduler, and cache
173
189
 
174
190
  The package provides `MemoryStorage` with TTL and serialized per-key updates, `JsonFileStorage`, `RedisStorage`, `SqlStorage`, `MongoStorage`, persistent application state storage, bot sessions, storage-backed conversations and forms, permission-aware menus, `MenuController` pagination, `MemoryCache`, a token-bucket limiter, a task queue with retry/backoff/concurrency/delay/cancel, and schedulers for intervals, one-shot tasks, and full five-field cron expressions. Redis, SQL, and Mongo adapters use small driver interfaces so the core package remains free of vendor runtime dependencies.
@@ -227,6 +243,30 @@ Real Telegram E2E tests require `TELEGRAM_BOT_TOKEN` and `TELEGRAM_TEST_CHAT_ID`
227
243
 
228
244
  `validateWebAppInitData()` verifies Telegram Web App signatures and expiration. `PaymentsClient` provides wrappers for invoice links, invoices, pre-checkout answers, Web App query answers, Stars transactions, and Stars refunds. Use `TelegramTypes` and aliases such as `TelegramUser`, `TelegramMessage`, and `TelegramUpdate` for the vendored full Telegram declaration surface.
229
245
 
246
+ ## API surface
247
+
248
+ Everything below ships from the package entry point unless a subpath is given. Full signatures for every export are documented in [docs/API.md](docs/API.md) (also [docs/API.id.md](docs/API.id.md) and [docs/API.zh-CN.md](docs/API.zh-CN.md)).
249
+
250
+ | Area | Exports |
251
+ |---|---|
252
+ | Bot & lifecycle | `Bot` with `on`, `onText`, `onRegex`, `command`, `hears`, `callback`, `action`, `catch`, `use`, `usePlugin`, `useWizard`, `handleUpdate`, `handleUpdates`, `start`/`launch`, `stop`, `restart`, `init`, `health`, `broadcast`, `getMe`, `setCommands`, `deleteCommands`; `UpdateTimeoutError` |
253
+ | Context | `Context`, `ContextOptions`, `contextType` launch option; ~80 shortcuts on `ctx` for replies, admin actions, chat management, invite links, polls, games, payments, and forum topics |
254
+ | Telegram API | `ApiClient` with `call()`, `request()`, `raw()`, and `methods` (all generated Bot API methods); `FetchTransport` with automatic 429/5xx retries and a global flood gate |
255
+ | Errors | `TelegramError` with a `kind` taxonomy (`retryable`, `rate-limit`, `authentication`, `validation`, `network`, `server`, `unknown`) and `retryAfter`, plus `TelegramRateLimitError`, `TelegramAuthError`, `TelegramValidationError`, `TelegramNetworkError` |
256
+ | Router & middleware | `Router`, `compose`, 24 update filters (`message:photo`, `callback_query:data`, …), `matchMode` (`first`/`all`) |
257
+ | Keyboards | `InlineKeyboard`, `ReplyKeyboard`, `removeKeyboard()`, `forceReply()` |
258
+ | Storage | `MemoryStorage` (TTL, per-key serialization), `JsonFileStorage`, `RedisStorage`, `SqlStorage`, `MongoStorage`, plus the small driver interfaces they build on |
259
+ | Cache & limiting | `MemoryCache`, `TokenBucketLimiter`, `Limiter`, `mapWithConcurrency()` |
260
+ | Queue & scheduler | `TaskQueue` (priority, retry, backoff, delay, cancel), `Scheduler` (intervals, one-shot, cron), `parseCronExpression()`, `nextCronOccurrence()` |
261
+ | State & dialogs | `Wizard`, `ConversationManager`, `ConversationFlow`, `Form` with `validators`, permission-aware `Menu`, `MenuController`, `paginate()` |
262
+ | Webhook | `createWebhookHandler()` (Web `Request`/`Response`), `webhookCallback()` for Express/Koa/Fastify/Node `http`, `runWithWebhookReply()`, `claimWebhookReply()` |
263
+ | Web Apps & payments | `parseWebAppInitData()`, `validateWebAppInitData()`, `PaymentsClient`, `TelegramTypes` (vendored Telegram declarations) |
264
+ | Observability | `Logger` (levels, redaction, JSON format), `EventBus` with the `update:*`, `bot:*`, and `broadcast:*` event maps, `redact()` |
265
+ | Terminal | `printTeleBibzBanner()`, `printTerminalBranding()`, `buildTerminalBranding()`, `runStartupSequence()`, `startTeleBibzBanner()`, `paintRainbow()`, `printStatusLine()` |
266
+ | Text utilities | `splitMessage()`, `splitCaption()`, `escapeMarkdownV2()`, `escapeHtml()`, `md`, `html`, `template()` |
267
+ | Testing (`@xbibzlibrary/telebibz/testing`) | `MockTransport`, `createTestBot()`, `createMockUpdate()`, `createMockCallbackUpdate()`, `createMockContext()` |
268
+ | CLI (`telebibz …`) | `init`, `doctor`, `build`, `test`, `start`, `webhook`, `generate` |
269
+
230
270
  ## API targets and limitations
231
271
 
232
272
  The generated method list is derived from the Telegram Bot API schema when it is updated. Runtime access is available for detected official methods, while specialized request/result inference remains concentrated on the core method map. The complete vendored Telegram object, union, enum, and method declarations are available through `TelegramTypes`. See [FEATURE_MATRIX.md](FEATURE_MATRIX.md) for implementation status and [docs/API.md](docs/API.md) for the complete API reference.
@@ -235,7 +275,7 @@ For every exported class, function, method, type, error, lifecycle hook, CLI com
235
275
 
236
276
  ## Release automation
237
277
 
238
- The GitHub repository includes CI and an auto-publish workflow. A push to `main` runs the quality gates, chooses the next unused patch version, commits the version, creates a tag, publishes to npm, and creates a GitHub Release. Because the source repository is private, the workflow uses `--provenance=false`, which npm requires for private source repositories. Configure the `NPM_TOKEN` GitHub Actions secret before relying on automatic publication. See [RELEASE_AUTOMATION.md](RELEASE_AUTOMATION.md).
278
+ The GitHub repository includes CI and an auto-publish workflow. A push to `main` runs the quality gates and derives the next version from the pushed Conventional Commits: `feat:` commits and breaking changes bump the minor version while the package is pre-1.0 (`BREAKING-CHANGE` footers or `type!:` subjects bump the major from 1.0.0 onward), everything else bumps the patch version. A version already declared in `package.json` ahead of npm publishes exactly as declared, and the workflow never publishes a version at or below the latest npm release. The workflow commits the version, creates the tag, publishes to npm (with provenance disabled via `--provenance=false`), and creates a GitHub Release. Commits containing `[skip release]` do not trigger a publication. Configure the `NPM_TOKEN` GitHub Actions secret before relying on automatic publication. See [RELEASE_AUTOMATION.md](RELEASE_AUTOMATION.md).
239
279
 
240
280
  ## Project policies and contribution
241
281
 
package/README.zh-CN.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # telebibz
2
2
 
3
- ![telebibz 徽标](https://cdn.jsdelivr.net/npm/@xbibzlibrary/telebibz@latest/assets/telebibz-logo.png)
3
+ ![telebibz 徽标](https://imgbs.com/uploads/telebibz-d7b30671.png)
4
4
 
5
5
  [![CI](https://github.com/XbibzOfficial777/telebibz/actions/workflows/ci.yml/badge.svg)](https://github.com/XbibzOfficial777/telebibz/actions/workflows/ci.yml)
6
6
  [![npm version](https://img.shields.io/npm/v/@xbibzlibrary/telebibz)](https://www.npmjs.com/package/@xbibzlibrary/telebibz)
@@ -36,7 +36,7 @@ import { Bot } from "@xbibzlibrary/telebibz";
36
36
 
37
37
  const bot = new Bot(process.env.TELEGRAM_BOT_TOKEN!);
38
38
 
39
- bot.command("start", async (ctx) => { await ctx.reply("Bot aktif."); });
39
+ bot.command("start", async (ctx) => { await ctx.reply("机器人已启动。"); });
40
40
  bot.onText("ping", async (ctx) => { await ctx.reply("pong"); });
41
41
 
42
42
  await bot.start();
@@ -64,9 +64,10 @@ bot.use(async (ctx, next) => {
64
64
  console.log(`processed in ${Date.now() - started}ms`);
65
65
  });
66
66
 
67
- bot.command("help", async (ctx) => { await ctx.reply("Bantuan tersedia."); });
68
- bot.onRegex(/^order:(\\d+)$/, async (ctx) => { await ctx.reply("Order diterima."); });
69
- bot.callback("profile:*", async (ctx) => { await ctx.answerCallbackQuery("Dibuka."); });
67
+ bot.command("help", async (ctx) => { await ctx.reply("可以查看帮助。"); });
68
+ bot.onRegex(/^order:(\d+)$/, async (ctx) => { await ctx.reply("订单已收到。"); });
69
+ bot.callback("profile:*", async (ctx) => { await ctx.answerCallbackQuery("已打开。"); });
70
+ bot.action("menu:open", async (ctx) => { await ctx.answerCallbackQuery("菜单已打开。"); });
70
71
  bot.on("message:photo", async (ctx) => { await ctx.reply("照片不错。"); });
71
72
  bot.on(["message:text", "callback_query:data"], async (ctx) => { await ctx.reply("收到。"); });
72
73
  bot.hears("ping", async (ctx) => { await ctx.reply("pong"); });
@@ -81,8 +82,8 @@ bot.catch(async (error, ctx) => { await ctx.reply("出错了。"); });
81
82
 
82
83
  ```ts
83
84
  await bot.api.methods.getMe();
84
- await bot.api.methods.sendMessage({ chat_id: 123456789, text: "Halo." });
85
- await bot.api.call("sendMessage", { chat_id: 123456789, text: "Halo." });
85
+ await bot.api.methods.sendMessage({ chat_id: 123456789, text: "你好。" });
86
+ await bot.api.call("sendMessage", { chat_id: 123456789, text: "你好。" });
86
87
  await bot.api.raw("futureTelegramMethod", { value: true });
87
88
  ```
88
89
 
@@ -96,18 +97,38 @@ await bot.api.raw("futureTelegramMethod", { value: true });
96
97
  import { InlineKeyboard } from "@xbibzlibrary/telebibz";
97
98
 
98
99
  const keyboard = new InlineKeyboard()
99
- .text("Profil", "profile")
100
- .url("Dokumentasi", "https://core.telegram.org/bots/api")
100
+ .text("个人资料", "profile")
101
+ .url("文档", "https://core.telegram.org/bots/api")
101
102
  .build();
102
103
 
103
- await ctx.reply("Pilih menu:", { reply_markup: keyboard });
104
+ await ctx.reply("请选择菜单:", { reply_markup: keyboard });
104
105
  ```
105
106
 
106
107
  构造器仅生成 Telegram 原生键盘的 payload。HTML/CSS 的 UI 需要单独的 Mini App 或 Web App。
107
108
 
108
- ## Startup and terminal logs
109
+ ## 启动与终端日志
109
110
 
110
- The logger emits compact, readable terminal lines with colored levels and structured context. Log levels are `silent`, `error`, `warn`, `info`, `debug`, and `trace`; sensitive values are redacted; errors print in red with the full stack. Use `format: "json"` for machine ingestion and `includeUpdateContent: true` only when message text or callback data is explicitly required.
111
+ Logger 输出紧凑易读的终端日志行,带彩色级别和结构化上下文。日志级别为 `silent`、`error`、`warn`、`info`、`debug` `trace`;敏感值会被 redact;错误以红色打印并带完整堆栈。使用 `format: "json"` 做机器摄取,仅在明确需要消息文本或回调数据时才开启 `includeUpdateContent: true`。
112
+
113
+ ## Wizard 与多步会话
114
+
115
+ 将 `Wizard` 与 `bot.useWizard()` 配合使用,来自同一 chat/user 的后续每条文本回复都会自动路由到当前步骤。Key 由 Telegram chat 和发送者生成,无需手动指定。
116
+
117
+ ```ts
118
+ import { Bot, Wizard } from "@xbibzlibrary/telebibz";
119
+
120
+ const wizard = new Wizard()
121
+ .step({ id: "prompt-name", run: async (flow) => { flow.next(); await flow.ctx.reply("你叫什么名字?"); } })
122
+ .step({ id: "name", run: async (flow) => { flow.set("name", flow.ctx.message?.text?.trim()); flow.next(); await flow.ctx.reply("你多大了?"); } })
123
+ .step({ id: "age", run: (flow) => { const age = Number(flow.ctx.message?.text?.trim()); if (!Number.isInteger(age)) return; flow.set("age", age); flow.next(); } });
124
+
125
+ const bot = new Bot(process.env.TELEGRAM_BOT_TOKEN!);
126
+ bot.useWizard(wizard);
127
+ bot.command("start", async (ctx) => { await wizard.run(ctx); });
128
+ await bot.start();
129
+ ```
130
+
131
+ `Wizard` 在 update 之间保持其默认的 `ConversationManager`,并在最后一步完成后立即标记会话完成。使用 `/cancel` 可取消正在进行的 wizard。
111
132
 
112
133
  ## Webhook
113
134
 
@@ -126,9 +147,10 @@ const handler = createWebhookHandler(bot, {
126
147
 
127
148
  telebibz 为 1000+ 条消息的突发场景而生,没有任何人为冷却:
128
149
 
129
- - **跨 chat 并行,同一 chat 内按序。** 每个 `getUpdates` 批次(以及每个 webhook 请求)都并发处理——不同 chat 的 update 不会互相排队,而同一 chat 的 update 保持到达顺序,因此会话、wizard 和 conversation 始终正确,会话写入永不丢失。并发突发只触发一次 `getMe` 初始化。
130
- - **没有主动限流。** 库永远不会延迟外发请求。当 Telegram 返回 429 时,transport 会严格按照 Telegram 指定的 `retry_after` 窗口等待(全局 "flood gate" 保护所有进行中的流量)并自动重试——因此突发流量会完整送达而不是失败。
150
+ - **跨 chat 并行,同一 chat 内按序。** 每个 `getUpdates` 批次(以及每个 webhook 请求)都并发处理——不同 chat 的 update 不会互相排队,而同一 chat 的 update 保持到达顺序,因此会话、wizard 和 conversation 始终正确,会话写入永不丢失。并发突发只触发一次 `getMe` 初始化。如果你自己持有轮询循环,可用 `bot.handleUpdates()` 直接喂入已拉取的批次。
151
+ - **没有主动限流。** 库永远不会延迟外发请求。当 Telegram 返回 429 时,transport 会严格按照 Telegram 指定的 `retry_after` 窗口等待(全局 "flood gate" 保护所有进行中的流量)并自动重试——因此突发流量会完整送达而不是失败。针对你自己的下游限制,`Limiter` 与 `mapWithConcurrency()` 可为任意工作负载整形速率。
131
152
  - **一次性向 1000+ 用户广播。** `bot.broadcast()` 立即尝试所有 chat,按照 Telegram 自己的 `retry_after` 重试 429,并返回完整报告。
153
+ - **优雅停机。** `bot.stop()` 会先等待进行中的 handler 完成(受 `handlerTimeout` 约束),然后才停止 plugin manager——进行中的会话绝不会在写入途中被截断。
132
154
 
133
155
  ```ts
134
156
  const report = await bot.broadcast(
@@ -141,6 +163,20 @@ console.log(`Delivered ${report.delivered}/${report.total} in ${report.durationM
141
163
 
142
164
  当你自己的下游(数据库、API)需要时,可以用 `new Bot({ ..., updates: { concurrency: 64 } })` 或 `broadcast(..., { concurrency: 64 })` 限制并发——默认情况下两者都完全并行。
143
165
 
166
+ ## Context 表面与 Telegraf 完全对齐
167
+
168
+ Telegraf 的每一个 context 快捷方法都可用,还包含补齐 Telegraf 核心交给其插件生态的部分:
169
+
170
+ - **管理与封禁** — `ctx.banChatMember`、`ctx.unbanChatMember`、`ctx.restrictChatMember`、`ctx.promoteChatMember`、`ctx.banChatSenderChat`、`ctx.unbanChatSenderChat`
171
+ - **聊天管理** — `ctx.setChatTitle/Description/Photo`、`ctx.setChatPermissions`、`ctx.leaveChat`、`ctx.unpinAllChatMessages`、`ctx.setChatStickerSet`、`ctx.deleteChatStickerSet`
172
+ - **信息** — `ctx.getChatAdministrators`、`ctx.getChatMemberCount`、`ctx.getChatMember`
173
+ - **邀请链接与加群申请** — `ctx.exportChatInviteLink`、`ctx.createChatInviteLink`、`ctx.editChatInviteLink`、`ctx.revokeChatInviteLink`、`ctx.approveChatJoinRequest`、`ctx.declineChatJoinRequest`
174
+ - **投票、游戏、支付** — `ctx.replyWithQuiz`、`ctx.stopPoll`、`ctx.editMessageLiveLocation`、`ctx.stopMessageLiveLocation`、`ctx.replyWithGame`、`ctx.setGameScore`、`ctx.getGameHighScores`、`ctx.replyWithInvoice`
175
+ - **论坛主题** — `ctx.createForumTopic`、`ctx.closeForumTopic`、`ctx.editGeneralForumTopic` 等九个
176
+ - **启动选项** — `handlerTimeout`(默认 90 秒,与 Telegraf 一致)以 `UpdateTimeoutError` 拒绝挂起的 update,同时 handler 继续运行;传 `0` 可禁用超时;`contextType` 接入你自己的 `Context` 子类;`start()`/`launch()` 的 `dropPendingUpdates`
177
+ - **Webhook 应答** — 选择性开启的 `webhookReply: true` 让第一个 API 调用直接通过 webhook HTTP 响应本身应答(Telegraf 风格),懒加载的 `getMe` 永远不会占用槽位
178
+ - **即插即用的 handler 别名** — `bot.action(...)` 与 `bot.callback(...)` 一样注册回调查询 handler,为 Telegraf 编写的 handler 可以原样迁移
179
+
144
180
  ## 状态、队列、调度器和缓存
145
181
 
146
182
  该包提供带 TTL 和原子更新的 `MemoryStorage`、`JsonFileStorage`、`RedisStorage`、`SqlStorage`、`MongoStorage`、bot session、基于 Storage 的 conversation/form、基于 permission 的菜单、`MenuController` 分页、`MemoryCache`、令牌桶限流器、支持重试/退避/并发/延迟/取消的任务队列,以及间隔、一次性和完整五字段 cron 的调度器。Redis、SQL 和 Mongo 适配器使用小型 driver interface,因此 core package 不需要 vendor runtime dependency。
@@ -198,13 +234,37 @@ npm run release:check
198
234
 
199
235
  `validateWebAppInitData()` 会验证 Telegram Web App 的 signature 和 expiration。`PaymentsClient` 提供 invoice link、invoice、pre-checkout answer、Web App query answer、Stars transactions 和 Stars refunds 的 wrapper。使用 `TelegramTypes` 以及 `TelegramUser`、`TelegramMessage`、`TelegramUpdate` 等 alias 来访问完整的 vendored Telegram declaration surface。
200
236
 
237
+ ## API 表面
238
+
239
+ 除注明 subpath 外,以下所有内容都从 package 入口导出。每个导出的完整签名见 [docs/API.zh-CN.md](docs/API.zh-CN.md)(另有 [docs/API.md](docs/API.md) 与 [docs/API.id.md](docs/API.id.md))。
240
+
241
+ | 领域 | 导出 |
242
+ |---|---|
243
+ | Bot 与生命周期 | `Bot` 的 `on`、`onText`、`onRegex`、`command`、`hears`、`callback`、`action`、`catch`、`use`、`usePlugin`、`useWizard`、`handleUpdate`、`handleUpdates`、`start`/`launch`、`stop`、`restart`、`init`、`health`、`broadcast`、`getMe`、`setCommands`、`deleteCommands`;`UpdateTimeoutError` |
244
+ | Context | `Context`、`ContextOptions`、launch 选项 `contextType`;`ctx` 上约 80 个快捷方法,覆盖回复、管理员操作、聊天管理、邀请链接、投票、游戏、支付与论坛主题 |
245
+ | Telegram API | `ApiClient` 的 `call()`、`request()`、`raw()` 与 `methods`(全部生成的 Bot API 方法);`FetchTransport` 自带 429/5xx 自动重试和全局 flood gate |
246
+ | 错误 | `TelegramError` 带 `kind` 分类(`retryable`、`rate-limit`、`authentication`、`validation`、`network`、`server`、`unknown`)与 `retryAfter`,另有 `TelegramRateLimitError`、`TelegramAuthError`、`TelegramValidationError`、`TelegramNetworkError` |
247
+ | 路由器与中间件 | `Router`、`compose`、24 个 update 过滤器(`message:photo`、`callback_query:data` 等)、`matchMode`(`first`/`all`) |
248
+ | 键盘 | `InlineKeyboard`、`ReplyKeyboard`、`removeKeyboard()`、`forceReply()` |
249
+ | 存储 | `MemoryStorage`(TTL、按 key 串行化)、`JsonFileStorage`、`RedisStorage`、`SqlStorage`、`MongoStorage`,以及它们所基于的小型 driver interface |
250
+ | 缓存与限流 | `MemoryCache`、`TokenBucketLimiter`、`Limiter`、`mapWithConcurrency()` |
251
+ | 队列与调度器 | `TaskQueue`(优先级、重试、退避、延迟、取消)、`Scheduler`(间隔、一次性、cron)、`parseCronExpression()`、`nextCronOccurrence()` |
252
+ | 状态与对话 | `Wizard`、`ConversationManager`、`ConversationFlow`、带 `validators` 的 `Form`、基于 permission 的 `Menu`、`MenuController`、`paginate()` |
253
+ | Webhook | `createWebhookHandler()`(Web `Request`/`Response`)、面向 Express/Koa/Fastify/Node `http` 的 `webhookCallback()`、`runWithWebhookReply()`、`claimWebhookReply()` |
254
+ | Web App 与支付 | `parseWebAppInitData()`、`validateWebAppInitData()`、`PaymentsClient`、`TelegramTypes`(内置的 Telegram 声明) |
255
+ | 可观测性 | `Logger`(级别、redaction、JSON 格式)、带 `update:*`、`bot:*`、`broadcast:*` 事件映射的 `EventBus`、`redact()` |
256
+ | 终端 | `printTeleBibzBanner()`、`printTerminalBranding()`、`buildTerminalBranding()`、`runStartupSequence()`、`startTeleBibzBanner()`、`paintRainbow()`、`printStatusLine()` |
257
+ | 文本工具 | `splitMessage()`、`splitCaption()`、`escapeMarkdownV2()`、`escapeHtml()`、`md`、`html`、`template()` |
258
+ | 测试(`@xbibzlibrary/telebibz/testing`) | `MockTransport`、`createTestBot()`、`createMockUpdate()`、`createMockCallbackUpdate()`、`createMockContext()` |
259
+ | CLI(`telebibz …`) | `init`、`doctor`、`build`、`test`、`start`、`webhook`、`generate` |
260
+
201
261
  ## API 目标与限制
202
262
 
203
263
  方法列表会在 schema 更新时根据 Telegram Bot API 文档生成。检测到的官方方法都可以运行时访问,而专门的参数/结果推断主要集中在 core method map。完整的 Telegram object、union、enum 和 method declaration 可通过 `TelegramTypes` 使用。有关实现状态请参见 [FEATURE_MATRIX.md](FEATURE_MATRIX.md),完整 API 请参见 `docs/API.zh-CN.md`。
204
264
 
205
265
  ## 发布自动化
206
266
 
207
- GitHub repository 提供 CI 和自动发布 workflow。每次推送到 `main` 都会运行 quality gates,选择尚未使用的 patch version,创建 commit tag,将 package 发布到 npmjs,然后创建 GitHub Release。由于 source repository private,npmjs 发布使用 `--provenance=false`。如果以后创建了 scope `xbibzlibrary` GitHub organization,GitHub Packages 可以作为独立选项启用。依赖自动发布前,请在 GitHub Actions 中配置 `NPM_TOKEN` secret。请参阅 [RELEASE_AUTOMATION.md](RELEASE_AUTOMATION.md) 和 [GitHub Packages 指南](docs/GITHUB_PACKAGES.zh-CN.md)。
267
+ GitHub repository 提供 CI 和自动发布 workflow。每次推送到 `main` 都会运行 quality gates,并从推送的 Conventional Commits 推导下一个版本:`feat:` 提交和破坏性变更在 package 处于 1.0 之前提升 minor(`BREAKING-CHANGE` footer 或 `type!:` 主题自 1.0.0 起提升 major),其余提升 patch。`package.json` 中已声明且高于 npm 的版本会按声明原样发布,workflow 绝不会发布低于或等于 npm 最新版的版本。workflow 会创建版本 commit tag,发布到 npm(通过 `--provenance=false` 禁用 provenance),并创建 GitHub Release。包含 `[skip release]` 的提交不会触发发布。依赖自动发布前,请在 GitHub Actions 中配置 `NPM_TOKEN` secret。请参阅 [RELEASE_AUTOMATION.md](RELEASE_AUTOMATION.md) 和 [GitHub Packages 指南](docs/GITHUB_PACKAGES.zh-CN.md)。
208
268
 
209
269
  ## 项目 policy 和贡献
210
270
 
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAExF,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACtF,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,gBAAgB,CAAC;AAElE,MAAM,WAAW,cAAc;IAAG,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE;AACnK,MAAM,WAAW,gBAAgB;IAAG,SAAS,EAAE,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CA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AAkB,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC7F,OAAO,CAAC,CAAC,SAAS,kBAAkB,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAiCvJ,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;CAQrG"}
@@ -1,4 +1,5 @@
1
1
  import { TELEGRAM_METHOD_NAMES } from "../../generated/api.js";
2
+ import { claimWebhookReply } from "../core/webhook-reply.js";
2
3
  import { TelegramError, telegramErrorFromResponse } from "./errors.js";
3
4
  export class ApiClient {
4
5
  methods;
@@ -22,6 +23,17 @@ export class ApiClient {
22
23
  }
23
24
  async call(method, ...args) { return this.request(method, args[0]); }
24
25
  async request(method, payload, signal, options) {
26
+ // Webhook reply mode: the first call while handling a webhook update is
27
+ // answered through the webhook HTTP response instead of the transport.
28
+ const webhookReply = claimWebhookReply(method, payload);
29
+ if (webhookReply) {
30
+ const context = { method, payload, startedAt: Date.now() };
31
+ await this.hooks.onRequest?.(context);
32
+ context.durationMs = Date.now() - context.startedAt;
33
+ context.response = webhookReply.data;
34
+ await this.hooks.onResponse?.(context);
35
+ return webhookReply.data.result;
36
+ }
25
37
  const context = { method, payload, startedAt: Date.now() };
26
38
  await this.hooks.onRequest?.(context);
27
39
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/api/client.ts"],"names":[],"mappings":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AAG,OAAO,CAAC,SAAS,CAAC;YACpD,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;YACtB,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC;YACpC,IAAI,KAAK,YAAY,aAAa;gBAAE,MAAM,KAAK,CAAC;YAChD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,MAAc,EAAE,OAAiC,EAAE,MAAoB;QAC/E,MAAM,OAAO,GAAqB,EAAE,MAAM,EAAE,CAAC;QAC7C,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;QACrD,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;QAClD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAAE,MAAM,yBAAyB,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QACpH,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;IAC9B,CAAC;CACF"}
@@ -1,5 +1,5 @@
1
1
  import type { ApiClient } from "../api/client.js";
2
- import type { Chat, ChatId, InputFile, Message, ReplyMarkup, Update, User } from "../api/types.js";
2
+ import type { Chat, ChatId, ChatMember, InputFile, Message, ReplyMarkup, Update, User } from "../api/types.js";
3
3
  export interface ContextOptions<S extends object = Record<string, unknown>> {
4
4
  update: Update;
5
5
  api: ApiClient;
@@ -64,6 +64,51 @@ export declare class Context<S extends object = Record<string, unknown>> {
64
64
  getChat(): Promise<Chat>;
65
65
  getUserProfilePhotos(userId?: number | undefined, extra?: Record<string, unknown>): Promise<unknown>;
66
66
  getFile(fileId: string): Promise<unknown>;
67
+ private requireChatId;
68
+ banChatMember(userId: number, untilDate?: number, extra?: Record<string, unknown>): Promise<true>;
69
+ unbanChatMember(userId: number, onlyIfBanned?: boolean, extra?: Record<string, unknown>): Promise<true>;
70
+ restrictChatMember(userId: number, permissions: Record<string, unknown>, untilDate?: number, extra?: Record<string, unknown>): Promise<true>;
71
+ promoteChatMember(userId: number, extra?: Record<string, unknown>): Promise<true>;
72
+ banChatSenderChat(senderChatId: ChatId, extra?: Record<string, unknown>): Promise<true>;
73
+ unbanChatSenderChat(senderChatId: ChatId, extra?: Record<string, unknown>): Promise<true>;
74
+ setChatTitle(title: string): Promise<true>;
75
+ setChatDescription(description?: string): Promise<true>;
76
+ setChatPhoto(photo: InputFile): Promise<true>;
77
+ deleteChatPhoto(): Promise<true>;
78
+ setChatPermissions(permissions: Record<string, unknown>, extra?: Record<string, unknown>): Promise<true>;
79
+ leaveChat(): Promise<true>;
80
+ unpinAllChatMessages(extra?: Record<string, unknown>): Promise<true>;
81
+ setChatStickerSet(stickerSetName: string): Promise<true>;
82
+ deleteChatStickerSet(): Promise<true>;
83
+ getChatAdministrators(): Promise<ChatMember[]>;
84
+ getChatMemberCount(): Promise<number>;
85
+ getChatMember(userId: number): Promise<ChatMember>;
86
+ exportChatInviteLink(): Promise<string>;
87
+ createChatInviteLink(extra?: Record<string, unknown>): Promise<unknown>;
88
+ editChatInviteLink(inviteLink: string, extra?: Record<string, unknown>): Promise<unknown>;
89
+ revokeChatInviteLink(inviteLink: string): Promise<unknown>;
90
+ approveChatJoinRequest(userId: number): Promise<true>;
91
+ declineChatJoinRequest(userId: number): Promise<true>;
92
+ replyWithQuiz(question: string, options: string[], extra?: Record<string, unknown>): Promise<Message>;
93
+ stopPoll(messageId?: number | undefined, extra?: Record<string, unknown>): Promise<unknown>;
94
+ editMessageLiveLocation(latitude?: number, longitude?: number, extra?: Record<string, unknown>): Promise<Message | true>;
95
+ stopMessageLiveLocation(extra?: Record<string, unknown>): Promise<Message | true>;
96
+ replyWithGame(gameShortName: string, extra?: Record<string, unknown>): Promise<Message>;
97
+ setGameScore(userId: number, score: number, extra?: Record<string, unknown>): Promise<Message | true>;
98
+ getGameHighScores(userId?: number | undefined, extra?: Record<string, unknown>): Promise<unknown[]>;
99
+ replyWithInvoice(title: string, description: string, payload: string, providerToken: string, currency: string, prices: Array<Record<string, unknown>>, extra?: Record<string, unknown>): Promise<Message>;
100
+ createForumTopic(name: string, extra?: Record<string, unknown>): Promise<unknown>;
101
+ editForumTopic(extra?: Record<string, unknown>): Promise<true>;
102
+ closeForumTopic(messageThreadId?: number | undefined): Promise<true>;
103
+ reopenForumTopic(messageThreadId?: number | undefined): Promise<true>;
104
+ deleteForumTopic(messageThreadId?: number | undefined): Promise<true>;
105
+ unpinAllForumTopicMessages(messageThreadId?: number | undefined): Promise<true>;
106
+ getForumTopicIconStickers(): Promise<unknown[]>;
107
+ editGeneralForumTopic(name: string): Promise<true>;
108
+ closeGeneralForumTopic(): Promise<true>;
109
+ reopenGeneralForumTopic(): Promise<true>;
110
+ hideGeneralForumTopic(): Promise<true>;
111
+ unhideGeneralForumTopic(): Promise<true>;
67
112
  withReplyMarkup(markup: ReplyMarkup): this;
68
113
  }
69
114
  //# sourceMappingURL=context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/context/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEnG,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,SAAS,CAAC;IACf,OAAO,EAAE,CAAC,CAAC;IACX,QAAQ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