Object
BotCommand
All Implemented Interfaces:
IBotCommand
Direct Known Subclasses:
DefaultBotCommand, ManCommand

public abstract class BotCommand extends Object implements IBotCommand
Representation of a command, which can be executed
Author:
Timo Schulz (Mit0x2)
  • Field Details

  • Constructor Details

    • 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 Details

    • 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
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • processMessage

      public void processMessage(TelegramClient telegramClient, Message message, String[] arguments)
      Process the message and execute the command
      Specified by:
      processMessage in interface IBotCommand
      Parameters:
      telegramClient - Client to send messages over
      message - the message to process
      arguments - passed arguments
    • execute

      public abstract void execute(TelegramClient telegramClient, User user, Chat chat, String[] arguments)
      Execute the command
      Parameters:
      telegramClient - Client to send messages over
      user - the user who sent the command
      chat - the chat, to be able to send replies
      arguments - passed arguments