$if

checks the expression and executes code inside it if true you can use $elseIf to check other conditions if previous one is false you can use $else to execute code block if nothing is true

  • $endif
  • $else
  • $elseif
  • $elseendif

Usage: See below

Example 1 only with $if

Since the username of the executor is Tom it executed the if block

Tom02/03/2022
!!exec $if[$username==Tom]
Oh, you are Tom!
$endIf
Custom Command Bot 02/03/2022
Oh, you are Tom!
Example 2 only with $if and $else

Since the username is not Tom it executes the else block

Bob02/03/2022
!!exec $if[$username==Tom]
Oh, you are Tom!
$else
You are not Tom!
$endIf
Custom Command Bot 02/03/2022
You are not Tom!
Example 3 $if , $else and $elseif

Since the username is not Tom .It goes to the next if statement ,which is $elseif[$username==Lisa] and it will execute it

Lisa02/03/2022
!!exec $if[$username==Tom]
Oh, you are Tom!
$elseif[$username==Lisa]
You are Lisa!
$endelseIf
$else
I don't know you :C
$endIf
Custom Command Bot 02/03/2022
You are Lisa!
Example 4 $if , $else and $elseif

Since the username is not Tom .It goes to the next if statement ,which is $elseif[$username==Lisa] and it will execute it

Info: The second else if will get never executed ,because it will exit the statement after the first true expression

Lisa02/03/2022
!!exec $if[$username==Tom]
Oh, you are Tom!
$elseif[$username==Lisa]
1.You are Lisa!
$endelseIf
$elseif[$username==Lisa]
2.You are Lisa!
$endelseIf
$else
I don't know you :C
$endIf
Custom Command Bot 02/03/2022
1.You are Lisa!
Example 5 multiplie condtions in if with && or ||

$if[] allows you to have multiplie condtions
|| is for OR
&& is for AND

The Example below will execute since $username==Tom is false but the second expression is true .It wouldn't work with &&

Lisa02/03/2022
!!exec $if[$username==Tom||$username=Lisa]
You are Tom or Lisa
$endIf
Custom Command Bot 02/03/2022
You are Tom or Lisa

The Example will only execute if the username is Lisa and their tag is 9999

Lisa#999902/03/2022
!!exec $if[$username==Lisa&&$discriminator=9999]
You are Lisa with tag 9999
$endIf
Custom Command Bot 02/03/2022
You are Lisa with tag 9999
Function Difficultly: Easy
Tags: if condition decimals