$onlyIfStartsWith
Command will only execute if the command message starts with the content in the 2nd field. Otherwise, the function returns the error message.

FUNCTION USAGE

  • $onlyIfStartsWith[message;startsWith;error]

Properties:

  • message - The message/arguments the function will check thru.
  • startsWith - The content the function will check for to start with.
  • error - The error message when the 1st field does not contain the content in the 2nd field. {execute} function can be used in the error message to execute another command on error.

Example 1: Command can only be executed if the message starts with hi

1
bot.Command({
2
name: "say",
3
code: `
4
$onlyIfStartsWith[$message[];hi;the message did not start with \`hi\`]
5
`
6
})
Copied!

Example 2: Command can only be executed if the 3rd argument contains hi

1
bot.Command({
2
name: "say",
3
code: `
4
$onlyIfStartsWith[$message[3];hi;3rd argument needs to contain \`hi\`]
5
`
6
})
Copied!
Last modified 4mo ago
Copy link
Contents
Properties: