🎉 Tickety V3 has now been released! Read more →
PlaceholdersParsers

Union Parser

The Union Parser returns one of two messages depending on whether any of the conditions you list is true.

The Union Parser tests a list of conditions and returns your first message as soon as one of them passes. Use the Logical Parser when every condition has to pass instead.

Usage

To use the parser, insert the following syntax in your text:

{union(expression|expression|...):trueMessage|falseMessage}

  • You can also reference this parser using the aliases: any, or

Separate the conditions with a pipe. Each condition is written the same way as an If Parser condition, so ==, !=, >, <, >= and <= all work, and any placeholder available in that message can be used inside one.

Examples

  1. Matching any of several answers:
  • Input: {union({args.raw}==hi|{args.raw}==hello|{args.raw}==hey):Hello {member.displayName}!|I did not catch that.}
  • With {args.raw} set to hello: Hello NotDemo!
  • With {args.raw} set to good morning: I did not catch that.
  1. Either of two roles:
  • Input: {union({contains(111):{member.roles}}|{contains(222):{member.roles}}):Staff tools are open to you.|Ask a staff member for help.}
  • Output for a member holding either role: Staff tools are open to you.
  • Output for everyone else: Ask a staff member for help.
  1. Either end of a range:
  • Input: {union({guild.memberCount}<100|{guild.memberCount}>10000):Thanks for being here.|Welcome to the server.}
  • Output at 40 members: Thanks for being here.
  • Output at 4000 members: Welcome to the server.
  1. Nothing when no condition passes:
  • Input: {union({args.raw}==help|{args.raw}==support):Open a ticket with /new and a staff member will pick it up.}
  • Output when the member typed help or support: Open a ticket with /new and a staff member will pick it up.
  • Output for anything else: nothing at all.

Available Parameters

ParameterDescriptionDefaultExample
expressionA condition to test. Repeat it, separated by a pipe, to test several at once (required)-{args.raw}==hi
trueMessageReturned when at least one condition passes (required)-Hello!
falseMessageReturned when every condition failsemptyNo match.

Notes

  • Conditions are read from left to right and the true message is returned as soon as one of them passes.
  • Comparisons are made on text, so Yes and yes are different values. Run the value through the String Format Parser first if casing should be ignored.
  • A condition written as true or false is used as it stands, which is what makes parsers such as contains work inside one.
  • A condition with no comparison operator in it always counts as passing.
  • Leave the pipe out of the payload and a failed test produces nothing.
  • To use a pipe as ordinary text inside a message, write it as \|.

On this page