Interface ICommandRegistry
- All Known Implementing Classes:
CommandLongPollingTelegramBot,CommandRegistry,TelegramWebhookCommandBot
public interface ICommandRegistry
This Interface represents the gateway for registering and deregistering commands.
- Author:
- Timo Schulz (Mit0x2)
-
Method Summary
Modifier and TypeMethodDescriptionbooleanderegister(IBotCommand botCommand) deregister a commandderegisterAll(IBotCommand... botCommands) deregister multiple commandsgetRegisteredCommand(String commandIdentifier) get registered commandget a collection of all registered commandsbooleanregister(IBotCommand botCommand) register a commandregisterAll(IBotCommand... botCommands) register multiple commandsvoidregisterDefaultAction(BiConsumer<TelegramClient, Message> defaultConsumer) Register a default action when there is no command register that match the message sent
-
Method Details
-
registerDefaultAction
Register a default action when there is no command register that match the message sent- Parameters:
defaultConsumer- Consumer to evaluate the message
-
register
register a command- Parameters:
botCommand- the command to register- Returns:
- whether the command could be registered, was not already registered
-
registerAll
register multiple commands- Parameters:
botCommands- commands to register- Returns:
- map with results of the command register per command
-
deregister
deregister a command- Parameters:
botCommand- the command to deregister- Returns:
- whether the command could be deregistered, was registered
-
deregisterAll
deregister multiple commands- Parameters:
botCommands- commands to deregister- Returns:
- map with results of the command deregistered per command
-
getRegisteredCommands
Collection<IBotCommand> getRegisteredCommands()get a collection of all registered commands- Returns:
- a collection of registered commands
-
getRegisteredCommand
get registered command- Returns:
- registered command if exists or null if not
-