Package tv.phantombot.event.command
Class CommandEvent
java.lang.Object
tv.phantombot.event.Event
tv.phantombot.event.command.CommandEvent
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CommandEvent
Converts the given message into a CommandEventString[]
getArgs()
Method that will return the array of arguments.Method that will return the string of arguments.Method that will return the command name.Method that will return the sender of this command.getTags()
Method that returns the IRCv3 tags in a map.void
handeled()
Marks this command as handeledstatic 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 spacestatic boolean
Indicates if the given message appears to be a command, defined as exclamation point!
followed by any character except for a spaceboolean
Indicates if this command has been handeledMethod that parses the command arguments.toString()
Method that returns this object as a string.
-
Constructor Details
-
CommandEvent
Class constructor for this event without tags. Always send tags if you can.- Parameters:
sender
-command
-arguments
-
-
CommandEvent
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 stringdelimiter
- The delimiter by which arguments are split. Can be any char except double-quote or backslashlimit
- The maximum number of arguments to return. -1 indicates unlimited. Once limit is reached, the delimiter is automatically escapedlimitNoEscape
- 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
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 isnull
, or the message does not appear to be a command
-
isCommand
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
Converts the given message into a CommandEvent- Parameters:
sender
- The sender of the messagemessage
- The message to converttags
- Any IRCv3 tags attached to the message- Returns:
null
ifisCommand(java.lang.String)
returnsfalse
; otherwise aCommandEvent
-
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
Method that will return the sender of this command.- Returns:
- sender
-
getCommand
Method that will return the command name.- Returns:
-
getArguments
Method that will return the string of arguments.- Returns:
- arguments
-
getArgs
Method that will return the array of arguments.- Returns:
- args
-
getTags
Method that returns the IRCv3 tags in a map.- Returns:
- tags
-
toString
Method that returns this object as a string.
-