Class BotCommand

    • Constructor Detail

      • BotCommand

        public BotCommand​(String commandIdentifier,
                          String description)
        Construct a command
        Parameters:
        commandIdentifier - the unique identifier of this command (e.g. the command string to enter into chat)
        description - the description of this command
    • Method Detail

      • getCommandIdentifier

        public final String getCommandIdentifier()
        Get the identifier of this command
        Specified by:
        getCommandIdentifier in interface IBotCommand
        Returns:
        the identifier
      • getDescription

        public final String getDescription()
        Get the description of this command
        Specified by:
        getDescription in interface IBotCommand
        Returns:
        the description as String
      • processMessage

        public void processMessage​(org.telegram.telegrambots.meta.bots.AbsSender absSender,
                                   org.telegram.telegrambots.meta.api.objects.Message message,
                                   String[] arguments)
        Process the message and execute the command
        Specified by:
        processMessage in interface IBotCommand
        Parameters:
        absSender - absSender to send messages over
        message - the message to process
        arguments - passed arguments
      • execute

        public abstract void execute​(org.telegram.telegrambots.meta.bots.AbsSender absSender,
                                     org.telegram.telegrambots.meta.api.objects.User user,
                                     org.telegram.telegrambots.meta.api.objects.Chat chat,
                                     String[] arguments)
        Execute the command
        Parameters:
        absSender - absSender to send messages over
        user - the user who sent the command
        chat - the chat, to be able to send replies
        arguments - passed arguments