The Java 8 implementation of Telegram's bot API.
public class AwesomoBot {
private static final String TOKEN = "YourTokenHere";
private static final TelegramBot bot = TelegramBot.getInstance(TOKEN);
public static void main(String[] args) throws IOException {
new AwesomoBot().replyWithAwesomeness();
}
public AwesomoBot replyWithAwesomeness() throws IOException {
List<Update> updates = bot.getUpdates();
updates.forEach(update -> {
try {
bot.sendMessage(update.getMessage().getChat().getId(), "You are awesum.");
} catch (IOException e) {
e.printStackTrace();
}
});
return this;
}
}
SendMessage
.to(YourChatIdHere)
.withText("Sexy fluent TelegramBotAPI.")
.fromBot(YourBotTokenHere);