Skip to content

    Scripting

    Store values, branch on conditions, and loop over lists inside a response.

    Scripting is what turns a fixed response into one that reacts to who is reading it. On top of plain variables, you get four block types: output a value, store a value, branch on a condition, and loop over a list.

    Regular variable block

    Outputs a value inline by referencing a variable, such as a user's name or dynamic data.

    Accepted types: text, number, url, id

    {_}

    Examples

    InputOutput
    Hello, {user.display_name}!
    Hello, Sarah!
    You have {user.entries} entries in this giveaway.
    You have 4 entries in this giveaway.
    This giveaway is hosted in {channel.name}.
    This giveaway is hosted in #giveaways.

    Set variable block

    Defines and stores a value that can be referenced and reused later in your content.

    Accepted types: all types

    {% set _ = _ %}

    Examples

    InputOutput
    {% set host = gw.host %}
    This giveaway was started by {host}.
    This giveaway was started by @Sarah.
    {% set prize = gw.prize %}
    {% set winners = gw.winners %}
    Win {prize} — {winners} winner(s) will be drawn!
    Win Nitro Classic — 2 winner(s) will be drawn!
    {% set server = server.name %}
    Welcome to {server}'s giveaway!
    Welcome to Acme's giveaway!

    Conditional block

    Displays different content based on a condition, branching between outcomes with if/else logic.

    Accepted types: all types

    {% if _ %}
    action A
    {% else %}
    action B
    {% endif %}

    Examples

    InputOutput
    {% if gw.locked %}
    This giveaway is currently locked.
    {% else %}
    {gw.entry_mode} the {gw.reaction} to enter!
    {% endif %}
    This giveaway is currently locked.
    {% if gw.msg_req %}
    You need {gw.msg_req} messages to enter.
    {% else %}
    No message requirement — anyone can enter!
    {% endif %}
    You need 100 messages to enter.
    {% if channel.nsfw %}
    This channel is NSFW.
    {% else %}
    Open to all members. 
    {% endif %}
    Open to all members.

    Loop block

    Iterates over a collection and repeats a block of content for each item.

    Accepted types: list, collection

    {% for _ in _ %}
    action A
    {% endfor %}

    Examples

    InputOutput
    {% for winner in user.mentions %}
    🎉 Congratulations {winner}!
    {% endfor %}
    🎉 Congratulations @Sarah!
    🎉 Congratulations @John!
    🎉 Congratulations @Amy!
    Required roles to enter:
    {% for role in gw.role_req %}
    - <@&{role}>
    {% endfor %}
    Required roles to enter:
    - @Member
    - @Verified
    {% for nick in user.nicks %}
    - {nick}
    {% endfor %}
    - S-Dawg
    - Johnny
    - Pond