Telebof
Easy and modern Java Telegram bot API
Install / Use
/learn @natanimn/TelebofREADME
<p align="center">Telebo<i>f</i></p>
<p align="center">Easy and modern Telegram Bot API for Java </p>
<p align="center"> <a href="https://github.com/natanimn/telebof/releases"> <img src="https://img.shields.io/github/v/release/natanimn/telebof?color=blue&label=Version" alt="Latest Release"> </a> <a href="https://github.com/natanimn/telebof/blob/main/LICENSE"> <img src="https://img.shields.io/github/license/natanimn/telebof?color=green" alt="License"> </a> <a href="https://t.me/telebofchat"> <img src="https://img.shields.io/badge/Telegram-Support%20Group-blue?logo=telegram" alt="Telegram Support"> </a> <a href="https://github.com/natanimn/telebof/stargazers"> <img src="https://img.shields.io/github/stars/natanimn/telebof?color=yellow&label=Stars" alt="GitHub Stars"> </a> </p><p align='center'>Supported 9.5 BotAPI</b>
Overview
Telebof is easy and modern Java library for building Telegram bots using the Telegram Bot API.
Installation
Maven
Add the following dependency to your pom.xml:
<dependency>
<groupId>io.github.natanimn</groupId>
<artifactId>telebof</artifactId>
<version>1.5.0</version>
</dependency>
Gradle
Add the following to your build.gradle:
implementation 'io.github.natanimn:telebof:1.5.0'
Quick Start: Your First Echo Bot
import io.github.natanimn.telebof.BotClient;
public class MyFirstEchoBot {
static final String TOKEN = "YOUR_BOT_TOKEN_HERE"; // Get from @BotFather
public static void main(String[] args) {
final BotClient bot = new BotClient(TOKEN);
// Handle /start command
bot.onMessage(filter -> filter.commands("start"), (context, message) -> {
context.sendMessage(message.getChat().getId(), "Welcome to my echo bot! 👋").exec();
});
// Echo any text message
bot.onMessage(filter -> filter.text(), (context, message) -> {
context.sendMessage(message.getChat().getId(), "You said: " + message.getText()).exec();
});
bot.startPolling(); // Start the bot
}
}
Using annotation
import io.github.natanimn.telebof.annotations.MessageHandler;
import io.github.natanimn.telebof.BotContext;
import io.github.natanimn.telebof.types.Message;
import io.github.natanimn.telebof.enums.MessageType;
import io.github.natanimn.telebof.BotClient;
public class MyFirstEchoBot {
static final String TOKEN = "YOUR_BOT_TOKEN_HERE"; // Get from @BotFather
public static void main(String[] args) {
final BotClient bot = new BotClient(TOKEN);
bot.addHandler(new MyFirstEchoBot());
bot.startPolling();
}
@MessageHandler(commands = "start")
void start(BotContext context, Message message){
context.sendMessage(message.getChat().getId(), "Welcome to my echo bot! 👋").exec();
}
@MessageHandler(type = MessageType.TEXT, priority = 1)
void echo(BotContext context, Message message){
context.sendMessage(message.getChat().getId(), "You said: " + message.getText()).exec();
}
}
To get started:
- Create a bot with @BotFather on Telegram
- Replace
YOUR_BOT_TOKEN_HEREwith your actual bot token - Run the code and send a message to your bot!
Documentation
Full Library Documentation
Visit our comprehensive documentation at:
https://natanimn.github.io/telebof
API Reference
Detailed API reference available at:
https://natanimn.github.io/telebof-api
Advanced Example: Inline Keyboard Bot
import io.github.natanimn.telebof.BotClient;
import io.github.natanimn.telebof.types.keyboard.InlineKeyboardButton;
import io.github.natanimn.telebof.types.keyboard.InlineKeyboardMarkup;
public class AdvancedBot {
public static void main(String[] args) {
final BotClient bot = new BotClient(TOKEN);
bot.onMessage(filter -> filter.commands("start"), (context, message) -> {
var keyboard = new InlineKeyboardMarkup();
keyboard.addKeyboard(new InlineKeyboardButton("Option 1", "opt1"));
keyboard.addKeyboard(new InlineKeyboardButton("Option 2", "opt2"));
context.sendMessage(message.getChat().getId(), "Choose an option:")
.replyMarkup(keyboard)
.exec();
});
bot.onCallback(filter -> filter.callbackData("opt1", "opt2"), (context, callback) -> {
context.answerCallbackQuery(callback.getId(), "Option selected!").exec();
});
bot.startPolling();
}
}
Community and Support
Official Channels
- Support Group: Join our Telegram group for help and discussions
- News Channel: Follow our channel for updates and announcements
Getting Help
- Documentation: Check our comprehensive docs first
- GitHub Discussions: Ask questions in our community forum
- Issue Tracker: Report bugs or request features
Share Your Bot
Want your bot to be featured in our examples?
Requirements: Public source code<br>
How to submit: Make a pull request with your bot implementation!
Contributing
We welcome contributions from the community! Here's how you can help:
Ways to Contribute
- Code Contributions: Implement new features or fix bugs
- Documentation: Improve documentation and examples
- Testing: Help test new features and report issues
- Examples: Create and share example bots
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support the Project
If you find Telebof useful, please consider:
- ⭐ Star the repository on GitHub
- 🐛 Report issues and help improve the library
- 💬 Join our community and help other developers
- 📢 Share with others who might find it useful
Related Skills
node-connect
347.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.0kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
