Skip to content
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.

Latest commit

 

History

History
32 lines (29 loc) · 1.4 KB

README.md

File metadata and controls

32 lines (29 loc) · 1.4 KB

JTeleBot

Build Status Dependency Status Download Percentage of issues still open

A Java library for Telegram Bot API

Maven Dependency for Consumers

Add to your pom.xml

<dependency>
	<groupId>me.shib.java.lib</groupId>
	<artifactId>jtelebot</artifactId>
	<version>2.1.2</version>
</dependency>

Example

Start by creating an instance of the me.shib.java.lib.jtelebot.TelegramBot with the API token you get from @BotFather

TelegramBot bot = TelegramBot.getInstance("YourBotApiTokenGoesHere");
Update[] updates;
while((updates = bot.getUpdates()) != null) {
    for (Update update : updates) {
        Message message = update.getMessage();
        if(message != null) {
            bot.sendMessage(new ChatId(message.getChat().getId()), "This is a reply from the bot! :)");
        }
    }
}