Class CommandEvent

java.lang.Object
tv.phantombot.event.Event
tv.phantombot.event.command.CommandEvent

public class CommandEvent extends Event
  • Constructor Details

    • CommandEvent

      public CommandEvent(String sender, String command, String arguments)
      Class constructor for this event without tags. Always send tags if you can.
      Parameters:
      sender -
      command -
      arguments -
    • CommandEvent

      public CommandEvent(String sender, String command, String arguments, Map<String,String> tags)
      Class constructor for this event.
      Parameters:
      sender -
      command -
      arguments -
      tags -
  • Method Details

    • parseArgs

      public static List<String> parseArgs(String arguments, char delimiter, int limit, boolean limitNoEscape)
      Method that parses the command arguments. Double quotes can be used to prevent an argument containing the delimiter from splitting. Double quotes that are literals can be escaped with backslash. Backslash requires escaping with another backslash.
      Parameters:
      arguments - The arguments as a single string
      delimiter - The delimiter by which arguments are split. Can be any char except double-quote or backslash
      limit - The maximum number of arguments to return. -1 indicates unlimited. Once limit is reached, the delimiter is automatically escaped
      limitNoEscape - If set true and limit > 0, the argument at position limit is treated as a literal string, as if all quotes, backslashes, and delimiters are already escaped
      Returns:
      A List<String> of arguments
    • isCommand

      public static boolean isCommand(TMIMessage message)
      Indicates if the given message appears to be a command, defined as exclamation point ! followed by any character except for a space
      Parameters:
      message - The message to check
      Returns:
      true if the message appears to be a command; false if nick or parameters is null, or the message does not appear to be a command
    • isCommand

      public static boolean isCommand(String message)
      Indicates if the given message appears to be a command, defined as exclamation point ! followed by any character except for a space
      Parameters:
      message - The message to check
      Returns:
      true if the message appears to be a command
    • asCommand

      public static CommandEvent asCommand(String sender, String message, Map<String,String> tags)
      Converts the given message into a CommandEvent
      Parameters:
      sender - The sender of the message
      message - The message to convert
      tags - Any IRCv3 tags attached to the message
      Returns:
      null if isCommand(java.lang.String) returns false; otherwise a CommandEvent
    • handeled

      public void handeled()
      Marks this command as handeled
    • isHandeled

      public boolean isHandeled()
      Indicates if this command has been handeled
      Returns:
      true if handeled
    • getSender

      public String getSender()
      Method that will return the sender of this command.
      Returns:
      sender
    • getCommand

      public String getCommand()
      Method that will return the command name.
      Returns:
    • getArguments

      public String getArguments()
      Method that will return the string of arguments.
      Returns:
      arguments
    • getArgs

      public String[] getArgs()
      Method that will return the array of arguments.
      Returns:
      args
    • getTags

      public Map<String,String> getTags()
      Method that returns the IRCv3 tags in a map.
      Returns:
      tags
    • toString

      public String toString()
      Method that returns this object as a string.
      Overrides:
      toString in class Object
      Returns: