@xbibzlibrary/telebibz 3.1.2 → 3.1.3
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.
- package/CHANGELOG.md +7 -0
- package/LICENSE +1 -1
- package/NOTICE.md +15 -8
- package/README.id.md +85 -16
- package/README.md +84 -16
- package/examples/08-rich-message.js +34 -0
- package/index.d.ts +300 -96
- package/index.js +8 -2
- package/lib/api.js +20 -6
- package/lib/composer.js +14 -2
- package/lib/context.js +83 -21
- package/lib/file.js +8 -1
- package/lib/inline-query.js +6 -1
- package/lib/logger.js +44 -14
- package/lib/ratelimit.js +16 -3
- package/lib/rich.js +170 -0
- package/lib/runner.js +14 -5
- package/lib/session.js +12 -4
- package/lib/telebibz.js +40 -24
- package/lib/telegram-methods.js +192 -0
- package/package.json +14 -10
- package/test/audit.test.js +320 -0
- package/test/types.test.ts +40 -0
- package/types/telegram-bot-api/LICENSE +21 -0
- package/types/telegram-bot-api/api.d.ts +22 -0
- package/types/telegram-bot-api/checklist.d.ts +72 -0
- package/types/telegram-bot-api/inline.d.ts +692 -0
- package/types/telegram-bot-api/langs.d.ts +193 -0
- package/types/telegram-bot-api/manage.d.ts +1153 -0
- package/types/telegram-bot-api/markup.d.ts +278 -0
- package/types/telegram-bot-api/message.d.ts +1557 -0
- package/types/telegram-bot-api/methods.d.ts +2860 -0
- package/types/telegram-bot-api/mod.d.ts +14 -0
- package/types/telegram-bot-api/passport.d.ts +163 -0
- package/types/telegram-bot-api/payment.d.ts +576 -0
- package/types/telegram-bot-api/rich.d.ts +1198 -0
- package/types/telegram-bot-api/settings.d.ts +120 -0
- package/types/telegram-bot-api/story.d.ts +89 -0
- package/types/telegram-bot-api/update.d.ts +86 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased — Telegram Bot API 10.3
|
|
4
|
+
|
|
5
|
+
- Vendored schema TypeScript `@grammyjs/types@5.0.0` (MIT), typed payload signatures, and an audited 185-method runtime registry kept in exact sync by tests; no new runtime dependency.
|
|
6
|
+
- Rich-message builders/entities/blocks, live-photo and paid-media builders, guest-query/ephemeral/draft helpers, inline rich-article builder, and the `08-rich-message.js` example.
|
|
7
|
+
- Typed `callApi(method, payload)` and Telegram schema exports; positive/negative TypeScript consumer checks run in CI and before automated npm release.
|
|
8
|
+
- English/Indonesian documentation and npm publishing setup guidance updated; tests now 30 feature + 17 audit checks.
|
|
9
|
+
|
|
3
10
|
## 3.1.0 — wizard: tombol pilihan + mode edit/delete (2026-09-13)
|
|
4
11
|
|
|
5
12
|
- **Wizard mendukung tombol pilihan**: `step.buttons` sebagai reply keyboard
|
package/LICENSE
CHANGED
package/NOTICE.md
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
# NOTICE
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Bot API framework **grammY** (https://github.com/grammyjs/grammY} — lisensi MIT).
|
|
3
|
+
## Arsitektur dan implementasi JavaScript
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
telebibz adalah recode mandiri dengan konsep arsitektur yang terinspirasi oleh
|
|
6
|
+
Bot API framework **grammY** (https://github.com/grammyjs/grammY, lisensi MIT).
|
|
7
|
+
Implementasi JavaScript pada `lib/` ditulis untuk repo ini; referensi tersebut
|
|
8
|
+
adalah atribusi konseptual.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
## Type declarations Bot API
|
|
11
|
+
|
|
12
|
+
Berkas deklarasi TypeScript pada `types/telegram-bot-api/` diambil dari
|
|
13
|
+
[`@grammyjs/types` v5.0.0](https://github.com/grammyjs/types), proyek grammY
|
|
14
|
+
berlisensi MIT. Salinan lisensinya ada di [`types/telegram-bot-api/LICENSE`](types/telegram-bot-api/LICENSE).
|
|
15
|
+
Deklarasi tersebut digunakan sebagai model tipe Bot API 10.3; implementasi
|
|
16
|
+
runtime telebibz tetap menggunakan transport dan proxy milik repo ini.
|
|
17
|
+
|
|
18
|
+
Terima kasih kepada grammY dan komunitas Telegram bot atas dokumentasi dan
|
|
19
|
+
rancangan API yang membantu proyek ini.
|
package/README.id.md
CHANGED
|
@@ -26,7 +26,7 @@ produksi yang *benar-benar dipakai*, dokumentasi 🇮🇩 Indonesia-first, dan n
|
|
|
26
26
|
|
|
27
27
|
<br>
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
`Xbibz Technology ID`
|
|
30
30
|
|
|
31
31
|
</div>
|
|
32
32
|
|
|
@@ -138,13 +138,14 @@ BOT_TOKEN=123:abc node index.js
|
|
|
138
138
|
```
|
|
139
139
|
|
|
140
140
|
```
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
141
|
+
◆ DEVELOPER Xbibz Technology ID
|
|
142
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
143
|
+
┃ 🤖 TeleBibz ON ┃
|
|
144
|
+
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
|
|
145
|
+
┃ bot : @botkamu (id 123456) ┃
|
|
146
|
+
┃ mode : long-polling ┃
|
|
147
|
+
┃ library : telebibz 3.1.2 (Node.js) ┃
|
|
148
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
148
149
|
✔ menunggu update… (Ctrl+C untuk berhenti)
|
|
149
150
|
```
|
|
150
151
|
|
|
@@ -266,6 +267,65 @@ callback, inline…) dengan accessor seragam: `chat`, `from`, `chatId`, `msgId`,
|
|
|
266
267
|
Akun business: balasan dalam konteks business otomatis menyertakan
|
|
267
268
|
`business_connection_id`.
|
|
268
269
|
|
|
270
|
+
<a id="rich-messages"></a>
|
|
271
|
+
### 🧱 Rich Messages, draft, live photo & pesan ephemeral (Bot API 10.3)
|
|
272
|
+
|
|
273
|
+
TeleBibz menyediakan builder rich-message dan Context helper; untuk seluruh
|
|
274
|
+
**185 metode Bot API** tersedia juga `ctx.api.callApi(method, payload)` yang bertipe,
|
|
275
|
+
sementara proxy menerima metode baru lewat object payload.
|
|
276
|
+
|
|
277
|
+
```js
|
|
278
|
+
const { rich, RichMessageBuilder } = require('@xbibzlibrary/telebibz');
|
|
279
|
+
|
|
280
|
+
bot.cmd('laporan', (ctx) => ctx.replyWithRichMessage(rich.blocks([
|
|
281
|
+
rich.heading('Laporan', 2),
|
|
282
|
+
rich.paragraph(['Status: ', rich.bold('berhasil')]),
|
|
283
|
+
rich.table([
|
|
284
|
+
[{ text: 'Item', align: 'left', valign: 'middle', is_header: true },
|
|
285
|
+
{ text: 'Total', align: 'right', valign: 'middle', is_header: true }],
|
|
286
|
+
[{ text: 'Pesanan', align: 'left', valign: 'middle' },
|
|
287
|
+
{ text: '3', align: 'right', valign: 'middle' }],
|
|
288
|
+
], { bordered: true, striped: true, compact: true }),
|
|
289
|
+
rich.details('Catatan', [rich.paragraph('Rincian tambahan')]),
|
|
290
|
+
rich.buttons([rich.button('Buka', { url: 'https://example.com' }, 'primary')]),
|
|
291
|
+
])));
|
|
292
|
+
|
|
293
|
+
// HTML, Markdown, blok berisi media, list, kutipan, peta, tabel, collage,
|
|
294
|
+
// slideshow, button, rich-text entities (bold/customEmoji/dateTime, dll.) juga didukung.
|
|
295
|
+
const content = new RichMessageBuilder().markdown('**Hai!**').rtl().build();
|
|
296
|
+
await ctx.replyWithRichMessage(content);
|
|
297
|
+
|
|
298
|
+
// Live photo: kedua file dapat berupa file_id atau InputFile.
|
|
299
|
+
await ctx.replyWithLivePhoto('video-file-id', 'photo-file-id', { caption: 'Momen' });
|
|
300
|
+
|
|
301
|
+
// Draft adalah preview sementara; kirim Rich Message final agar tersimpan.
|
|
302
|
+
await ctx.sendRichMessageDraft(1, rich.draftBlocks([
|
|
303
|
+
rich.paragraph('Sedang menulis…'), rich.thinking('Memproses'),
|
|
304
|
+
]), { can_stop: true, keep_on_stop: true });
|
|
305
|
+
await ctx.replyWithRichMessage(rich.markdown('**Jawaban final**'));
|
|
306
|
+
|
|
307
|
+
// Ephemeral: pesan hanya terlihat oleh penerima tertentu.
|
|
308
|
+
await ctx.replyEphemeral('Pesan privat sementara', ctx.from.id);
|
|
309
|
+
|
|
310
|
+
// Akses lengkap dan bertipe untuk metode/parameter Bot API (termasuk semua metode 10.3).
|
|
311
|
+
await ctx.api.callApi('sendRichMessage', {
|
|
312
|
+
chat_id: ctx.chatId,
|
|
313
|
+
rich_message: rich.html('<b>Rich HTML</b>'),
|
|
314
|
+
});
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
`RichMessageBuilder` menyediakan `.html()`, `.markdown()`, `.blocks()`, `.add()`,
|
|
318
|
+
`.media()`, `.rtl()`, `.skipEntityDetection()`, `.build()`, dan `.buildDraft()`.
|
|
319
|
+
`rich.draftHtml()`, `rich.draftMarkdown()`, dan `rich.draftBlocks()` menghasilkan
|
|
320
|
+
konten draft-safe serta menolak upload `File` (draft dapat memakai file_id Telegram yang ada).
|
|
321
|
+
Rich block builder mencakup
|
|
322
|
+
paragraph/heading/pre/list/table/details/quote/map/media/buttons/thinking; block
|
|
323
|
+
`thinking` hanya untuk `sendRichMessageDraft`. `InputMediaBuilder.livePhoto()` dan
|
|
324
|
+
`InputPaidMediaBuilder.livePhoto()` membentuk payload media live photo. API raw modern lain tersedia lewat
|
|
325
|
+
`ctx.api.sendMessageDraft()`, `ctx.api.answerGuestQuery()`, `ctx.api.editEphemeralMessage*()`
|
|
326
|
+
dan `ctx.api.deleteEphemeralMessage()`. Tipe resmi Telegram dapat diakses sebagai
|
|
327
|
+
`TelegramTypes`; rich input types diekspor langsung.
|
|
328
|
+
|
|
269
329
|
<a id="keyboard"></a>
|
|
270
330
|
### 🔘 Keyboard & tombol
|
|
271
331
|
|
|
@@ -516,7 +576,7 @@ await bot.api.sendDiceCustom({ chat_id: 1, emoji: '🎲' });
|
|
|
516
576
|
| 📝 Total baris kode | **±1.700** (tanpa build step) |
|
|
517
577
|
| 🔌 Metode Bot API | **90+** — 75 shortcut bertipe + Proxy tanpa batas |
|
|
518
578
|
| ⌨️ Shortcut Context | **50+** (reply/edit/delete/admin/react…) |
|
|
519
|
-
| 🧪 Test offline | **
|
|
579
|
+
| 🧪 Test offline | **47/47 lulus**, termasuk transport HTTP lokal dan fitur Bot API 10.3 |
|
|
520
580
|
| 🧩 Contoh siap jalan | **7** di `examples/` |
|
|
521
581
|
| 📦 Dependency runtime | **4** — semuanya terpakai & ter-test |
|
|
522
582
|
|
|
@@ -575,6 +635,7 @@ inline-query.js██▊ 28 ← matcher + builder hasil
|
|
|
575
635
|
| `05-kirim-file.js` | foto & dokumen dari buffer |
|
|
576
636
|
| `06-menu.js` | menu interaktif + submenu |
|
|
577
637
|
| `07-inline-query.js` | mode inline dengan builder hasil |
|
|
638
|
+
| `08-rich-message.js` | rich messages, live photo, draft, ephemeral, dan raw method API |
|
|
578
639
|
|
|
579
640
|
Jalankan dengan `BOT_TOKEN=123:abc node examples/01-quickstart.js`.
|
|
580
641
|
|
|
@@ -582,13 +643,14 @@ Jalankan dengan `BOT_TOKEN=123:abc node examples/01-quickstart.js`.
|
|
|
582
643
|
## 🔬 Test & Bukti Live
|
|
583
644
|
|
|
584
645
|
```bash
|
|
585
|
-
npm test
|
|
646
|
+
npm test # 47 test offline (mock + HTTP server lokal), tanpa token Telegram
|
|
647
|
+
npm run typecheck # cek declaration TypeScript + payload method-specific
|
|
586
648
|
```
|
|
587
649
|
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
650
|
+
Audit saat ini tidak membutuhkan token Telegram. Versi repo sebelumnya mencatat
|
|
651
|
+
**30 test offline + 10 test live** pada `@xbibzrat_bot`; pengujian live tersebut
|
|
652
|
+
bersifat historis dan tidak diulang pada audit ini. Lihat [`VERIFIKASI-MENDALAM.md`](VERIFIKASI-MENDALAM.md)
|
|
653
|
+
untuk matriks test, perbandingan Bot API 10.3, dan batasan yang tersisa.
|
|
592
654
|
|
|
593
655
|
Log debug: `DEBUG=telebibz:net,telebibz:ratelimit node botkamu.js`.
|
|
594
656
|
|
|
@@ -624,16 +686,23 @@ Log debug: `DEBUG=telebibz:net,telebibz:ratelimit node botkamu.js`.
|
|
|
624
686
|
|
|
625
687
|
> Detail lengkap di [`CHANGELOG.md`](CHANGELOG.md). Studi arsitektur mendalam: [`ANALISIS-telebibz.md`](ANALISIS-telebibz.md).
|
|
626
688
|
|
|
689
|
+
<a id="publishing"></a>
|
|
690
|
+
## 📦 Publikasi npm otomatis
|
|
691
|
+
|
|
692
|
+
Workflow `.github/workflows/auto-publish.yml` menerbitkan saat ada push ke `main` (kecuali commit rilis yang memuat `[skip release]`) atau manual dari branch `main` lewat **Actions → Auto publish to npm → Run workflow** (workflow menolak dispatch dari branch lain). Sebelum mengaktifkannya, buat GitHub Actions Environment bernama `npm-release`, lalu tambahkan secret **`NPM_TOKEN`** yang berizin menerbitkan `@xbibzlibrary/telebibz`. Token tidak disimpan di repo.
|
|
693
|
+
|
|
694
|
+
Workflow memilih patch berikutnya berdasarkan versi yang lebih tinggi antara repo dan versi terbaru npm; lalu menjalankan test runtime, typecheck TypeScript, pemeriksaan sintaks JS, simulasi paket, dan audit dependency produksi. Workflow mem-publish sebagai paket publik, commit bump `package.json`/lockfile, membuat tag anotasi `vX.Y.Z`, dan GitHub Release. Validasi yang gagal menghentikan workflow sebelum publish. Konfigurasi ditinjau secara lokal; verifikasi Actions nyata dan publish memerlukan akses repo dan secret tersebut.
|
|
695
|
+
|
|
627
696
|
<a id="lisensi"></a>
|
|
628
697
|
## 📄 Lisensi
|
|
629
698
|
|
|
630
|
-
**MIT** © Xbibz
|
|
699
|
+
**MIT** © Xbibz Technology ID — arsitektur terinspirasi [grammY](https://grammy.dev) (MIT, lihat [`NOTICE.md`](NOTICE.md)).
|
|
631
700
|
|
|
632
701
|
---
|
|
633
702
|
|
|
634
703
|
<div align="center">
|
|
635
704
|
|
|
636
|
-
**Dibuat dengan ❤️ oleh
|
|
705
|
+
**Dibuat dengan ❤️ oleh Xbibz Technology ID**
|
|
637
706
|
|
|
638
707
|
Kalau telebibz membantumu, bintang ⭐ repo ini sangat berarti.
|
|
639
708
|
|
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ dependencies that are *actually used*, and an Indonesia-first community.
|
|
|
26
26
|
|
|
27
27
|
<br>
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
`Xbibz Technology ID`
|
|
30
30
|
|
|
31
31
|
</div>
|
|
32
32
|
|
|
@@ -137,13 +137,14 @@ BOT_TOKEN=123:abc node index.js
|
|
|
137
137
|
```
|
|
138
138
|
|
|
139
139
|
```
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
140
|
+
◆ DEVELOPER Xbibz Technology ID
|
|
141
|
+
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
142
|
+
┃ 🤖 TeleBibz ON ┃
|
|
143
|
+
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
|
|
144
|
+
┃ bot : @yourbot (id 123456) ┃
|
|
145
|
+
┃ mode : long-polling ┃
|
|
146
|
+
┃ library : telebibz 3.1.2 (Node.js) ┃
|
|
147
|
+
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
147
148
|
✔ waiting for updates… (Ctrl+C to stop)
|
|
148
149
|
```
|
|
149
150
|
|
|
@@ -265,6 +266,64 @@ inline…) with unified accessors: `chat`, `from`, `chatId`, `msgId`, `msg`,
|
|
|
265
266
|
Business accounts: replies inside a business context automatically carry
|
|
266
267
|
`business_connection_id`.
|
|
267
268
|
|
|
269
|
+
<a id="rich-messages"></a>
|
|
270
|
+
### 🧱 Rich Messages, drafts, live photos & ephemeral messages (Bot API 10.3)
|
|
271
|
+
|
|
272
|
+
TeleBibz includes rich-message builders and Context helpers. All **185 Bot API
|
|
273
|
+
methods** are also available through typed `ctx.api.callApi(method, payload)`;
|
|
274
|
+
the proxy accepts newer methods using an object payload.
|
|
275
|
+
|
|
276
|
+
```js
|
|
277
|
+
const { rich, RichMessageBuilder } = require('@xbibzlibrary/telebibz');
|
|
278
|
+
|
|
279
|
+
bot.cmd('report', (ctx) => ctx.replyWithRichMessage(rich.blocks([
|
|
280
|
+
rich.heading('Report', 2),
|
|
281
|
+
rich.paragraph(['Status: ', rich.bold('success')]),
|
|
282
|
+
rich.table([
|
|
283
|
+
[{ text: 'Item', align: 'left', valign: 'middle', is_header: true },
|
|
284
|
+
{ text: 'Total', align: 'right', valign: 'middle', is_header: true }],
|
|
285
|
+
[{ text: 'Orders', align: 'left', valign: 'middle' },
|
|
286
|
+
{ text: '3', align: 'right', valign: 'middle' }],
|
|
287
|
+
], { bordered: true, striped: true, compact: true }),
|
|
288
|
+
rich.details('Notes', [rich.paragraph('Additional details')]),
|
|
289
|
+
rich.buttons([rich.button('Open', { url: 'https://example.com' }, 'primary')]),
|
|
290
|
+
])));
|
|
291
|
+
|
|
292
|
+
// HTML, Markdown, media blocks, lists, quotes, maps, tables, collages,
|
|
293
|
+
// slideshows, buttons and rich-text entities (bold/customEmoji/dateTime, etc.) are supported.
|
|
294
|
+
const content = new RichMessageBuilder().markdown('**Hello!**').rtl().build();
|
|
295
|
+
await ctx.replyWithRichMessage(content);
|
|
296
|
+
|
|
297
|
+
// Live photo: both inputs may be Telegram file_ids or InputFile instances.
|
|
298
|
+
await ctx.replyWithLivePhoto('video-file-id', 'photo-file-id', { caption: 'Moment' });
|
|
299
|
+
|
|
300
|
+
// A draft is a temporary preview. Send the final rich message to persist it.
|
|
301
|
+
await ctx.sendRichMessageDraft(1, rich.draftBlocks([
|
|
302
|
+
rich.paragraph('Writing…'), rich.thinking('Working'),
|
|
303
|
+
]), { can_stop: true, keep_on_stop: true });
|
|
304
|
+
await ctx.replyWithRichMessage(rich.markdown('**Final answer**'));
|
|
305
|
+
|
|
306
|
+
// Ephemeral: visible only to a specific recipient.
|
|
307
|
+
await ctx.replyEphemeral('A temporary private message', ctx.from.id);
|
|
308
|
+
|
|
309
|
+
// Fully typed raw access to every Bot API method and its payload.
|
|
310
|
+
await ctx.api.callApi('sendRichMessage', {
|
|
311
|
+
chat_id: ctx.chatId,
|
|
312
|
+
rich_message: rich.html('<b>Rich HTML</b>'),
|
|
313
|
+
});
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
`RichMessageBuilder` supports `.html()`, `.markdown()`, `.blocks()`, `.add()`,
|
|
317
|
+
`.media()`, `.rtl()`, `.skipEntityDetection()`, `.build()`, and `.buildDraft()`.
|
|
318
|
+
`rich.draftHtml()`, `rich.draftMarkdown()`, and `rich.draftBlocks()` return draft-safe content and reject `File` uploads (drafts may use existing Telegram file IDs). Rich block helpers cover
|
|
319
|
+
paragraphs, headings, code, lists, tables, details, quotations, maps, media,
|
|
320
|
+
buttons, and thinking. `InputMediaBuilder.livePhoto()` and
|
|
321
|
+
`InputPaidMediaBuilder.livePhoto()` construct live-photo media payloads. The
|
|
322
|
+
`thinking` block is only valid in `sendRichMessageDraft`. Other modern methods are available via
|
|
323
|
+
`ctx.api.sendMessageDraft()`, `ctx.api.answerGuestQuery()`,
|
|
324
|
+
`ctx.api.editEphemeralMessage*()`, and `ctx.api.deleteEphemeralMessage()`.
|
|
325
|
+
Telegram types are available under `TelegramTypes`; rich input types are exported directly.
|
|
326
|
+
|
|
268
327
|
<a id="keyboards"></a>
|
|
269
328
|
### 🔘 Keyboards & buttons
|
|
270
329
|
|
|
@@ -515,7 +574,7 @@ await bot.api.sendDiceCustom({ chat_id: 1, emoji: '🎲' });
|
|
|
515
574
|
| 📝 Total lines of code | **~1,700** (no build step) |
|
|
516
575
|
| 🔌 Bot API methods | **90+** — 75 typed shortcuts + unbounded Proxy |
|
|
517
576
|
| ⌨️ Context shortcuts | **50+** (reply/edit/delete/admin/react…) |
|
|
518
|
-
| 🧪 Offline tests | **
|
|
577
|
+
| 🧪 Offline tests | **47/47 passing**, including local HTTP transport and Bot API 10.3 tests |
|
|
519
578
|
| 🧩 Ready examples | **7** in `examples/` |
|
|
520
579
|
| 📦 Runtime dependencies | **4** — all used, all tested |
|
|
521
580
|
|
|
@@ -574,6 +633,7 @@ inline-query.js██▊ 28 ← matcher + result builder
|
|
|
574
633
|
| `05-kirim-file.js` | photos & documents from buffers |
|
|
575
634
|
| `06-menu.js` | interactive menus + submenus |
|
|
576
635
|
| `07-inline-query.js` | inline mode with result builders |
|
|
636
|
+
| `08-rich-message.js` | rich messages, live photo, drafts, ephemeral messages, raw API |
|
|
577
637
|
|
|
578
638
|
Run any of them with `BOT_TOKEN=123:abc node examples/01-quickstart.js`.
|
|
579
639
|
|
|
@@ -581,13 +641,14 @@ Run any of them with `BOT_TOKEN=123:abc node examples/01-quickstart.js`.
|
|
|
581
641
|
## 🔬 Testing & Live Proof
|
|
582
642
|
|
|
583
643
|
```bash
|
|
584
|
-
npm test
|
|
644
|
+
npm test # 47 offline checks, including local HTTP transport + Bot API 10.3 tests
|
|
645
|
+
npm run typecheck # verify declarations and method-specific Bot API payload types
|
|
585
646
|
```
|
|
586
647
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
648
|
+
The current audit needs no Telegram token. An earlier release of this repository
|
|
649
|
+
records **30 offline + 10 live checks** on `@xbibzrat_bot`; that live run is historical
|
|
650
|
+
and was not repeated in the current audit. See [`VERIFIKASI-MENDALAM.md`](VERIFIKASI-MENDALAM.md)
|
|
651
|
+
for the test matrix, Bot API 10.3 comparison, and remaining limitations.
|
|
591
652
|
|
|
592
653
|
Debug logging: `DEBUG=telebibz:net,telebibz:ratelimit node yourbot.js`.
|
|
593
654
|
|
|
@@ -623,16 +684,23 @@ Debug logging: `DEBUG=telebibz:net,telebibz:ratelimit node yourbot.js`.
|
|
|
623
684
|
|
|
624
685
|
> Full details in [`CHANGELOG.md`](CHANGELOG.md). Deep architecture study (🇮): [`ANALISIS-telebibz.md`](ANALISIS-telebibz.md).
|
|
625
686
|
|
|
687
|
+
<a id="publishing"></a>
|
|
688
|
+
## 📦 Automated npm publishing
|
|
689
|
+
|
|
690
|
+
`.github/workflows/auto-publish.yml` publishes on pushes to `main` (except release commits tagged with `[skip release]`) or manually on the `main` branch via **Actions → Auto publish to npm → Run workflow** (the job rejects dispatches from other branches). Before enabling it, configure a GitHub Actions Environment named `npm-release` and add the repository/environment secret **`NPM_TOKEN`** with permission to publish `@xbibzlibrary/telebibz`. No credential is stored in this repository.
|
|
691
|
+
|
|
692
|
+
The workflow derives the next patch version from the greater of the checked-in version and npm's latest version, then runs runtime tests, TypeScript checks, JS syntax checks, package dry-run, and production dependency audit. It publishes publicly, commits the bumped `package.json`/lockfile, creates an annotated `vX.Y.Z` tag, and a GitHub release. A failed validation stops before publish. The CI/release workflows have been reviewed locally; a real GitHub Actions run and npm publish still require repository access and the secret.
|
|
693
|
+
|
|
626
694
|
<a id="license"></a>
|
|
627
695
|
## 📄 License
|
|
628
696
|
|
|
629
|
-
**MIT** © Xbibz
|
|
697
|
+
**MIT** © Xbibz Technology ID — architecture inspired by [grammY](https://grammy.dev) (MIT, see [`NOTICE.md`](NOTICE.md)).
|
|
630
698
|
|
|
631
699
|
---
|
|
632
700
|
|
|
633
701
|
<div align="center">
|
|
634
702
|
|
|
635
|
-
**Made with ❤️ by
|
|
703
|
+
**Made with ❤️ by Xbibz Technology ID**
|
|
636
704
|
|
|
637
705
|
If telebibz helps you, a ⭐ on this repo means a lot.
|
|
638
706
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { TeleBibz, rich } = require('..');
|
|
4
|
+
const bot = new TeleBibz(process.env.BOT_TOKEN);
|
|
5
|
+
|
|
6
|
+
bot.cmd('rich', (ctx) => ctx.replyWithRichMessage(rich.blocks([
|
|
7
|
+
rich.heading('Ringkasan transaksi', 2),
|
|
8
|
+
rich.paragraph(['Status: ', rich.bold('berhasil'), ' · ', rich.customEmoji('5368324170671202286', '✅')]),
|
|
9
|
+
rich.table([
|
|
10
|
+
[{ text: 'Item', is_header: true, align: 'left', valign: 'middle' }, { text: 'Jumlah', is_header: true, align: 'right', valign: 'middle' }],
|
|
11
|
+
[{ text: 'Pesanan #42', align: 'left', valign: 'middle' }, { text: 'Rp 125.000', align: 'right', valign: 'middle' }],
|
|
12
|
+
], { bordered: true, striped: true, compact: true }),
|
|
13
|
+
rich.details('Rincian', [rich.paragraph('Diproses otomatis oleh bot.')]),
|
|
14
|
+
rich.buttons([
|
|
15
|
+
rich.button('Buka web', { url: 'https://example.com' }, 'primary'),
|
|
16
|
+
rich.button('Konfirmasi', { callback_data: 'confirm:42' }, 'success'),
|
|
17
|
+
], 'center'),
|
|
18
|
+
])));
|
|
19
|
+
|
|
20
|
+
bot.action(/^confirm:\d+$/, (ctx) => ctx.answerCallbackQuery('Terkonfirmasi'));
|
|
21
|
+
|
|
22
|
+
bot.cmd('draft', async (ctx) => {
|
|
23
|
+
const draftId = 1;
|
|
24
|
+
await ctx.sendRichMessageDraft(draftId, rich.draftBlocks([
|
|
25
|
+
rich.paragraph('Sedang menyusun jawaban…'),
|
|
26
|
+
rich.thinking('Menganalisis permintaan'),
|
|
27
|
+
]), { can_stop: true, keep_on_stop: true });
|
|
28
|
+
// Draft Bot API hanya preview sementara. Kirim pesan final agar tersimpan.
|
|
29
|
+
await ctx.replyWithRichMessage(rich.markdown('**Jawaban final**\nSelesai diproses.'));
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
bot.cmd('privat', (ctx) => ctx.replyEphemeral('Pesan ini hanya terlihat oleh Anda.', ctx.from.id));
|
|
33
|
+
|
|
34
|
+
bot.launch();
|