@persian-caesar/bale.js
v0.2.0
Published
A powerful library for building Bale messenger bots.
Maintainers
Readme
bale.js
A powerful, discord.js-like library for building Bale messenger bots with TypeScript.
Features
- 🧩 Modular architecture — Client, REST, Structures, Managers, Builders
- 🔄 Dual update modes — Long Polling and Webhook, switchable without code changes
- ⌨️ Fluent builders —
InlineKeyboardBuilder,ReplyKeyboardBuilder,MessageBuilder - 📎 Media support — Photos, documents, videos, audio, voice, with
file_id/ URL / Buffer - 👥 Group management — Ban, promote, pin, invite links
- 💳 Payments & Web Apps — Invoices, pre-checkout queries, mini-app data
- 🛡️ Strictly typed — Full TypeScript definitions with
strictmode
Prerequisites
- Node.js >= 18
- npm >= 9
Installation
npm install bale.jsQuick Start
import { BaleClient, InlineKeyboardBuilder } from 'bale.js';
const client = new BaleClient({
token: process.env.BALE_TOKEN!,
mode: 'polling',
});
client.on('ready', (me) => {
console.log(`Logged in as @${me.username}`);
});
client.on('messageCreate', async (message) => {
if (message.text === '/start') {
const keyboard = new InlineKeyboardBuilder()
.addButton('Click me', { callback_data: 'clicked', color: 'primary' })
.build();
await message.reply('Welcome!', { reply_markup: keyboard });
}
});
client.on('callbackQuery', async (query) => {
await query.answer('Button clicked!');
});
client.login();Documentation
Full API reference is available at https://Persian-Caesar.github.io/bale.js.
Contributing
Contributions are welcome! Please read CONTRIBUTING.md for details.
License
This project is licensed under the MIT License — see the LICENSE file for details.
