TDLightTelegramBots/telegrambots-spring-boot-starter
chmilevfa ad3dbfdd58 Merge branch 'dev' into java9-support
# Conflicts:
#	telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/bot/AbilityBot.java
#	telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/EndUser.java
#	telegrambots-abilities/src/main/java/org/telegram/abilitybots/api/objects/MessageContext.java
#	telegrambots-spring-boot-starter/src/main/java/org/telegram/telegrambots/starter/TelegramBotStarterConfiguration.java
#	telegrambots/src/main/java/org/telegram/telegrambots/bots/DefaultBotOptions.java
2018-07-16 19:37:30 +02:00
..
src Merge branch 'dev' into java9-support 2018-07-16 19:37:30 +02:00
pom.xml Merge pull request #451 from AzZureman/proxy-feature 2018-07-16 13:28:44 +03:00
README.md Spring Boot autoconfiguration improvements. 2018-06-09 15:06:38 -03:00

abilitybots

Build Status Jitpack JavaDoc Telegram ghit.me

Usage

Maven

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

Gradle

    compile "org.telegram:telegrambots-spring-boot-starter:3.6.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(MusicUploaderApplication.class, args);
	}
}

After that your bot will look like:

  //Standart 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.