Interface CommandBot
-
- All Known Implementing Classes:
TelegramLongPollingCommandBot,TelegramWebhookCommandBot
public interface CommandBotThis interface represents common functions for command bots- Author:
- Andrey Korsakov (loolzaaa)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleanfilter(org.telegram.telegrambots.meta.api.objects.Message message)Override this function in your bot implementation to filter messages with commandsdefault voidprocessInvalidCommandUpdate(org.telegram.telegrambots.meta.api.objects.Update update)This method is called when user sends a not registered command.voidprocessNonCommandUpdate(org.telegram.telegrambots.meta.api.objects.Update update)Process all updates, that are not commands.
-
-
-
Method Detail
-
processNonCommandUpdate
void processNonCommandUpdate(org.telegram.telegrambots.meta.api.objects.Update update)
Process all updates, that are not commands.- Parameters:
update- the update
-
processInvalidCommandUpdate
default void processInvalidCommandUpdate(org.telegram.telegrambots.meta.api.objects.Update update)
This method is called when user sends a not registered command. By default it will just call processNonCommandUpdate(), override it in your implementation if you want your bot to do other things, such as sending an error message- Parameters:
update- Received update from Telegram
-
filter
default boolean filter(org.telegram.telegrambots.meta.api.objects.Message message)
Override this function in your bot implementation to filter messages with commandsFor example, if you want to prevent commands execution incoming from group chat: # # return !message.getChat().isGroupChat(); #
- Parameters:
message- Received message- Returns:
- true if the message must be ignored by the command bot and treated as a non command message, false otherwise
-
-