Class CommandHandler
java.lang.Object
io.micronaut.chatbots.telegram.core.CommandHandler
- All Implemented Interfaces:
- Handler<TelegramBotConfiguration,,- Update, - SendMessage> - TelegramHandler<SendMessage>,- io.micronaut.core.order.Ordered
Abstract class to make easy to respond static content for a Telegram Bot command.
- Since:
- 1.0.0
- Author:
- Sergio del Amo
- 
Field SummaryFields inherited from interface io.micronaut.core.order.OrderedHIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedCommandHandler(TelegramSlashCommandParser slashCommandParser, TextResourceLoader textResourceLoader, SpaceParser<Update, Chat> spaceParser) 
- 
Method SummaryModifier and TypeMethodDescriptionbooleancanHandle(@Nullable TelegramBotConfiguration bot, @NonNull @NotNull Update input) Returns true if the handler can dispatch the current request.abstract @NonNull StringintgetOrder()@NonNull Optional<SendMessage>handle(@Nullable TelegramBotConfiguration bot, @NonNull @NotNull Update input) Handles the request.
- 
Constructor Details- 
CommandHandlerprotected CommandHandler(TelegramSlashCommandParser slashCommandParser, TextResourceLoader textResourceLoader, SpaceParser<Update, Chat> spaceParser) 
 
- 
- 
Method Details- 
getCommand- Returns:
- A slash command. E.g. /help
 
- 
canHandlepublic boolean canHandle(@Nullable @Nullable TelegramBotConfiguration bot, @NonNull @NotNull @NonNull @NotNull Update input) Description copied from interface:HandlerReturns true if the handler can dispatch the current request.- Specified by:
- canHandlein interface- Handler<TelegramBotConfiguration,- Update, - SendMessage> 
- Parameters:
- bot- bot being asked to handle this command
- input- input to the request handler
- Returns:
- true if the handler is capable of handling the current request
 
- 
handle@NonNull public @NonNull Optional<SendMessage> handle(@Nullable @Nullable TelegramBotConfiguration bot, @NonNull @NotNull @NonNull @NotNull Update input) Description copied from interface:HandlerHandles the request.- Specified by:
- handlein interface- Handler<TelegramBotConfiguration,- Update, - SendMessage> 
- Parameters:
- bot- bot being asked to handle this command
- input- input to the request handler
- Returns:
- output from the handler. Empty if you want to respond asynchronously.
 
- 
getOrderpublic int getOrder()- Specified by:
- getOrderin interface- io.micronaut.core.order.Ordered
 
 
-