TDLightTelegramBots/telegrambots-spring-boot-st...
Andrea Cavalli 9b8c41dab1 Merge remote-tracking branch 'github/master' 2023-11-02 10:54:50 +01:00
..
src Merge remote-tracking branch 'github/master' 2023-11-02 10:54:50 +01:00
README.md API Version 6.8 2023-08-19 18:40:14 +01:00
pom.xml Merge remote-tracking branch 'github/master' 2023-11-02 10:54:50 +01:00

README.md

abilitybots

Build Status Jitpack JavaDoc Telegram ghit.me

Usage

Maven

    <dependency>
        <groupId>org.telegram</groupId>
        <artifactId>telegrambots-spring-boot-starter</artifactId>
        <version>6.8.0</version>
    </dependency>

Gradle

    implementation 'org.telegram:telegrambots-spring-boot-starter:6.8.0'

Motivation

If you are spring boot user it`s better to be in touch with spring starters. This module allows to register bots in spring context automatically and also use them as standard spring beans.

How to use

Your main spring boot class should look like this:

@SpringBootApplication
public class YourApplicationMainClass {

	public static void main(String[] args) {		
		SpringApplication.run(YourApplicationMainClass.class, args);
	}
}

After that your bot will look like:

  //Standard Spring component annotation
  @Component
  public class YourBotName extends TelegramLongPollingBot {
    //Bot body.
  }

Also you could just implement LongPollingBot or WebHookBot interfaces. All this bots will be registered in context and connected to Telegram api.