@xbibzlibrary/telebibz 0.1.2 → 0.1.4
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 +17 -1
- package/CODE_OF_CONDUCT.md +37 -0
- package/CONTRIBUTING.md +54 -0
- package/CONTRIBUTION_RULES.md +41 -0
- package/GOVERNANCE.md +47 -0
- package/NOTICE.md +7 -0
- package/README.id.md +172 -0
- package/README.md +65 -33
- package/README.zh-CN.md +172 -0
- package/RELEASE_AUTOMATION.md +66 -0
- package/RELEASE_POLICY.md +2 -2
- package/SECURITY.md +36 -4
- package/SUPPORT.md +30 -0
- package/assets/readme-preview.html +75 -0
- package/assets/telebibz-readme-preview.png +0 -0
- package/dist/src/api/index.d.ts +1 -0
- package/dist/src/api/index.d.ts.map +1 -1
- package/dist/src/api/index.js +1 -0
- package/dist/src/api/index.js.map +1 -1
- package/dist/src/api/telegram-types/LICENSE +21 -0
- package/dist/src/api/telegram-types/api.d.ts +22 -0
- package/dist/src/api/telegram-types/checklist.d.ts +72 -0
- package/dist/src/api/telegram-types/inline.d.ts +692 -0
- package/dist/src/api/telegram-types/langs.d.ts +193 -0
- package/dist/src/api/telegram-types/manage.d.ts +1144 -0
- package/dist/src/api/telegram-types/markup.d.ts +268 -0
- package/dist/src/api/telegram-types/message.d.ts +1537 -0
- package/dist/src/api/telegram-types/methods.d.ts +2870 -0
- package/dist/src/api/telegram-types/mod.d.ts +14 -0
- package/dist/src/api/telegram-types/passport.d.ts +163 -0
- package/dist/src/api/telegram-types/payment.d.ts +570 -0
- package/dist/src/api/telegram-types/rich.d.ts +1010 -0
- package/dist/src/api/telegram-types/settings.d.ts +120 -0
- package/dist/src/api/telegram-types/story.d.ts +89 -0
- package/dist/src/api/telegram-types/update.d.ts +84 -0
- package/dist/src/api/telegram.d.ts +7 -0
- package/dist/src/api/telegram.d.ts.map +1 -0
- package/dist/src/api/telegram.js +2 -0
- package/dist/src/api/telegram.js.map +1 -0
- package/dist/src/approval/approval.d.ts +8 -0
- package/dist/src/approval/approval.d.ts.map +1 -1
- package/dist/src/approval/approval.js +9 -0
- package/dist/src/approval/approval.js.map +1 -1
- package/dist/src/cache/cache.d.ts +6 -5
- package/dist/src/cache/cache.d.ts.map +1 -1
- package/dist/src/cache/cache.js +7 -3
- package/dist/src/cache/cache.js.map +1 -1
- package/dist/src/context/context.d.ts.map +1 -1
- package/dist/src/context/context.js +26 -3
- package/dist/src/context/context.js.map +1 -1
- package/dist/src/core/bot.d.ts +6 -4
- package/dist/src/core/bot.d.ts.map +1 -1
- package/dist/src/core/bot.js +48 -7
- package/dist/src/core/bot.js.map +1 -1
- package/dist/src/core/events.d.ts +4 -0
- package/dist/src/core/events.d.ts.map +1 -1
- package/dist/src/core/events.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/queue/queue.d.ts +25 -0
- package/dist/src/queue/queue.d.ts.map +1 -1
- package/dist/src/queue/queue.js +175 -51
- package/dist/src/queue/queue.js.map +1 -1
- package/dist/src/router/router.d.ts +8 -1
- package/dist/src/router/router.d.ts.map +1 -1
- package/dist/src/router/router.js +75 -17
- package/dist/src/router/router.js.map +1 -1
- package/dist/src/state/conversation.d.ts +6 -0
- package/dist/src/state/conversation.d.ts.map +1 -1
- package/dist/src/state/conversation.js +79 -11
- package/dist/src/state/conversation.js.map +1 -1
- package/dist/src/state/menu.d.ts +53 -5
- package/dist/src/state/menu.d.ts.map +1 -1
- package/dist/src/state/menu.js +116 -17
- package/dist/src/state/menu.js.map +1 -1
- package/dist/src/storage/storage.d.ts +115 -12
- package/dist/src/storage/storage.d.ts.map +1 -1
- package/dist/src/storage/storage.js +130 -4
- package/dist/src/storage/storage.js.map +1 -1
- package/dist/src/telegram-features.d.ts +33 -0
- package/dist/src/telegram-features.d.ts.map +1 -0
- package/dist/src/telegram-features.js +69 -0
- package/dist/src/telegram-features.js.map +1 -0
- package/dist/src/testing.d.ts +1 -0
- package/dist/src/testing.d.ts.map +1 -1
- package/dist/src/testing.js +16 -0
- package/dist/src/testing.js.map +1 -1
- package/dist-cjs/src/api/index.js +1 -0
- package/dist-cjs/src/api/telegram-types/LICENSE +21 -0
- package/dist-cjs/src/api/telegram-types/api.d.ts +22 -0
- package/dist-cjs/src/api/telegram-types/checklist.d.ts +72 -0
- package/dist-cjs/src/api/telegram-types/inline.d.ts +692 -0
- package/dist-cjs/src/api/telegram-types/langs.d.ts +193 -0
- package/dist-cjs/src/api/telegram-types/manage.d.ts +1144 -0
- package/dist-cjs/src/api/telegram-types/markup.d.ts +268 -0
- package/dist-cjs/src/api/telegram-types/message.d.ts +1537 -0
- package/dist-cjs/src/api/telegram-types/methods.d.ts +2870 -0
- package/dist-cjs/src/api/telegram-types/mod.d.ts +14 -0
- package/dist-cjs/src/api/telegram-types/passport.d.ts +163 -0
- package/dist-cjs/src/api/telegram-types/payment.d.ts +570 -0
- package/dist-cjs/src/api/telegram-types/rich.d.ts +1010 -0
- package/dist-cjs/src/api/telegram-types/settings.d.ts +120 -0
- package/dist-cjs/src/api/telegram-types/story.d.ts +89 -0
- package/dist-cjs/src/api/telegram-types/update.d.ts +84 -0
- package/dist-cjs/src/api/telegram.js +2 -0
- package/dist-cjs/src/approval/approval.js +11 -1
- package/dist-cjs/src/cache/cache.js +7 -3
- package/dist-cjs/src/context/context.js +26 -3
- package/dist-cjs/src/core/bot.js +48 -7
- package/dist-cjs/src/index.js +1 -0
- package/dist-cjs/src/queue/queue.js +177 -51
- package/dist-cjs/src/router/router.js +75 -17
- package/dist-cjs/src/state/conversation.js +79 -11
- package/dist-cjs/src/state/menu.js +118 -18
- package/dist-cjs/src/storage/storage.js +135 -5
- package/dist-cjs/src/telegram-features.js +74 -0
- package/dist-cjs/src/testing.js +17 -0
- package/docs/API.id.md +1800 -0
- package/docs/API.md +1799 -0
- package/docs/API.zh-CN.md +1794 -0
- package/docs/README.md +36 -17
- package/package.json +20 -3
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# telebibz
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
**`@xbibzlibrary/telebibz`** 是一个面向 Node.js 和 TypeScript 的 Telegram Bot SDK 和框架。该包提供 API 客户端、轮询、路由器、中间件、上下文、键盘构造器、状态/会话、Webhook 处理、队列、调度器、缓存、插件生命周期、CLI 以及测试工具。
|
|
6
|
+
|
|
7
|
+
[English](README.md) · [Bahasa Indonesia](README.id.md) · **简体中文**
|
|
8
|
+
|
|
9
|
+
完整 API 参考:[English](docs/API.md) · [Indonesia](docs/API.id.md) · **中文**
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## 安装
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @xbibzlibrary/telebibz
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
需要 Node.js **20 或更高版本**。
|
|
20
|
+
|
|
21
|
+
## 简单机器人
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { Bot } from "@xbibzlibrary/telebibz";
|
|
25
|
+
|
|
26
|
+
const bot = new Bot(process.env.TELEGRAM_BOT_TOKEN!);
|
|
27
|
+
|
|
28
|
+
bot.command("start", (ctx) => ctx.reply("Bot aktif."));
|
|
29
|
+
bot.onText("ping", (ctx) => ctx.reply("pong"));
|
|
30
|
+
|
|
31
|
+
await bot.start();
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`Bot.start()` 会运行长轮询。要手动管理生命周期,请使用 `init()`, `launch({ mode: "polling" })`, `health()`, `stop()`, 或 `restart()`。
|
|
35
|
+
|
|
36
|
+
## 路由器与中间件
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
bot.use(async (ctx, next) => {
|
|
40
|
+
const started = Date.now();
|
|
41
|
+
await next();
|
|
42
|
+
console.log(`processed in ${Date.now() - started}ms`);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
bot.command("help", (ctx) => ctx.reply("Bantuan tersedia."));
|
|
46
|
+
bot.onRegex(/^order:(\\d+)$/, (ctx) => ctx.reply("Order diterima."));
|
|
47
|
+
bot.callback("profile:", (ctx) => ctx.answerCallbackQuery("Dibuka."));
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
路由器支持命令、文本、正则、回调模式、自定义谓词、嵌套路由器、每条路由的中间件,以及路由优先级。
|
|
51
|
+
|
|
52
|
+
## Telegram API
|
|
53
|
+
|
|
54
|
+
通过 API 客户端可以使用生成的方法调用和原始调用:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
await bot.api.methods.getMe();
|
|
58
|
+
await bot.api.methods.sendMessage({ chat_id: 123456789, text: "Halo." });
|
|
59
|
+
await bot.api.call("sendMessage", { chat_id: 123456789, text: "Halo." });
|
|
60
|
+
await bot.api.raw("futureTelegramMethod", { value: true });
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
内置传输使用 `fetch`,支持超时、重试、指数退避、JSON 载荷和多部分上传。
|
|
64
|
+
|
|
65
|
+
关于每个 class、function、method、type、error、lifecycle、CLI 命令和生成的 Telegram 方法的完整 API 参考请参见 [`docs/API.zh-CN.md`](docs/API.zh-CN.md)。
|
|
66
|
+
|
|
67
|
+
## 键盘
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import { InlineKeyboard } from "@xbibzlibrary/telebibz";
|
|
71
|
+
|
|
72
|
+
const keyboard = new InlineKeyboard()
|
|
73
|
+
.text("Profil", "profile")
|
|
74
|
+
.url("Dokumentasi", "https://core.telegram.org/bots/api")
|
|
75
|
+
.build();
|
|
76
|
+
|
|
77
|
+
await ctx.reply("Pilih menu:", { reply_markup: keyboard });
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
构造器仅生成 Telegram 原生键盘的 payload。HTML/CSS 的 UI 需要单独的 Mini App 或 Web App。
|
|
81
|
+
|
|
82
|
+
## 所有者审批
|
|
83
|
+
|
|
84
|
+
审批门将在所有者通过 **允许** 或 **不允许** 按钮批准机器人之前拦截普通更新。
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
const bot = new Bot({
|
|
88
|
+
token: process.env.TELEGRAM_BOT_TOKEN!,
|
|
89
|
+
approval: {
|
|
90
|
+
ownerChatId: Number(process.env.TELEBIBZ_OWNER_CHAT_ID),
|
|
91
|
+
ownerUserId: Number(process.env.TELEBIBZ_OWNER_USER_ID),
|
|
92
|
+
ownerLabel: "Dev Gantenggg",
|
|
93
|
+
requireApproval: true,
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
库会向 `ownerChatId` 发送通知,但只有 `ownerUserId` 可以做出决策。回调使用随机 nonce。对于多实例部署,请通过数据库或 Redis 使用持久化的 `ApprovalStore`;默认是内存存储。
|
|
99
|
+
|
|
100
|
+
## Webhook
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { Bot, createWebhookHandler } from "@xbibzlibrary/telebibz";
|
|
104
|
+
|
|
105
|
+
const bot = new Bot(process.env.TELEGRAM_BOT_TOKEN!);
|
|
106
|
+
const handler = createWebhookHandler(bot, {
|
|
107
|
+
secretToken: process.env.TELEGRAM_WEBHOOK_SECRET,
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
`createWebhookHandler` 接受标准 Web `Request` 并返回 `Response`。处理程序会验证 secret token、body 大小、JSON 解析以及重复更新处理。
|
|
112
|
+
|
|
113
|
+
## 状态、队列、调度器和缓存
|
|
114
|
+
|
|
115
|
+
该包提供带 TTL 和原子更新的 `MemoryStorage`、`JsonFileStorage`、`RedisStorage`、`SqlStorage`、`MongoStorage`、持久化 approval storage、bot session、基于 Storage 的 conversation/form、基于 permission 的菜单、`MenuController` 分页、`MemoryCache`、令牌桶限流器、支持重试/退避/并发/延迟/取消的任务队列,以及间隔、一次性和完整五字段 cron 的调度器。Redis、SQL 和 Mongo 适配器使用小型 driver interface,因此 core package 不需要 vendor runtime dependency。
|
|
116
|
+
|
|
117
|
+
## CLI
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npx telebibz init my-bot
|
|
121
|
+
npx telebibz doctor
|
|
122
|
+
npx telebibz build
|
|
123
|
+
npx telebibz test
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## 测试
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
npm run typecheck
|
|
130
|
+
npm run test:types
|
|
131
|
+
npm run lint
|
|
132
|
+
npm test
|
|
133
|
+
npm run build
|
|
134
|
+
npm run security
|
|
135
|
+
npm run release:check
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
真实的 Telegram E2E 需要 `TELEGRAM_BOT_TOKEN` 和 `TELEGRAM_TEST_CHAT_ID`。没有凭证时,E2E 将被跳过且不计为通过。
|
|
139
|
+
|
|
140
|
+
## Web App 和支付
|
|
141
|
+
|
|
142
|
+
`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。
|
|
143
|
+
|
|
144
|
+
## API 目标与限制
|
|
145
|
+
|
|
146
|
+
方法列表会在 schema 更新时根据 Telegram Bot API 文档生成。检测到的官方方法都可以运行时访问,而专门的参数/结果推断主要集中在 core method map。完整的 Telegram object、union、enum 和 method declaration 可通过 `TelegramTypes` 使用。有关实现状态请参见 [FEATURE_MATRIX.md](FEATURE_MATRIX.md),有关审批的详细信息请参见 [APPROVAL_FEATURE.md](APPROVAL_FEATURE.md)。
|
|
147
|
+
|
|
148
|
+
## 发布自动化
|
|
149
|
+
|
|
150
|
+
GitHub repository 提供 CI 和自动发布 workflow。每次推送到 `main` 都会运行 quality gates,选择尚未使用的 patch version,创建 commit 和 tag,发布 npm package,然后创建 GitHub Release。由于 source repository 是 private,workflow 使用 `--provenance=false`,符合 npm 对 private source 的限制。依赖自动发布前,请在 GitHub Actions 中配置 `NPM_TOKEN` secret。请参阅 [RELEASE_AUTOMATION.md](RELEASE_AUTOMATION.md)。
|
|
151
|
+
|
|
152
|
+
## 项目 policy 和贡献
|
|
153
|
+
|
|
154
|
+
| 文档 | 用途 |
|
|
155
|
+
|---|---|
|
|
156
|
+
| [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) | 社区行为、执行、报告和申诉。 |
|
|
157
|
+
| [CONTRIBUTING.md](CONTRIBUTING.md) | 本地 setup、branch/commit、测试、review 和 release workflow。 |
|
|
158
|
+
| [CONTRIBUTION_RULES.md](CONTRIBUTION_RULES.md) | API、兼容性、测试、依赖、安全和 release 规则。 |
|
|
159
|
+
| [GOVERNANCE.md](GOVERNANCE.md) | 角色、决策、triage、repository protection 和规则修改。 |
|
|
160
|
+
| [SECURITY.md](SECURITY.md) | 私密漏洞报告、security boundary 和 credential rotation。 |
|
|
161
|
+
| [SUPPORT.md](SUPPORT.md) | Support channel、安全报告规则和 response 预期。 |
|
|
162
|
+
| [RELEASE_AUTOMATION.md](RELEASE_AUTOMATION.md) | GitHub-to-npm automation 和 `NPM_TOKEN` setup。 |
|
|
163
|
+
| [RELEASE_POLICY.md](RELEASE_POLICY.md) | Immutable release 和 hardening 控制。 |
|
|
164
|
+
| [NOTICE.md](NOTICE.md) | 第三方 declaration attribution。 |
|
|
165
|
+
|
|
166
|
+
## 安全
|
|
167
|
+
|
|
168
|
+
不要将 Telegram token 或 npm 凭证提交到版本控制。使用环境变量或机密管理器。有关安全策略和发布加固,请参见 [SECURITY.md](SECURITY.md) 和 [RELEASE_POLICY.md](RELEASE_POLICY.md)。
|
|
169
|
+
|
|
170
|
+
## 许可证
|
|
171
|
+
|
|
172
|
+
MIT。参见 [LICENSE](LICENSE)。
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# GitHub-to-npm Release Automation
|
|
2
|
+
|
|
3
|
+
Repository ini menggunakan GitHub Actions untuk menjaga source GitHub dan package npm tetap sinkron melalui satu jalur release yang tervalidasi. Repository source tetap private; karena itu workflow menggunakan npm publish tanpa provenance, sesuai batasan registry npm untuk source private.
|
|
4
|
+
|
|
5
|
+
## Alur otomatis
|
|
6
|
+
|
|
7
|
+
Setiap push ke branch `main` menjalankan workflow `.github/workflows/auto-publish.yml`, kecuali commit tersebut memuat marker `[skip release]`.
|
|
8
|
+
|
|
9
|
+
| Tahap | Perilaku |
|
|
10
|
+
|---|---|
|
|
11
|
+
| Checkout | Mengambil seluruh history agar tag dapat dibuat dengan benar. |
|
|
12
|
+
| Install | Menjalankan `npm ci --ignore-scripts`. |
|
|
13
|
+
| Version | Membaca versi dari `package.json`, membaca versi latest npm, lalu memilih patch version berikutnya yang lebih tinggi dari keduanya. |
|
|
14
|
+
| Verification | Menjalankan typecheck, type-level tests, lint, runtime tests, build ESM/CommonJS, security audit, dan release check. |
|
|
15
|
+
| Immutable guard | Menolak publish jika versi target sudah ada di npm. |
|
|
16
|
+
| Git sync | Commit otomatis `chore(release): vX.Y.Z [skip release]`, membuat annotated tag `vX.Y.Z`, lalu push commit dan tag ke GitHub. |
|
|
17
|
+
| npm publish | Menerbitkan package public menggunakan `NPM_TOKEN`; provenance dinonaktifkan karena npm menolak provenance dari source repository private. |
|
|
18
|
+
| GitHub Release | Membuat GitHub Release dengan generated notes. |
|
|
19
|
+
|
|
20
|
+
Push commit version otomatis tidak memicu release kedua karena mengandung `[skip release]`. Workflow menggunakan concurrency sehingga release berjalan satu per satu.
|
|
21
|
+
|
|
22
|
+
## Secret yang wajib tersedia
|
|
23
|
+
|
|
24
|
+
Buka repository GitHub, kemudian masuk ke **Settings → Secrets and variables → Actions** dan tambahkan repository secret:
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
NPM_TOKEN=${NPM_TOKEN}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Jika memakai GitHub Environment bernama `npm-release`, secret dapat disimpan sebagai environment secret dan environment tersebut dapat diberi required reviewers untuk approval manual sebelum publish.
|
|
31
|
+
|
|
32
|
+
Jangan menyimpan token di repository, `.npmrc`, source code, issue, commit, atau workflow. Token npm yang pernah ditempelkan di chat harus dicabut dan diganti dengan granular token baru.
|
|
33
|
+
|
|
34
|
+
## Aturan penggunaan
|
|
35
|
+
|
|
36
|
+
Perubahan source biasa dapat dipush ke `main`; workflow akan menghasilkan patch release baru setelah seluruh quality gates lulus. Karena versi npm immutable, workflow tidak pernah menimpa versi yang telah ada.
|
|
37
|
+
|
|
38
|
+
Untuk perubahan besar, ubah `package.json` ke major/minor version yang diinginkan sebelum push. Workflow tetap memastikan hasil akhir lebih tinggi daripada versi npm yang sudah terbit, lalu menaikkan patch dari versi tertinggi tersebut.
|
|
39
|
+
|
|
40
|
+
Untuk perubahan dokumentasi atau perubahan internal yang tidak boleh menerbitkan npm, gunakan commit message yang memuat marker berikut:
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
docs: update API reference [skip release]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Untuk memicu workflow secara manual, gunakan **Actions → Auto publish to npm → Run workflow**. Manual trigger tetap menjalankan versioning dan semua gate yang sama.
|
|
47
|
+
|
|
48
|
+
## Verifikasi lokal
|
|
49
|
+
|
|
50
|
+
Sebelum push, jalankan:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm run typecheck
|
|
54
|
+
npm run test:types
|
|
55
|
+
npm run lint
|
|
56
|
+
npm test
|
|
57
|
+
npm run build
|
|
58
|
+
npm run security
|
|
59
|
+
npm run release:check
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Setelah workflow selesai, verifikasi:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
npm view @xbibzlibrary/telebibz version dist.integrity dist.tarball
|
|
66
|
+
```
|
package/RELEASE_POLICY.md
CHANGED
|
@@ -6,9 +6,9 @@ The published artifact is scoped as `@xbibzlibrary/telebibz`. npm package versio
|
|
|
6
6
|
|
|
7
7
|
## Hardening controls
|
|
8
8
|
|
|
9
|
-
Every release must pass strict TypeScript typechecking, type-level tests, lint, runtime tests, build for ESM and CommonJS, dependency audit, and `release:check`. The release checker rejects an incorrect scope, private package status, missing public publish configuration,
|
|
9
|
+
Every release must pass strict TypeScript typechecking, type-level tests, lint, runtime tests, build for ESM and CommonJS, dependency audit, and `release:check`. The release checker rejects an incorrect scope, private package status, missing public publish configuration, install lifecycle scripts, credential patterns in tracked release content, and incomplete tarball contents. npm provenance is required when the source repository is public; npm rejects provenance for private source repositories, so the current private-repository workflow explicitly uses `--provenance=false`.
|
|
10
10
|
|
|
11
|
-
The package uses
|
|
11
|
+
The package uses a protected GitHub Actions release workflow. The publish token must be stored only as a repository secret or temporary `NPM_TOKEN` environment variable with the smallest possible scope. Tokens must never be committed, placed in `.npmrc` inside the repository, or included in archives.
|
|
12
12
|
|
|
13
13
|
## Release verification
|
|
14
14
|
|
package/SECURITY.md
CHANGED
|
@@ -2,14 +2,46 @@
|
|
|
2
2
|
|
|
3
3
|
## Supported versions
|
|
4
4
|
|
|
5
|
-
Security fixes target the latest development branch and the latest published stable release.
|
|
5
|
+
Security fixes target the latest development branch and the latest published stable release. Older versions may not receive backports. Upgrade to the latest release before requesting a fix unless the issue prevents upgrading.
|
|
6
|
+
|
|
7
|
+
| Version | Supported |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `main` | Yes, subject to current development changes |
|
|
10
|
+
| Latest `0.x` release | Yes |
|
|
11
|
+
| Older releases | Best effort only |
|
|
6
12
|
|
|
7
13
|
## Reporting a vulnerability
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
Do not publish tokens, sensitive payloads, exploit instructions, private chat content, or personal data in a public issue, pull request, discussion, or commit.
|
|
16
|
+
|
|
17
|
+
Use GitHub's private vulnerability reporting or Security Advisory flow for this repository when available: [Report a private vulnerability](https://github.com/XbibzOfficial777/telebibz/security/advisories/new). If that flow is unavailable, contact the repository maintainers privately through an authenticated GitHub channel and request a secure reporting path. Do not create a public issue to ask where to report a vulnerability.
|
|
18
|
+
|
|
19
|
+
A useful report includes the affected version or commit, Node.js version, impact, attack prerequisites, a minimal safe reproduction, affected subsystem, and a proposed mitigation if known. Redact credentials, personal information, private Telegram identifiers, and production payloads. Attachments should be sanitized before submission.
|
|
20
|
+
|
|
21
|
+
## What to report privately
|
|
22
|
+
|
|
23
|
+
Report authentication bypasses, secret exposure, webhook verification failures, unsafe file or URL handling, arbitrary code execution, injection, cross-user state leakage, approval-gate bypasses, dependency supply-chain issues, release-workflow compromise, and vulnerabilities that can cause unauthorized Telegram actions or data disclosure.
|
|
24
|
+
|
|
25
|
+
Ordinary bugs without a security impact should use the public [Bug Report template](.github/ISSUE_TEMPLATE/bug_report.yml). Documentation and support requests should use their dedicated templates.
|
|
26
|
+
|
|
27
|
+
## Response process
|
|
28
|
+
|
|
29
|
+
Maintainers acknowledge a private report when practical, reproduce it in an isolated environment, assess severity and affected versions, coordinate a fix, and publish a security advisory or release note when disclosure is appropriate. Timelines depend on severity, reproducibility, maintainer availability, and coordination with affected users or upstream providers.
|
|
30
|
+
|
|
31
|
+
Reporters should allow reasonable time for remediation and coordinated disclosure. Do not publicly disclose a vulnerability, proof of exploit, or affected production target before maintainers confirm that disclosure is safe.
|
|
10
32
|
|
|
11
33
|
## Security boundaries
|
|
12
34
|
|
|
13
|
-
|
|
35
|
+
telebibz does not send telemetry to third parties automatically. Tokens must be supplied through environment variables or a secret manager and must never be committed to source control, issue text, logs, screenshots, package archives, or workflow output.
|
|
36
|
+
|
|
37
|
+
Telegram input is untrusted. Callback data, file paths, URLs, JSON payloads, and user-provided text must be validated before being used as filesystem, network, database, shell, or authorization input. Webhook deployments must restrict access, verify the Telegram secret token, enforce body-size limits, and apply infrastructure-level rate limiting where appropriate.
|
|
38
|
+
|
|
39
|
+
Storage adapters are security boundaries owned by the application. Configure Redis, SQL, Mongo, and file permissions according to the deployment threat model. Do not store secrets or unnecessary personal data in sessions, conversations, caches, queues, or approval records.
|
|
40
|
+
|
|
41
|
+
## Credential exposure and rotation
|
|
42
|
+
|
|
43
|
+
If a Telegram or npm credential is exposed, revoke or rotate it immediately through the relevant provider, remove it from uncommitted files and logs, invalidate affected sessions, inspect release history, and report the exposure privately. Removing a secret from the latest commit does not remove it from history or external logs.
|
|
44
|
+
|
|
45
|
+
## Security updates
|
|
14
46
|
|
|
15
|
-
|
|
47
|
+
Security fixes may change behavior or require a new immutable npm version. Follow [RELEASE_POLICY.md](RELEASE_POLICY.md) and [RELEASE_AUTOMATION.md](RELEASE_AUTOMATION.md) for the protected release path.
|
package/SUPPORT.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Support Policy
|
|
2
|
+
|
|
3
|
+
## Before requesting support
|
|
4
|
+
|
|
5
|
+
Read the [English API reference](docs/API.md), the localized API references, [CONTRIBUTING.md](CONTRIBUTING.md), and the relevant release or security policy. Search existing issues and discussions before opening a new request.
|
|
6
|
+
|
|
7
|
+
## Where to ask
|
|
8
|
+
|
|
9
|
+
| Need | Channel |
|
|
10
|
+
|---|---|
|
|
11
|
+
| Usage question or configuration help | GitHub issue using the Question/Support template |
|
|
12
|
+
| Reproducible defect | GitHub issue using the Bug Report template |
|
|
13
|
+
| New capability | GitHub issue using the Feature Request template |
|
|
14
|
+
| Documentation error | GitHub issue using the Documentation template |
|
|
15
|
+
| Security vulnerability | Private process described in [SECURITY.md](SECURITY.md); never a public issue |
|
|
16
|
+
| Contribution or patch | Pull request following [CONTRIBUTING.md](CONTRIBUTING.md) |
|
|
17
|
+
|
|
18
|
+
## Information to include
|
|
19
|
+
|
|
20
|
+
Provide the telebibz version, Node.js version, operating system where relevant, module system, minimal reproduction, expected behavior, actual behavior, stack trace with secrets removed, and the result of relevant quality gates. Include whether the behavior occurs with ESM, CommonJS, mocks, or a real Telegram environment.
|
|
21
|
+
|
|
22
|
+
Never include Telegram bot tokens, npm tokens, private keys, cookies, authorization headers, real user identifiers, private chat content, or unredacted production payloads. Replace sensitive values with placeholders before posting.
|
|
23
|
+
|
|
24
|
+
## Response expectations
|
|
25
|
+
|
|
26
|
+
This is a community-maintained project. Maintainers prioritize security reports, release blockers, data-loss risks, regressions, and reproducible runtime failures. Response and fix times are not guaranteed. A support request may be closed when it lacks a reproduction after reasonable follow-up, duplicates an existing issue, or asks for behavior outside the documented scope.
|
|
27
|
+
|
|
28
|
+
## Support boundaries
|
|
29
|
+
|
|
30
|
+
Support does not include operating a user's production infrastructure, recovering deleted credentials, guaranteeing Telegram availability, or bypassing npm/GitHub permission controls. For Telegram platform behavior, verify the official Telegram Bot API documentation as well as the telebibz API reference.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>telebibz README preview</title>
|
|
6
|
+
<style>
|
|
7
|
+
:root { color-scheme: dark; --bg:#07111f; --panel:#0d1b2d; --panel2:#11243a; --line:#24415f; --text:#f1f7ff; --muted:#9db1c8; --cyan:#42d9ff; --blue:#668cff; --green:#72e1ad; --orange:#ffbd6b; }
|
|
8
|
+
* { box-sizing: border-box; }
|
|
9
|
+
body { margin:0; width:1600px; min-height:1000px; font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif; background: radial-gradient(circle at 10% 0%, #12345b 0, transparent 37%), linear-gradient(135deg,#06101d,#0a1728 55%,#071221); color:var(--text); }
|
|
10
|
+
.wrap { padding:58px 74px 64px; }
|
|
11
|
+
.top { display:flex; align-items:center; justify-content:space-between; margin-bottom:44px; }
|
|
12
|
+
.brand { display:flex; align-items:center; gap:20px; }
|
|
13
|
+
.mark { width:78px; height:78px; border-radius:22px; background:linear-gradient(145deg,#39d9ff,#637cff); display:grid; place-items:center; box-shadow:0 18px 45px #1e8bdc55; font-weight:900; font-size:31px; letter-spacing:-3px; color:#fff; }
|
|
14
|
+
h1 { font-size:48px; line-height:1; margin:0 0 10px; letter-spacing:-2px; }
|
|
15
|
+
.tag { color:var(--muted); font-size:20px; }
|
|
16
|
+
.lang { border:1px solid var(--line); background:#0b1b2d; color:#dcecff; padding:12px 18px; border-radius:12px; font-weight:700; }
|
|
17
|
+
.hero { display:grid; grid-template-columns: 1fr 1.15fr; gap:34px; align-items:stretch; }
|
|
18
|
+
.hero-copy { padding:30px 0 10px; }
|
|
19
|
+
.eyebrow { color:var(--cyan); text-transform:uppercase; letter-spacing:2px; font-size:13px; font-weight:800; }
|
|
20
|
+
h2 { font-size:42px; line-height:1.08; letter-spacing:-1.5px; margin:14px 0 18px; max-width:630px; }
|
|
21
|
+
.lead { color:#bfd0e4; font-size:20px; line-height:1.5; max-width:640px; }
|
|
22
|
+
.pill-row { display:flex; flex-wrap:wrap; gap:10px; margin-top:26px; }
|
|
23
|
+
.pill { border:1px solid #2d5277; background:#0c2035; color:#dcefff; padding:9px 13px; border-radius:999px; font-size:14px; }
|
|
24
|
+
.code { border:1px solid var(--line); background:#071525; border-radius:20px; overflow:hidden; box-shadow:0 22px 70px #0006; }
|
|
25
|
+
.code-head { display:flex; align-items:center; gap:8px; padding:15px 18px; background:#0d2137; border-bottom:1px solid var(--line); color:#91abc8; font-size:14px; }
|
|
26
|
+
.dot { width:10px; height:10px; border-radius:50%; background:#fb7185; } .dot:nth-child(2){background:#fbbf24}.dot:nth-child(3){background:#34d399}
|
|
27
|
+
pre { margin:0; padding:24px 28px 30px; font-family:"SFMono-Regular",Consolas,monospace; font-size:18px; line-height:1.62; color:#d9e8fa; white-space:pre-wrap; }
|
|
28
|
+
.kw { color:#9b9dff; }.fn { color:#74e7ff; }.str { color:#8de8ae; }.cm { color:#6f8ba8; }
|
|
29
|
+
.section-title { margin:56px 0 20px; display:flex; align-items:end; justify-content:space-between; }
|
|
30
|
+
.section-title h3 { margin:0; font-size:26px; letter-spacing:-.5px; }.section-title span { color:var(--muted); font-size:14px; }
|
|
31
|
+
.cards { display:grid; grid-template-columns:repeat(4,1fr); gap:16px; }
|
|
32
|
+
.card { min-height:150px; padding:21px; border:1px solid var(--line); background:linear-gradient(145deg,#0d2034,#0b1828); border-radius:16px; }
|
|
33
|
+
.icon { color:var(--cyan); font-size:22px; font-weight:900; }.card strong { display:block; margin:12px 0 8px; font-size:17px; }.card p { margin:0; color:var(--muted); line-height:1.45; font-size:14px; }
|
|
34
|
+
.footer { display:flex; justify-content:space-between; gap:20px; margin-top:40px; padding-top:20px; border-top:1px solid var(--line); color:var(--muted); font-size:14px; }
|
|
35
|
+
.status { color:var(--green); font-weight:800; }
|
|
36
|
+
</style>
|
|
37
|
+
</head>
|
|
38
|
+
<body>
|
|
39
|
+
<main class="wrap">
|
|
40
|
+
<header class="top">
|
|
41
|
+
<div class="brand"><div class="mark">tb</div><div><h1>telebibz</h1><div class="tag">Telegram Bot Framework for Node.js & TypeScript</div></div></div>
|
|
42
|
+
<div class="lang">English · Bahasa Indonesia · 简体中文</div>
|
|
43
|
+
</header>
|
|
44
|
+
<section class="hero">
|
|
45
|
+
<div class="hero-copy">
|
|
46
|
+
<div class="eyebrow">Typed. Composable. Production-minded.</div>
|
|
47
|
+
<h2>Build serious Telegram bots without fighting the API.</h2>
|
|
48
|
+
<p class="lead">A full-scale framework with typed API access, routing, middleware, context helpers, keyboards, sessions, webhooks, queues, scheduling, plugins, approval gates, and test utilities.</p>
|
|
49
|
+
<div class="pill-row"><span class="pill">Node.js ≥ 20</span><span class="pill">ESM + CommonJS</span><span class="pill">Telegram Bot API 10.2</span><span class="pill">TypeScript strict</span></div>
|
|
50
|
+
</div>
|
|
51
|
+
<div class="code"><div class="code-head"><span class="dot"></span><span class="dot"></span><span class="dot"></span><span style="margin-left:8px">examples/minimal.ts</span></div><pre><span class="kw">import</span> { <span class="fn">Bot</span>, <span class="fn">InlineKeyboard</span> } <span class="kw">from</span> <span class="str">"@xbibzlibrary/telebibz"</span>;
|
|
52
|
+
|
|
53
|
+
<span class="kw">const</span> bot = <span class="kw">new</span> <span class="fn">Bot</span>(process.env.TELEGRAM_BOT_TOKEN!);
|
|
54
|
+
|
|
55
|
+
bot.<span class="fn">command</span>(<span class="str">"start"</span>, (ctx) =>
|
|
56
|
+
ctx.<span class="fn">reply</span>(<span class="str">"Welcome to telebibz"</span>, {
|
|
57
|
+
reply_markup: <span class="kw">new</span> <span class="fn">InlineKeyboard</span>()
|
|
58
|
+
.<span class="fn">text</span>(<span class="str">"Explore API"</span>, <span class="str">"api"</span>)
|
|
59
|
+
.<span class="fn">build</span>(),
|
|
60
|
+
}),
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
<span class="kw">await</span> bot.<span class="fn">start</span>();</pre></div>
|
|
64
|
+
</section>
|
|
65
|
+
<div class="section-title"><h3>One framework, the whole bot lifecycle</h3><span>Designed around real Telegram primitives</span></div>
|
|
66
|
+
<section class="cards">
|
|
67
|
+
<article class="card"><div class="icon">01</div><strong>Typed API client</strong><p>Dynamic Telegram method access with typed core methods, errors, retry, timeout, JSON, multipart, and AbortSignal.</p></article>
|
|
68
|
+
<article class="card"><div class="icon">02</div><strong>Router + context</strong><p>Commands, exact text, regex, callbacks, predicates, nested routes, middleware composition, and ergonomic replies.</p></article>
|
|
69
|
+
<article class="card"><div class="icon">03</div><strong>Stateful workflows</strong><p>Sessions, forms, conversations, wizards, menus, pagination, queues, schedulers, caches, and plugins.</p></article>
|
|
70
|
+
<article class="card"><div class="icon">04</div><strong>Release hardening</strong><p>Approval gate, webhook secret verification, ESM/CommonJS builds, tests, security checks, and npm provenance.</p></article>
|
|
71
|
+
</section>
|
|
72
|
+
<footer class="footer"><span>xbibzlibrary/telebibz · documented in three languages</span><span class="status">● API surface documented</span></footer>
|
|
73
|
+
</main>
|
|
74
|
+
</body>
|
|
75
|
+
</html>
|
|
Binary file
|
package/dist/src/api/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
|
package/dist/src/api/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021-2024 KnorpelSenf
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface ApiError {
|
|
2
|
+
ok: false;
|
|
3
|
+
error_code: number;
|
|
4
|
+
description: string;
|
|
5
|
+
parameters?: ResponseParameters;
|
|
6
|
+
}
|
|
7
|
+
export interface ApiSuccess<T> {
|
|
8
|
+
ok: true;
|
|
9
|
+
result: T;
|
|
10
|
+
}
|
|
11
|
+
/** The response contains an object, which always has a Boolean field 'ok' and may have an optional String field 'description' with a human-readable description of the result. If 'ok' equals True, the request was successful and the result of the query can be found in the 'result' field. In case of an unsuccessful request, 'ok' equals False and the error is explained in the 'description'. An Integer 'error_code' field is also returned, but its contents are subject to change in the future. Some errors may also have an optional field 'parameters' of the type ResponseParameters, which can help to automatically handle the error.
|
|
12
|
+
|
|
13
|
+
- All methods in the Bot API are case-insensitive.
|
|
14
|
+
- All queries must be made using UTF-8. */
|
|
15
|
+
export type ApiResponse<T> = ApiError | ApiSuccess<T>;
|
|
16
|
+
/** Describes why a request was unsuccessful. */
|
|
17
|
+
export interface ResponseParameters {
|
|
18
|
+
/** The group has been migrated to a supergroup with the specified identifier. */
|
|
19
|
+
migrate_to_chat_id?: number;
|
|
20
|
+
/** In case of exceeding flood control, the number of seconds left to wait before the request can be repeated */
|
|
21
|
+
retry_after?: number;
|
|
22
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Chat, User } from "./manage.js";
|
|
2
|
+
import type { Message, MessageEntity, ParseMode } from "./message.js";
|
|
3
|
+
/** Describes a task in a checklist. */
|
|
4
|
+
export interface ChecklistTask {
|
|
5
|
+
/** Unique identifier of the task */
|
|
6
|
+
id: number;
|
|
7
|
+
/** Text of the task */
|
|
8
|
+
text: string;
|
|
9
|
+
/** Special entities that appear in the task text */
|
|
10
|
+
text_entities?: MessageEntity[];
|
|
11
|
+
/** User that completed the task; omitted if the task wasn't completed by a user */
|
|
12
|
+
completed_by_user?: User;
|
|
13
|
+
/** Chat that completed the task; omitted if the task wasn't completed by a chat */
|
|
14
|
+
completed_by_chat?: Chat;
|
|
15
|
+
/** Point in time (Unix timestamp) when the task was completed; 0 if the task wasn't completed */
|
|
16
|
+
completion_date?: number;
|
|
17
|
+
}
|
|
18
|
+
/** Describes a checklist. */
|
|
19
|
+
export interface Checklist {
|
|
20
|
+
/** Title of the checklist */
|
|
21
|
+
title: string;
|
|
22
|
+
/** Special entities that appear in the checklist title */
|
|
23
|
+
title_entities?: MessageEntity[];
|
|
24
|
+
/** List of tasks in the checklist */
|
|
25
|
+
tasks: ChecklistTask[];
|
|
26
|
+
/** True, if users other than the creator of the list can add tasks to the list */
|
|
27
|
+
others_can_add_tasks?: true;
|
|
28
|
+
/** True, if users other than the creator of the list can mark tasks as done or not done */
|
|
29
|
+
others_can_mark_tasks_as_done?: true;
|
|
30
|
+
}
|
|
31
|
+
/** Describes a task to add to a checklist. */
|
|
32
|
+
export interface InputChecklistTask {
|
|
33
|
+
/** Unique identifier of the task; must be positive and unique among all task identifiers currently present in the checklist */
|
|
34
|
+
id: number;
|
|
35
|
+
/** Text of the task; 1-100 characters after entities parsing */
|
|
36
|
+
text: string;
|
|
37
|
+
/** Mode for parsing entities in the text. See formatting options for more details. */
|
|
38
|
+
parse_mode?: ParseMode;
|
|
39
|
+
/** List of special entities that appear in the text, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, custom_emoji, and date_time entities are allowed. */
|
|
40
|
+
text_entities?: MessageEntity[];
|
|
41
|
+
}
|
|
42
|
+
/** Describes a checklist to create. */
|
|
43
|
+
export interface InputChecklist {
|
|
44
|
+
/** Title of the checklist; 1-255 characters after entities parsing */
|
|
45
|
+
title: string;
|
|
46
|
+
/** Mode for parsing entities in the title. See formatting options for more details. */
|
|
47
|
+
parse_mode?: ParseMode;
|
|
48
|
+
/** List of special entities that appear in the title, which can be specified instead of parse_mode. Currently, only bold, italic, underline, strikethrough, spoiler, custom_emoji, and date_time entities are allowed. */
|
|
49
|
+
title_entities?: MessageEntity[];
|
|
50
|
+
/** List of 1-30 tasks in the checklist */
|
|
51
|
+
tasks: InputChecklistTask[];
|
|
52
|
+
/** Pass True if other users can add tasks to the checklist */
|
|
53
|
+
others_can_add_tasks?: boolean;
|
|
54
|
+
/** Pass True if other users can mark tasks as done or not done in the checklist */
|
|
55
|
+
others_can_mark_tasks_as_done?: true;
|
|
56
|
+
}
|
|
57
|
+
/** Describes a service message about checklist tasks marked as done or not done. */
|
|
58
|
+
export interface ChecklistTasksDone {
|
|
59
|
+
/** Message containing the checklist whose tasks were marked as done or not done. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */
|
|
60
|
+
checklist_message?: Message;
|
|
61
|
+
/** Identifiers of the tasks that were marked as done */
|
|
62
|
+
marked_as_done_task_ids?: number[];
|
|
63
|
+
/** Identifiers of the tasks that were marked as not done */
|
|
64
|
+
marked_as_not_done_task_ids?: number[];
|
|
65
|
+
}
|
|
66
|
+
/** Describes a service message about tasks added to a checklist. */
|
|
67
|
+
export interface ChecklistTasksAdded {
|
|
68
|
+
/** Message containing the checklist to which the tasks were added. Note that the Message object in this field will not contain the reply_to_message field even if it itself is a reply. */
|
|
69
|
+
checklist_message?: Message;
|
|
70
|
+
/** List of tasks added to the checklist */
|
|
71
|
+
tasks: ChecklistTask[];
|
|
72
|
+
}
|