TDLightTelegramBots/telegrambots-spring-boot-starter
Andy Costanza 3c5163990b feat(spring boot): Upgrade spring boot dependency to 2.3.2.RELEASE
I'll fix UT too because in Spring Boot 2.3.X, ApplicationContextRunner
disables bean overriding by default. To enable it, I set
withAllowBeanDefinitionOverriding to
true.

https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.3-Release-Notes#applicationcontextrunner-disables-bean-overriding-by-default
for more informations
2020-08-11 12:29:35 +02:00
..
src feat(spring boot): Upgrade spring boot dependency to 2.3.2.RELEASE 2020-08-11 12:29:35 +02:00
pom.xml feat(spring boot): Upgrade spring boot dependency to 2.3.2.RELEASE 2020-08-11 12:29:35 +02:00
README.md Fixes #767, #766, #761, #763, #776, #772, #771, #780 2020-08-01 12:49:46 +01:00

abilitybots

Build Status Jitpack JavaDoc Telegram ghit.me

Usage

Maven

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

Gradle

    compile "org.telegram:telegrambots-spring-boot-starter:4.9.1"

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) {
	    //Add this line to initialize bots context
		ApiContextInitializer.init();
		
		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.