Skip to content

Conditional Logic ({if})

The {if} Statement

The {if} parser evaluates mathematical, string, or boolean conditions and executes different branches based on truthiness:

{if(condition):then|else}

Comparison Operators

OperatorMeaningExample
==Equal to`{if({player.playing}==true):Playing
!=Not equal to`{if({player.volume}!=100):Custom Volume
>Greater than`{if({player.volume}>100):Loud
<Less than`{if({queue.size}<1):Empty
>=Greater than or equal to`{if({player.queueSize}>=10):Large Queue
<=Less than or equal to`{if({user.id}<=0):Invalid

Important Rules & Best Practices

1. Always Use Explicit Boolean Comparisons

Always compare explicitly against true or false:

  • Correct: {if({player.playing}==true):...|...}
  • Avoid: {if({player.playing}):...|...}

2. Wrap Conditionals Inside Embed Tags

Never place multiple {embed} calls inside an {if} statement. Instead, place the {if} inside the embed parameter:

  • Correct: {embed(title):{if({player.playing}==true):Now Playing|Player Idle}}
  • Incorrect: {if({player.playing}==true):{embed(title):Now Playing}|{embed(title):Player Idle}}