The Command object allows you to handle an issued command. Every time any user issues a command, a new Command object is created containing the information required to respond to the command.
- 1 History
- 2 How to use
- 3 Properties
- 4 Functions
- 5 See also
How to use
Example: Get the user who executed the command.
Value = CommandObj.Username
Example: Store a response to the command.
CommandObj.Respond "The response"
List of properties
Returns the username of the person issuing the command, as a string. This is not affected by naming conventions.
Returns the name of the command, as a string. This is the name of the command as defined by the XML, not an alias if that was used.
Returns all of the arguments that are included with command message, as a string. This does not include the trigger, command word, or the first space. This is not parsed in any special way.
Returns all of the arguments that are included with command message, as a collection.
The bot parses a command message according to the CommandDocsObj.Parameters defined in the XML. Each element in the returned collection is a string from the command message. It is of the type of the parameter at that index.
Returns whether the command is being issued from the bot console, as a boolean.
Returns whether the command response will be a public output, as a boolean.
Returns whether the command syntax is correct according to the information provided by the XML, as a boolean.
Returns whether the user issuing the command has enough access and/or flags to use the command, as a boolean. If this command object is the parameter of your Event_Command event, this will always return
True. If it were
False, the event is not called.
Returns whether the user issued the command via whisper, as a boolean.
Numerical value of where the command is coming from and going to (this is compatible with the Dsp function):
- 1 - All Chat
- 2 - Emote
- 3 - Whisper
- 4 - Bot console
Usually, the .Respond function should be called and not the Dsp function. Dsp is provided for backwards compatibility.
List of functions
Returns the value of the specified argument used in the command from the same collection returned by the Arguments property. Pass the name of the parameter as defined in the XML.
Returns a boolean value telling whether an argument failed an XML restriction test. It returns true on success (the argument passed did not violate the rule imposed by the XML restriction) and false on failure. Pass the name of the restriction as defined in the XML.
Returns a collection of the responses already stored for this command.
Call this to send all of the stored responses, if for example the command does something asynchronous and the script writer wishes to send something after Event_Command has exited.
Call this to clear the stored responses.