java.lang.Object
org.telegram.telegrambots.extensions.bots.commandbot.CommandMessage

public class CommandMessage extends Object
Author:
Varun Singh This class adds argument functionality to a given message that a user typed, that also counts as a command
  • Constructor Details

    • CommandMessage

      public CommandMessage(org.telegram.telegrambots.meta.api.objects.Message msg)
      Constructor for CommandMessage
      Parameters:
      msg - The message that represents the command that the user typed Preconditions: msg.isCommand() is true msg.hasText() is true Postcondition: The developer has the ability to determine which command the message is executing
  • Method Details

    • getCommandMessage

      public org.telegram.telegrambots.meta.api.objects.Message getCommandMessage()
    • getMessageText

      public String getMessageText()
      Returns:
      the String representation of the message for ease
    • getArgs

      public String[] getArgs()
      Separates the given text after the command into an ordered array of arguments
      Returns:
      each argument as a String item in an array
    • getCommandText

      public String getCommandText()
      Returns:
      the text of the command WITHOUT the slash For example, if /language English
    • getCommandText

      public String getCommandText(boolean includeHandle)
      Returns:
      The text of the message from and including the '/' to the space, which assumes the end of the command name and start of the command arguments
    • getArgsStr

      public String getArgsStr()
      Singles out the text of the message after the command
      Returns:
      all the arguments grouped in one string