@xbibzlibrary/telebibz 0.4.5 → 3.0.1

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 (276) hide show
  1. package/CHANGELOG.md +35 -138
  2. package/LICENSE +1 -1
  3. package/NOTICE.md +9 -4
  4. package/README.md +173 -256
  5. package/examples/01-quickstart.js +13 -0
  6. package/examples/02-menu-tombol.js +22 -0
  7. package/examples/03-wizard.js +29 -0
  8. package/examples/04-broadcast.js +25 -0
  9. package/examples/05-kirim-file.js +19 -0
  10. package/examples/06-menu.js +35 -0
  11. package/examples/07-inline-query.js +18 -0
  12. package/index.d.ts +81 -0
  13. package/index.js +42 -0
  14. package/lib/api.js +154 -0
  15. package/lib/broadcast.js +35 -0
  16. package/lib/composer.js +174 -0
  17. package/lib/context.js +190 -0
  18. package/lib/errors.js +35 -0
  19. package/lib/file.js +41 -0
  20. package/lib/inline-query.js +28 -0
  21. package/lib/keyboard.js +83 -0
  22. package/lib/logger.js +38 -0
  23. package/lib/menus.js +90 -0
  24. package/lib/net.js +115 -0
  25. package/lib/ratelimit.js +61 -0
  26. package/lib/runner.js +45 -0
  27. package/lib/session.js +36 -0
  28. package/lib/telebibz.js +190 -0
  29. package/lib/wizard.js +81 -0
  30. package/package.json +35 -97
  31. package/test/all.test.js +334 -0
  32. package/CODE_OF_CONDUCT.md +0 -37
  33. package/CONTRIBUTING.md +0 -59
  34. package/CONTRIBUTION_RULES.md +0 -41
  35. package/GOVERNANCE.md +0 -47
  36. package/README.id.md +0 -306
  37. package/README.zh-CN.md +0 -306
  38. package/RELEASE_AUTOMATION.md +0 -78
  39. package/RELEASE_POLICY.md +0 -32
  40. package/SECURITY.md +0 -47
  41. package/SHOWCASE.md +0 -29
  42. package/SUPPORT.md +0 -30
  43. package/assets/readme-preview.html +0 -75
  44. package/assets/telebibz-logo.png +0 -0
  45. package/assets/telebibz-readme-preview.png +0 -0
  46. package/bin/telebibz.mjs +0 -3
  47. package/dist/generated/api.d.ts +0 -13
  48. package/dist/generated/api.d.ts.map +0 -1
  49. package/dist/generated/api.js +0 -192
  50. package/dist/generated/api.js.map +0 -1
  51. package/dist/src/api/client.d.ts +0 -62
  52. package/dist/src/api/client.d.ts.map +0 -1
  53. package/dist/src/api/client.js +0 -104
  54. package/dist/src/api/client.js.map +0 -1
  55. package/dist/src/api/errors.d.ts +0 -45
  56. package/dist/src/api/errors.d.ts.map +0 -1
  57. package/dist/src/api/errors.js +0 -65
  58. package/dist/src/api/errors.js.map +0 -1
  59. package/dist/src/api/index.d.ts +0 -6
  60. package/dist/src/api/index.d.ts.map +0 -1
  61. package/dist/src/api/index.js +0 -6
  62. package/dist/src/api/index.js.map +0 -1
  63. package/dist/src/api/telegram-types/LICENSE +0 -21
  64. package/dist/src/api/telegram-types/api.d.ts +0 -22
  65. package/dist/src/api/telegram-types/checklist.d.ts +0 -72
  66. package/dist/src/api/telegram-types/inline.d.ts +0 -692
  67. package/dist/src/api/telegram-types/langs.d.ts +0 -193
  68. package/dist/src/api/telegram-types/manage.d.ts +0 -1144
  69. package/dist/src/api/telegram-types/markup.d.ts +0 -268
  70. package/dist/src/api/telegram-types/message.d.ts +0 -1537
  71. package/dist/src/api/telegram-types/methods.d.ts +0 -2870
  72. package/dist/src/api/telegram-types/mod.d.ts +0 -14
  73. package/dist/src/api/telegram-types/passport.d.ts +0 -163
  74. package/dist/src/api/telegram-types/payment.d.ts +0 -570
  75. package/dist/src/api/telegram-types/rich.d.ts +0 -1010
  76. package/dist/src/api/telegram-types/settings.d.ts +0 -120
  77. package/dist/src/api/telegram-types/story.d.ts +0 -89
  78. package/dist/src/api/telegram-types/update.d.ts +0 -84
  79. package/dist/src/api/telegram.d.ts +0 -7
  80. package/dist/src/api/telegram.d.ts.map +0 -1
  81. package/dist/src/api/telegram.js +0 -2
  82. package/dist/src/api/telegram.js.map +0 -1
  83. package/dist/src/api/transport.d.ts +0 -68
  84. package/dist/src/api/transport.d.ts.map +0 -1
  85. package/dist/src/api/transport.js +0 -264
  86. package/dist/src/api/transport.js.map +0 -1
  87. package/dist/src/api/types.d.ts +0 -466
  88. package/dist/src/api/types.d.ts.map +0 -1
  89. package/dist/src/api/types.js +0 -2
  90. package/dist/src/api/types.js.map +0 -1
  91. package/dist/src/branding/terminal.d.ts +0 -77
  92. package/dist/src/branding/terminal.d.ts.map +0 -1
  93. package/dist/src/branding/terminal.js +0 -328
  94. package/dist/src/branding/terminal.js.map +0 -1
  95. package/dist/src/broadcast/broadcast.d.ts +0 -50
  96. package/dist/src/broadcast/broadcast.d.ts.map +0 -1
  97. package/dist/src/broadcast/broadcast.js +0 -56
  98. package/dist/src/broadcast/broadcast.js.map +0 -1
  99. package/dist/src/cache/cache.d.ts +0 -34
  100. package/dist/src/cache/cache.d.ts.map +0 -1
  101. package/dist/src/cache/cache.js +0 -41
  102. package/dist/src/cache/cache.js.map +0 -1
  103. package/dist/src/cli.d.ts +0 -2
  104. package/dist/src/cli.d.ts.map +0 -1
  105. package/dist/src/cli.js +0 -84
  106. package/dist/src/cli.js.map +0 -1
  107. package/dist/src/context/context.d.ts +0 -124
  108. package/dist/src/context/context.d.ts.map +0 -1
  109. package/dist/src/context/context.js +0 -302
  110. package/dist/src/context/context.js.map +0 -1
  111. package/dist/src/core/bot.d.ts +0 -204
  112. package/dist/src/core/bot.d.ts.map +0 -1
  113. package/dist/src/core/bot.js +0 -506
  114. package/dist/src/core/bot.js.map +0 -1
  115. package/dist/src/core/events.d.ts +0 -75
  116. package/dist/src/core/events.d.ts.map +0 -1
  117. package/dist/src/core/events.js +0 -35
  118. package/dist/src/core/events.js.map +0 -1
  119. package/dist/src/core/webhook-reply.d.ts +0 -34
  120. package/dist/src/core/webhook-reply.d.ts.map +0 -1
  121. package/dist/src/core/webhook-reply.js +0 -37
  122. package/dist/src/core/webhook-reply.js.map +0 -1
  123. package/dist/src/index.d.ts +0 -24
  124. package/dist/src/index.d.ts.map +0 -1
  125. package/dist/src/index.js +0 -24
  126. package/dist/src/index.js.map +0 -1
  127. package/dist/src/keyboard/index.d.ts +0 -46
  128. package/dist/src/keyboard/index.d.ts.map +0 -1
  129. package/dist/src/keyboard/index.js +0 -55
  130. package/dist/src/keyboard/index.js.map +0 -1
  131. package/dist/src/middleware/compose.d.ts +0 -5
  132. package/dist/src/middleware/compose.d.ts.map +0 -1
  133. package/dist/src/middleware/compose.js +0 -17
  134. package/dist/src/middleware/compose.js.map +0 -1
  135. package/dist/src/observability/logger.d.ts +0 -78
  136. package/dist/src/observability/logger.d.ts.map +0 -1
  137. package/dist/src/observability/logger.js +0 -285
  138. package/dist/src/observability/logger.js.map +0 -1
  139. package/dist/src/plugins/plugin.d.ts +0 -38
  140. package/dist/src/plugins/plugin.d.ts.map +0 -1
  141. package/dist/src/plugins/plugin.js +0 -59
  142. package/dist/src/plugins/plugin.js.map +0 -1
  143. package/dist/src/queue/queue.d.ts +0 -77
  144. package/dist/src/queue/queue.d.ts.map +0 -1
  145. package/dist/src/queue/queue.js +0 -213
  146. package/dist/src/queue/queue.js.map +0 -1
  147. package/dist/src/router/router.d.ts +0 -61
  148. package/dist/src/router/router.d.ts.map +0 -1
  149. package/dist/src/router/router.js +0 -183
  150. package/dist/src/router/router.js.map +0 -1
  151. package/dist/src/state/conversation.d.ts +0 -56
  152. package/dist/src/state/conversation.d.ts.map +0 -1
  153. package/dist/src/state/conversation.js +0 -133
  154. package/dist/src/state/conversation.js.map +0 -1
  155. package/dist/src/state/forms.d.ts +0 -34
  156. package/dist/src/state/forms.d.ts.map +0 -1
  157. package/dist/src/state/forms.js +0 -44
  158. package/dist/src/state/forms.js.map +0 -1
  159. package/dist/src/state/menu.d.ts +0 -78
  160. package/dist/src/state/menu.d.ts.map +0 -1
  161. package/dist/src/state/menu.js +0 -127
  162. package/dist/src/state/menu.js.map +0 -1
  163. package/dist/src/storage/storage.d.ts +0 -146
  164. package/dist/src/storage/storage.d.ts.map +0 -1
  165. package/dist/src/storage/storage.js +0 -195
  166. package/dist/src/storage/storage.js.map +0 -1
  167. package/dist/src/telegram-features.d.ts +0 -33
  168. package/dist/src/telegram-features.d.ts.map +0 -1
  169. package/dist/src/telegram-features.js +0 -71
  170. package/dist/src/telegram-features.js.map +0 -1
  171. package/dist/src/testing.d.ts +0 -24
  172. package/dist/src/testing.d.ts.map +0 -1
  173. package/dist/src/testing.js +0 -38
  174. package/dist/src/testing.js.map +0 -1
  175. package/dist/src/utils/concurrency.d.ts +0 -25
  176. package/dist/src/utils/concurrency.d.ts.map +0 -1
  177. package/dist/src/utils/concurrency.js +0 -52
  178. package/dist/src/utils/concurrency.js.map +0 -1
  179. package/dist/src/utils/files.d.ts +0 -45
  180. package/dist/src/utils/files.d.ts.map +0 -1
  181. package/dist/src/utils/files.js +0 -53
  182. package/dist/src/utils/files.js.map +0 -1
  183. package/dist/src/utils/text.d.ts +0 -39
  184. package/dist/src/utils/text.d.ts.map +0 -1
  185. package/dist/src/utils/text.js +0 -56
  186. package/dist/src/utils/text.js.map +0 -1
  187. package/dist/src/webhook/handler.d.ts +0 -19
  188. package/dist/src/webhook/handler.d.ts.map +0 -1
  189. package/dist/src/webhook/handler.js +0 -141
  190. package/dist/src/webhook/handler.js.map +0 -1
  191. package/dist-cjs/generated/api.js +0 -194
  192. package/dist-cjs/package.json +0 -3
  193. package/dist-cjs/src/api/client.js +0 -107
  194. package/dist-cjs/src/api/errors.js +0 -74
  195. package/dist-cjs/src/api/index.js +0 -21
  196. package/dist-cjs/src/api/telegram-types/LICENSE +0 -21
  197. package/dist-cjs/src/api/telegram-types/api.d.ts +0 -22
  198. package/dist-cjs/src/api/telegram-types/checklist.d.ts +0 -72
  199. package/dist-cjs/src/api/telegram-types/inline.d.ts +0 -692
  200. package/dist-cjs/src/api/telegram-types/langs.d.ts +0 -193
  201. package/dist-cjs/src/api/telegram-types/manage.d.ts +0 -1144
  202. package/dist-cjs/src/api/telegram-types/markup.d.ts +0 -268
  203. package/dist-cjs/src/api/telegram-types/message.d.ts +0 -1537
  204. package/dist-cjs/src/api/telegram-types/methods.d.ts +0 -2870
  205. package/dist-cjs/src/api/telegram-types/mod.d.ts +0 -14
  206. package/dist-cjs/src/api/telegram-types/passport.d.ts +0 -163
  207. package/dist-cjs/src/api/telegram-types/payment.d.ts +0 -570
  208. package/dist-cjs/src/api/telegram-types/rich.d.ts +0 -1010
  209. package/dist-cjs/src/api/telegram-types/settings.d.ts +0 -120
  210. package/dist-cjs/src/api/telegram-types/story.d.ts +0 -89
  211. package/dist-cjs/src/api/telegram-types/update.d.ts +0 -84
  212. package/dist-cjs/src/api/telegram.js +0 -2
  213. package/dist-cjs/src/api/transport.js +0 -267
  214. package/dist-cjs/src/api/types.js +0 -2
  215. package/dist-cjs/src/branding/terminal.js +0 -338
  216. package/dist-cjs/src/broadcast/broadcast.js +0 -58
  217. package/dist-cjs/src/cache/cache.js +0 -45
  218. package/dist-cjs/src/cli.js +0 -86
  219. package/dist-cjs/src/context/context.js +0 -305
  220. package/dist-cjs/src/core/bot.js +0 -510
  221. package/dist-cjs/src/core/events.js +0 -38
  222. package/dist-cjs/src/core/webhook-reply.js +0 -42
  223. package/dist-cjs/src/index.js +0 -47
  224. package/dist-cjs/src/keyboard/index.js +0 -61
  225. package/dist-cjs/src/middleware/compose.js +0 -20
  226. package/dist-cjs/src/observability/logger.js +0 -293
  227. package/dist-cjs/src/plugins/plugin.js +0 -63
  228. package/dist-cjs/src/queue/queue.js +0 -219
  229. package/dist-cjs/src/router/router.js +0 -186
  230. package/dist-cjs/src/state/conversation.js +0 -139
  231. package/dist-cjs/src/state/forms.js +0 -47
  232. package/dist-cjs/src/state/menu.js +0 -133
  233. package/dist-cjs/src/storage/storage.js +0 -202
  234. package/dist-cjs/src/telegram-features.js +0 -76
  235. package/dist-cjs/src/testing.js +0 -45
  236. package/dist-cjs/src/utils/concurrency.js +0 -57
  237. package/dist-cjs/src/utils/files.js +0 -58
  238. package/dist-cjs/src/utils/text.js +0 -63
  239. package/dist-cjs/src/webhook/handler.js +0 -144
  240. package/docs/API.id.md +0 -1935
  241. package/docs/API.md +0 -1969
  242. package/docs/API.zh-CN.md +0 -1929
  243. package/docs/COOKBOOK.id.md +0 -321
  244. package/docs/COOKBOOK.md +0 -321
  245. package/docs/COOKBOOK.zh-CN.md +0 -321
  246. package/docs/ERRORS.id.md +0 -194
  247. package/docs/ERRORS.md +0 -194
  248. package/docs/ERRORS.zh-CN.md +0 -194
  249. package/docs/FILES.id.md +0 -243
  250. package/docs/FILES.md +0 -243
  251. package/docs/FILES.zh-CN.md +0 -243
  252. package/docs/GETTING_STARTED.id.md +0 -89
  253. package/docs/GETTING_STARTED.md +0 -89
  254. package/docs/GETTING_STARTED.zh-CN.md +0 -89
  255. package/docs/GITHUB_PACKAGES.id.md +0 -82
  256. package/docs/GITHUB_PACKAGES.md +0 -82
  257. package/docs/GITHUB_PACKAGES.zh-CN.md +0 -82
  258. package/docs/MIGRATION_TELEGRAF.id.md +0 -147
  259. package/docs/MIGRATION_TELEGRAF.md +0 -154
  260. package/docs/MIGRATION_TELEGRAF.zh-CN.md +0 -147
  261. package/docs/README.md +0 -67
  262. package/docs/STORAGE.id.md +0 -105
  263. package/docs/STORAGE.md +0 -105
  264. package/docs/STORAGE.zh-CN.md +0 -105
  265. package/docs/TESTING.id.md +0 -203
  266. package/docs/TESTING.md +0 -203
  267. package/docs/TESTING.zh-CN.md +0 -203
  268. package/docs/WEBHOOK.id.md +0 -212
  269. package/docs/WEBHOOK.md +0 -215
  270. package/docs/WEBHOOK.zh-CN.md +0 -212
  271. package/examples/README.md +0 -37
  272. package/examples/files.ts +0 -35
  273. package/examples/minimal.ts +0 -12
  274. package/examples/tsconfig.json +0 -9
  275. package/examples/webhook.ts +0 -42
  276. package/examples/wizard-registration.ts +0 -42
