Telegram Bot API based on Spring Reactor
- Java 21
- WebClient
- Mono and Flux
Currently, code/package structure is not finalized. Pretty raw implementations
- Bot Commands
- Bot Info
- Webhook
- getUpdates
- Updating messages
- getChat
- sendMessage
- sendDocument
- sendAnimation
- sendPhoto
- forwardMessage
- setMessageReaction
- answerCallbackQuery
application.yml
telegram:
bots:
- name: example_bot # unique | required |
token: 5151515151:ask-bot-father # required | bot token from BotFather
- name: other_bot
token: 0101010101:ask-bot-father
@Slf4j
@Component
@RequiredArgsConstructor
public class Example {
private final BotFactory botFactory;
public void sayHello(String recipientId) {
Optional<Bot> testBot = botFactory.get("test_bot");
testBot.ifPresent(bot ->
bot.sendMessage(recipientId)
.setText("Hello 👋")
.subscribe(response ->
log.info("Said hello to {}, is Ok {}", recipientId, response.isOk())
));
}
}
This is implementation of Telegram Bot API. Here build and executes all requests to Telegram.
This layer uses method DTOs from com.motokyi.tg.bot_api.api.method.payload
package
This is abstraction built on top of Client. It allows to use chained construction to setup requests to Bot Api
This layer uses methods from com.motokyi.tg.bot_api.api.method
package. These methods are DTOs enhanced with the
ability to self-execution and chained setters.