balebaazoo 1.0.0
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/LICENSE +674 -0
- package/README.en.md +61 -0
- package/README.md +70 -0
- package/dist/index.cjs +1047 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +860 -0
- package/dist/index.d.ts +860 -0
- package/dist/index.js +1015 -0
- package/dist/index.js.map +1 -0
- package/package.json +80 -0
package/README.en.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# balebaazoo
|
|
2
|
+
|
|
3
|
+
Modern, type-safe TypeScript SDK for the [Bale Bot API](https://docs.bale.ai/).
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/balebaazoo)
|
|
6
|
+
[](https://github.com/HadiMardanian/baleBaazooSDK/actions/workflows/ci.yml)
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install balebaazoo
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Requires Node.js 18+.
|
|
15
|
+
|
|
16
|
+
## Quick start
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { Bot, InlineKeyboard } from "balebaazoo";
|
|
20
|
+
|
|
21
|
+
const bot = new Bot(process.env.BOT_TOKEN!);
|
|
22
|
+
|
|
23
|
+
bot.command("start", (ctx) =>
|
|
24
|
+
ctx.reply("Hello! Welcome to my bot.", {
|
|
25
|
+
reply_markup: new InlineKeyboard().text("About", "about"),
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
bot.on("callback_query:data", async (ctx) => {
|
|
30
|
+
await ctx.answerCallbackQuery();
|
|
31
|
+
await ctx.reply("More info...");
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
bot.start();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Features
|
|
38
|
+
|
|
39
|
+
- Full Bale Bot API client with TypeScript types
|
|
40
|
+
- Bot framework: middleware, filters, commands, composers
|
|
41
|
+
- Polling and webhook support
|
|
42
|
+
- Context shortcuts (`ctx.reply`, `ctx.replyWithPhoto`, ...)
|
|
43
|
+
- Wallet payments, `askReview`, `inquireTransaction`
|
|
44
|
+
- Zero runtime dependencies
|
|
45
|
+
|
|
46
|
+
## Documentation
|
|
47
|
+
|
|
48
|
+
- **English:** this README
|
|
49
|
+
- **Persian (full guide):** [docs/fa/usage.md](docs/fa/usage.md)
|
|
50
|
+
|
|
51
|
+
## Examples
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm run example:echo
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
See [`examples/`](examples/) for more.
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
GPL-3.0-or-later
|
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# balebaazoo
|
|
2
|
+
|
|
3
|
+
SDK مدرن و type-safe برای توسعهٔ بازو (Bot) در پیامرسان بله.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/balebaazoo)
|
|
6
|
+
|
|
7
|
+
بر پایهٔ [مستندات رسمی API بازوی بله](https://docs.bale.ai/) ساخته شده است.
|
|
8
|
+
|
|
9
|
+
**English:** [README.en.md](README.en.md)
|
|
10
|
+
|
|
11
|
+
## مستندات فارسی
|
|
12
|
+
|
|
13
|
+
- **[راهنمای کامل استفاده](docs/fa/usage.md)**
|
|
14
|
+
- **[راهنمای انتشار npm](docs/fa/publishing.md)**
|
|
15
|
+
|
|
16
|
+
## نصب
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install balebaazoo
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## شروع سریع
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { Bot, InlineKeyboard } from "balebaazoo";
|
|
26
|
+
|
|
27
|
+
const bot = new Bot(process.env.BOT_TOKEN!);
|
|
28
|
+
|
|
29
|
+
bot.command("start", (ctx) =>
|
|
30
|
+
ctx.reply("سلام! به بازو خوش آمدید 👋", {
|
|
31
|
+
reply_markup: new InlineKeyboard().text("درباره ما", "about"),
|
|
32
|
+
}),
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
bot.on("callback_query:data", async (ctx) => {
|
|
36
|
+
await ctx.answerCallbackQuery();
|
|
37
|
+
await ctx.reply("اطلاعات بیشتر...");
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
bot.start();
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## ویژگیها
|
|
44
|
+
|
|
45
|
+
- **Type-safe** — تایپهای کامل TypeScript برای API و handlerها
|
|
46
|
+
- **Middleware** — سیستم middleware و `Composer` برای ساختار ماژولار
|
|
47
|
+
- **Filter queries** — `message:text`، `callback_query:data`، `pre_checkout_query` و ...
|
|
48
|
+
- **Shortcuts** — `ctx.reply()`، `ctx.replyWithPhoto()`، `ctx.answerCallbackQuery()`
|
|
49
|
+
- **Polling و Webhook** — `bot.start()` و `webhookFromJson()`
|
|
50
|
+
- **Bale-native** — `askReview`، `inquireTransaction`، کیفپول، Markdown بله
|
|
51
|
+
- **بدون dependency** — فقط Node.js 18+ با fetch بومی
|
|
52
|
+
|
|
53
|
+
## مثالها
|
|
54
|
+
|
|
55
|
+
- [`examples/echo-bot.ts`](examples/echo-bot.ts)
|
|
56
|
+
- [`examples/inline-keyboard.ts`](examples/inline-keyboard.ts)
|
|
57
|
+
- [`examples/payment-bot.ts`](examples/payment-bot.ts)
|
|
58
|
+
- [`examples/webhook-server.ts`](examples/webhook-server.ts)
|
|
59
|
+
|
|
60
|
+
## توسعه
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm install
|
|
64
|
+
npm run build
|
|
65
|
+
npm test
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## لایسنس
|
|
69
|
+
|
|
70
|
+
GPL-3.0-or-later
|