Interface ICommandRegistry

  • All Known Implementing Classes:
    CommandRegistry, TelegramLongPollingCommandBot

    public interface ICommandRegistry
    This Interface represents the gateway for registering and deregistering commands.
    Author:
    Timo Schulz (Mit0x2)
    • Method Detail

      • registerDefaultAction

        void registerDefaultAction​(BiConsumer<org.telegram.telegrambots.meta.bots.AbsSender,​org.telegram.telegrambots.meta.api.objects.Message> defaultConsumer)
        Register a default action when there is no command register that match the message sent
        Parameters:
        defaultConsumer - Consumer to evaluate the message
      • register

        boolean register​(IBotCommand botCommand)
        register a command
        Parameters:
        botCommand - the command to register
        Returns:
        whether the command could be registered, was not already registered
      • registerAll

        Map<IBotCommand,​Boolean> registerAll​(IBotCommand... botCommands)
        register multiple commands
        Parameters:
        botCommands - commands to register
        Returns:
        map with results of the command register per command
      • deregister

        boolean deregister​(IBotCommand botCommand)
        deregister a command
        Parameters:
        botCommand - the command to deregister
        Returns:
        whether the command could be deregistered, was registered
      • deregisterAll

        Map<IBotCommand,​Boolean> deregisterAll​(IBotCommand... botCommands)
        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

        IBotCommand getRegisteredCommand​(String commandIdentifier)
        get registered command
        Returns:
        registered command if exists or null if not