Welcome to the Telegraf-Telegram-Bot repository! This project provides a framework for building Telegram bots using Telegraf.js, a modern, flexible, and lightweight library for interacting with the Telegram Bot API.
- Full Telegram Bot API support: Easily access all features of the Telegram Bot API.
- Middleware architecture: Handle updates efficiently with powerful middleware.
- Extensive plugins: Integrate with various services and platforms using Telegraf plugins.
- TypeScript support: Write your bots in TypeScript for enhanced type safety.
- Easy deployment: Deploy your bots to platforms like AWS Lambda, Firebase, and more.
To get started with Telegraf-Telegram-Bot, you need to have Node.js installed. Then, install the required dependencies:
npm install telegrafOr using Yarn:
yarn add telegrafHere’s a simple example to get your bot up and running:
const { Telegraf } = require('telegraf');
const bot = new Telegraf('YOUR_BOT_TOKEN');
bot.start((ctx) => ctx.reply('Welcome!'));
bot.help((ctx) => ctx.reply('Send me a command!'));
bot.on('text', (ctx) => ctx.reply('Hello World!'));
bot.launch();Replace YOUR_BOT_TOKEN with the token you get from BotFather.
Telegraf-Telegram-Bot allows you to create bots that can handle various types of messages, including text, stickers, and commands. Here are some of the things you can do:
- Text Messages: Respond to text messages from users.
- Commands: Create custom commands for your bot.
- Event Handling: Handle different events such as joining a chat or receiving media files.
You can also configure webhooks, handle errors gracefully, and extend your bot with custom middleware. For more advanced usage, please refer to the Telegraf documentation.
Contributions are welcome! Please fork the repository and submit a pull request with your improvements.
This project is licensed under the MIT License. See the LICENSE file for details.
Thanks to the developers of Telegraf.js for creating an excellent library for building Telegram bots.