This is template that you can use for your next telegram bot. Template built on Spring Boot and has minimal realization of necessary telegram bot API. It remains only add your business logic.
├── gradle
├── src
│ ├── main.java.ru.mkskoval
│ ├── configuration
│ ├── TelegramBotStarter.java <- 1
│ └── TelegramConfiguration.java <- 2
│ ├── properties
│ └── BotConfiguration.java . . <- 3
│ ├── Bot.java . . . . . . . . . . . <- 4
│ └── Main.java
│ ├── main.resources
│ ├── application.properties . . . . <- 5
│ └── log4j2.xml
├── build.gradle
├── Dockerfile . . . . . . . . . . . . . . <- 6
└── README.md
- Listener for event
ApplicationReadyEventthat register telegram's bot. - Configuration for necessary telegram's API beans.
- ConfigurationProperties for telegram's bot token and your properties too.
- Main class for telegram's bot that keeps logic of request processing.
- Application properties keeps bot token.
- Dockerfile for build your application to docker image.
- Save token to environment variable BOT_TOKEN. For local development only you can write token in application.properties.
- Realize your request processing logic in
Bot.java - Realize rest of your business logic in way you want.
- That's all!