package/CHANGELOG.md CHANGED
@@ -1,140 +1,37 @@
1
1
  # Changelog
2
2
 
3
- ## 0.4.4 — 2026-08-29
4
-
5
- ### Added
6
-
7
- - `bot.downloadFile(fileId, { signal?, destination? })` and `ctx.downloadFile(fileId)`: resolve `getFile` and download the raw bytes in one call — the result carries the bytes, the direct download URL, the filename, the size, and `savedTo` when persisted to disk. `ctx.getFile()` is now typed as the Telegram `File` object (previously `unknown`, which forced manual casting to reach `file_path`).
8
- - Upload validation utilities: `validateUpload()`, `assertValidUpload()`, and `UploadValidationError` — size limits, MIME allowlists (with wildcards), and extension rules, all before a byte leaves the process.
9
- - Optional `Transport#fileUrl()` and `Transport#download()` members, implemented by `FetchTransport` (`/bot<token>` maps to `/file/bot<token>`, so local Bot API servers work too).
10
- - `MockTransport` mock downloads (`downloads` log and `downloadBytes` fixture) so download flows are testable without network access.
11
- - `docs/STORAGE.md` quick-start recipes in three languages: copy-paste wiring for Memory, JSON file, Redis, SQL, and Mongo storage.
12
- - New example `examples/files.ts` (validated upload + download round trip).
13
-
14
- ### Fixed
15
-
16
- - **Multipart path uploads never worked**: a `{ source: "/path/file" }` payload was sent as plain JSON containing the raw path string — `containsUpload` did not recognize path-like string sources, so the request never switched to multipart and the file was never read. Now fixed and locked with unit tests.
17
- - Web `ReadableStream` and Node.js stream sources are now actually uploaded as multipart parts; they were JSON-stringified before despite being part of the `InputFile` type.
18
- - `{ source: Uint8Array | ArrayBuffer | Blob, filename }` now applies the explicit filename to the multipart part.
19
- - `FEATURE_MATRIX.md` refreshed to current reality (multipart, file download, upload validation, plugin system, CLI, message splitting, conversations, Mini App integration, and payments are `IMPLEMENTED` with tests) plus a Design decisions section documenting the deliberate boundaries (zero runtime dependencies, no web-frontend UI kit, no per-IP limiting, fetch has no upload-progress hook).
20
-
21
- ### Changed
22
-
23
- - 34 new tests (multipart encoding, file download, upload validation, end-to-end wizard flows) — 186 total.
24
-
25
- ## 0.4.2 2026-08-29
26
-
27
- ### Added
28
-
29
- - `bot.action(pattern, handler)` as a drop-in Telegraf alias for `bot.callback(...)`, so handlers written for Telegraf register unchanged.
30
- - 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.
31
- - 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.
32
-
33
- ### Fixed
34
-
35
- - Logger level `silent` printed every message (including errors) because its priority sorted above all message levels; it now emits nothing.
36
- - `printTeleBibzBanner()` and the other branding helpers documented as exported (`runStartupSequence()`, `startTeleBibzBanner()`, `paintRainbow()`, `printStatusLine()`) are now actually exported from the package entry point.
37
- - `handlerTimeout` of `0` (or any non-finite value) now disables the timeout guard, alongside `Infinity`.
38
-
39
- ### Changed
40
-
41
- - 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.
42
-
43
- ## 0.4.1 — 2026-08-29
44
-
45
- ### Added
46
-
47
- - 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`.
48
- - 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`.
49
- - `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.
50
- - `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.
51
-
52
- ## 0.3.2 — 2026-08-29
53
-
54
- ### Changed
55
-
56
- - README logo image URL updated.
57
-
58
- ## 0.3.1 — 2026-08-29
59
-
60
- ### Added
61
-
62
- - Concurrent update processing built for 1000+ message bursts: updates run in parallel across chats while staying ordered within a single chat, so a slow handler never blocks other chats, sessions never lose writes, and a concurrent burst triggers exactly one `getMe` initialization. `bot.handleUpdates(updates)` processes a whole batch at once and the polling loop uses it for every `getUpdates` batch. Cap simultaneous work with `updates: { concurrency }` (default `Infinity`).
63
- - `bot.broadcast(chatIds, send, options)` for sending to 1000+ users at once: every chat is attempted immediately (no proactive cooldown, configurable `concurrency`), 429 answers are retried automatically after exactly the `retry_after` delay Telegram ordered, and the returned `BroadcastReport` lists delivered/failed counts with per-chat failure details plus `onProgress` streaming.
64
- - `FetchTransport` flood gate (`floodGate`, default on): when Telegram answers 429, new requests wait out the `retry_after` window Telegram ordered — the only delay ever introduced, never a proactive cooldown.
65
- - `Limiter` and `mapWithConcurrency` concurrency primitives (promise semaphore and ordered concurrent mapping) exported for applications.
66
-
67
- ### Fixed
68
-
69
- - A burst of concurrent updates no longer races `init()`: initialization is memoized, so 1000 simultaneous updates trigger exactly one `getMe` call instead of one per update.
70
- - Session writes are no longer lost when one chat sends several messages at once: same-chat updates are serialized in arrival order, so each update reads the session state written by the previous one.
71
-
72
- ## 0.2.1 — 2026-08-29
73
-
74
- ### Breaking
75
-
76
- - Node.js 22 is now the minimum supported runtime (`engines.node: ">=22"`); CI tests Node 22 and 24. The TypeScript target moves to ES2023.
77
-
78
- ### Added
79
-
80
- - `bot.on(filter, handler)` update-type filters with payload narrowing: `bot.on("message:photo")`, `bot.on("callback_query:data")`, or an array like `["message:text", "callback_query:data"]`. Invalid filters throw at registration time.
81
- - `bot.hears(trigger, handler)` for exact text or `RegExp` message matching.
82
- - `bot.catch(handler)` error boundary: handler failures are logged, emitted as `update:error`/`bot:error`, and routed to the handler instead of rejecting `handleUpdate()`; webhooks answer `200` and polling continues.
83
- - Extended context senders with automatic quote-reply: `replyWithAnimation`, `replyWithVideoNote`, `replyWithSticker`, `replyWithMediaGroup`, `replyWithLocation`, `replyWithVenue`, `replyWithContact`, `replyWithPoll`, and `replyWithDice`.
84
- - Animated terminal startup experience (on by default, `branding: false` to disable): typing effect for `Installing Dependencies......`, a glass progress bar with a sweeping highlight, and the animated rainbow ASCII banner `Tele Bibz` (figlet `Speed` font) that flows until the bot connects and then freezes with `✓ Connected as @<username>`.
85
- - Human-readable incoming update logs: `[ => ] Message From {id} {nickname} {dd/mm/yyyy} {hh:mm:ss}` plus an indented content line. Regular message/command text is truncated to 50 characters; callback button data is shown in full. Errors print in red with the full stack. Non-interactive stdout falls back to plain output; `logger.format: "json"` emits structured `update.received` entries instead.
86
- - Branding helpers exported for applications: `runStartupSequence()`, `startTeleBibzBanner()`, `printTeleBibzBanner()`, `paintRainbow()`, `printStatusLine()`, plus `Logger.incoming()` and `describeIncomingUpdate()`.
87
- - `TransportRequest.timeoutMs` for per-request timeouts, honored by `FetchTransport` and `ApiClient.request()`.
88
- - Storage-backed conversations, full five-field cron parsing, scheduler error hooks, permission-aware menus, `MenuController`, Web App init-data validation, PaymentsClient, and vendored Telegram declarations.
89
-
90
- ### Fixed
91
-
92
- - Restored a green build: `npm run typecheck`, `lint`, `test:types`, `test:examples`, and `build` failed under TypeScript 5.9 with `exactOptionalPropertyTypes` (`Context.me` assignment, `RoutableContext.me` index-signature constraint, and an invalid `webhookCallback` cast).
93
- - The published `telebibz` CLI binary crashed with `MODULE_NOT_FOUND` because `bin/telebibz.mjs` imported `../dist/cli.js`; the build emits `dist/src/cli.js`. `release:check` now verifies every bin import resolves inside the tarball.
94
- - Long polling no longer races its own transport timeout: `getUpdates` now uses a per-request timeout of the polling timeout plus a 10-second buffer instead of the flat 30s transport default, which aborted healthy connections the moment Telegram responded.
95
- - `bot.stop()` now aborts the in-flight long-poll request (the polling `AbortSignal` is passed through to the transport), so shutdown no longer blocks for up to the full polling timeout.
96
- - `JsonFileStorage` now persists `expiresAt` metadata, so values written with a TTL no longer silently become permanent after a restart.
97
- - `webhookCallback` now actually supports Koa-style contexts (`status`/`body`), reads secret-token headers from fetch `Request` header maps, and parses bodies from web-standard `Request` objects instead of misreading their `ReadableStream` `body` as a pre-parsed update.
98
- - Passing `reply_parameters` in `extra` no longer discards the automatic quote `message_id`; user options now merge with it across all `reply`/`replyWith*` senders.
99
- - Plugins install exactly once; `bot.restart()` no longer double-registers plugin middleware and routes.
100
- - Callback-query contexts resolve `message` and `chat` from `callback_query.message`, so `ctx.reply()`, `ctx.edit()`, and `ctx.delete()` work for button callbacks.
101
- - Router matching is first-match by default; explicit `matchMode: "all"` preserves deliberate fan-out without accidental double replies.
102
- - Polling isolates handler failures per update, continues the remainder of a batch, emits `update:error`, and uses abortable reconnect backoff.
103
-
104
- ### Removed
105
-
106
- - Development report files (`TELEBIBZ_FINAL_REPORT.md`, `TELEBIBZ_E2E_REPORT.md`, `NPM_RELEASE_REPORT.md`) and the feature-matrix row for an approval gate that was never part of the source tree.
107
-
108
- ## 0.1.2 — 2026-08-19
109
-
110
- ### Changed
111
-
112
- - README logo now uses the version-pinned jsDelivr CDN URL.
113
-
114
- ## 0.1.1 — 2026-08-19
115
-
116
- ### Changed
117
-
118
- - Added the telebibz logo asset to the package.
119
- - Rewrote the README around the actual public API and scoped installation path.
120
- - Added concise documentation links for approval, security, and release policy.
121
-
122
- ## 0.1.0 — 2026-08-19
123
-
124
- ### Added
125
-
126
- - Typed low-level Telegram API client with `call`, `raw`, and `request`.
127
- - Official-documentation-driven method-name generation targeting Bot API 10.2.
128
- - Fetch transport with JSON, multipart, timeout, retry, exponential backoff, jitter, and AbortSignal.
129
- - Typed Telegram error hierarchy and response parsing.
130
- - Bot lifecycle, health checks, polling, update handling, sessions, context, and graceful stop.
131
- - Router matchers for command, text, regex, callback, chat, and custom predicates.
132
- - Async middleware composition.
133
- - Inline and reply keyboard builders with native Telegram payload validation.
134
- - Memory storage, TTL cache, token bucket limiter, task queue, scheduler, plugin manager, service container, webhook handler, CLI, text splitting, and formatting utilities.
135
- - Unit, integration, type-level, and credential-gated E2E tests.
136
- - ESM/CommonJS build configuration, package exports, security policy, CI-ready scripts, and feature matrix.
137
-
138
- ### Known limitations
139
-
140
- The generated method list has runtime coverage for official method names, while specialized request/result inference remains concentrated on the core method map; full Telegram declarations are available through `TelegramTypes`. Scene orchestration and a full Mini App UI layer remain application-owned. Redis, SQL, and Mongo adapters require the application to provide the corresponding vendor driver interface. See `FEATURE_MATRIX.md`.
3
+ ## 3.0.0production-grade parity grammY (2026-09-07)
4
+
5
+ - DEPENDENSI NYATA & TERTEST: axios (keep-alive transport), mime-types, https-proxy-agent, debug.
6
+ - Proxy API: metode APA PUN `api.metodeBebas(payload)` → callApi otomatis.
7
+ - Transformer pipeline `api.config.use` + `autoRetry()` (hormati retry_after 429) + `throttler()`.
8
+ - `limiter()` anti-spam per-user; composer lanjut `branch/filter/drop/route/lazy/fork` — semantik = grammY.
9
+ - `Menu` + `MenuContainer` (submenu, back) bawaan.
10
+ - `inlineQuery` matcher + builder hasil (`iq.article/photo/gif/...`).
11
+ - `InputMediaBuilder` + `sendMediaGroup`; `downloadFile()` streaming; `getFile()` pintar (photo terbesar).
12
+ - Filter tambahan: `:text` leading-colon, `chat_type:private/group/supergroup/channel`, payment, dll.
13
+ - Context: business_connection_id otomatis; ~70 shortcut; react(), replyWithInvoice, stopPoll, forum topic.
14
+ - 24/24 test offline.
15
+
16
+
17
+ ## 2.0.0 clone & recode penuh: 0 dependency (2026-09-07)
18
+
19
+ - ENGINE BARU 100% milik sendiri: net/api/composer/context/session/runner ditulis ulang
20
+ dari nol dalam JS modern. Dependency runtime: **0**.
21
+ - Sama-sama mudah: API publik kompatibel penuh dengan v1.0 (tidak ada perubahan pemakaian).
22
+ - Transport multipart `attach://` untuk File/InputFile (foto, video, dokumen, stiker).
23
+ - Webhook handler Node murni (`bot.webhook()`), session storage swappable, runner
24
+ retry 409 + backoff error jaringan (bisa diatur via `conflictDelay`).
25
+ - 14 test tanpa jaringan (injeksi transport) + 8/8 live test valid pada @xbibzrat_bot.
26
+ - NOTICE.md: kredit MIT untuk grammY sebagai acuan arsitektur.
27
+
28
+
29
+ ## 1.0.0 recode grammY (2026-09-07)
30
+
31
+ - RECODE TOTAL: framework TS 152 file wrapper ramping di atas grammY 1.46.
32
+ - API baru: TeleBibz, cmd/hears/action/on/start/use, wizard, broadcast.
33
+ - Keyboard: tombol berwarna (Bot API 9.4) + ikon animated, builder btn/url/kb/copy.
34
+ - Session & error boundary otomatis; laporan error dengan saran Bahasa Indonesia.
35
+ - Polling long-polling TAHAN 409: auto-retry tiap 5 detik tanpa crash (terbukti live di @xbibzrat_bot).
36
+ - 12 test tanpa jaringan + 6 live test API asli; 5 contoh siap jalan; README lengkap Indonesia.
37
+ - Dihapus: build step tsc, API client tulisan tangan, CLI, struktur docs 3 bahasa.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 telebibz contributors
3
+ Copyright (c) 2026 Xbibz Official
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/NOTICE.md CHANGED
@@ -1,7 +1,12 @@
1
- # Third-party notices
1
+ # NOTICE
2
2
 
3
- ## Vendored Telegram declarations
3
+ telebibz v2 adalah recode mandiri (JavaScript, 0 dependency) atas konsep arsitektur
4
+ Bot API framework **grammY** (https://github.com/grammyjs/grammY} — lisensi MIT).
4
5
 
5
- The declaration files under `src/api/telegram-types/` and the corresponding published `dist` paths are derived from [`@grammyjs/types`](https://www.npmjs.com/package/@grammyjs/types), version `4.0.0`, released under the MIT License.
6
+ Setiap berkas sumber di lib/ ditulis ulang: net (transport multipart), api, composer
7
+ (middleware/routing filter), context, session, runner (polling tahan-409), file,
8
+ keyboard, wizard, broadcast, errors, logger.
6
9
 
7
- The original license text is preserved at `src/api/telegram-types/LICENSE`. These files are type-only declarations used to expose Telegram Bot API object, union, enum, and method types. They do not add a runtime dependency to telebibz.
10
+ Terima kasih untuk grammY & komunitasnya atas rancangan API yang elegan.
11
+ Tidak ada kode grammY yang disalin verbatim; pemakaian nama "grammY" bersifat
12
+ atribusi konseptual sesuai semangat lisensi MIT.