Skip to content

dortanes/telebot

Repository files navigation

🤖 Telebot

The declarative framework for building push-button Telegram bots with ease.

Telebot is designed for developers who want to build complex, menu-driven Telegram bots without the boilerplate. It provides a fluent, declarative API for menus, automatic navigation, and streamlined conversations.

NPM Version License

✨ Features

  • 🏗️ Declarative Menus: Define your bot's layout using a fluent builder API.
  • 🔄 Automatic Navigation: Nested menus with built-in "Back" buttons.
  • 💬 Linear Conversations: Collect user input easily with ask() and form().
  • 📝 Single-Message Flow: Edits the same message during interaction for a clean chat history.
  • 🔡 Type-Safe: Written in TypeScript with full JSDoc documentation.
  • 🌐 Localization Support: Built-in hooks for i18n.
  • 🛠️ Powered by Grammy: Leverages the speed and reliability of the grammy framework.

🚀 Quick Start

1. Install

npm install @superpackages/telebot grammy

2. Create your bot

import { Telebot } from "@superpackages/telebot";

// Define an action
const greetAction = Telebot.action(async ({ ctx, conversation }) => {
  const name = await conversation.ask("What is your name?");
  await ctx.reply(`Hello, ${name}! Welcome to the bot.`);
});

// Define a menu
const mainMenu = Telebot.menu((layout) => {
  layout.text("Main Menu");
  layout.button("Say Hello").action(greetAction);
  layout.button("External Link").url("https://github.com/dortanes/telebot");
});

// Start the bot
const bot = Telebot.create({
  token: "YOUR_BOT_TOKEN",
  menu: mainMenu,
});

bot.start();

📖 Documentation

Explore the detailed guides:

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📜 License

MIT

About

Declarative Node.js framework for building complex, menu-driven Telegram bots with automatic navigation and linear conversations. Powered by grammy.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors