Custom Command
FunctionsMessage Functions

$messageSlice

Extracts a portion of the message arguments, from a specified start position to an optional end position.

Usage

$messageSlice[from;to (optional)]
  • from: The starting index (1-based) of the argument you want to extract.
  • to: (Optional) The ending index (1-based) of the argument you want to extract. If omitted, it slices from from to the end of the message.

Example:

Let's say the message sent is: !!exec a b c d e

!!exec $messageSlice[1]

b c d e

In this example, $messageSlice[1] extracts arguments from index 1 to the end, resulting in b c d e. Remember that arguments are separated by spaces, and the command itself (!!exec in this case) is not included.


Another Example:

Using the same message: !!exec a b c d e

!!exec $messageSlice[1;2]

b c

Here, $messageSlice[1;2] extracts arguments from index 1 to index 2, resulting in b c.

Function difficulty: Easy

Tags: Slice Message

On this page