UtilitiesDocs

Scripting

Button Code

Write a button straight into a message.

#Structure

There are two ways to write one.

  • {button: …} is a quick button: a link, or a button that's only there to look at. Its pieces are split by &&.
  • {button}$v{…} is button code: a whole button with its own reply. As in embed code, { opens a setting, : goes between its name and value, $v goes between settings and } closes one.
{button: https://utilities.best && Website}
{button}$v{label: Rules}$v{style: blurple}$v{response: Read #rules.}

#Parameters

Only {button} is needed; the rest are optional.

  • {label: text} the text on the button.
  • {style: blurple} its color: blurple, green, grey or red. Grey if left out.
  • {emoji: πŸ‘} an emoji on it.
  • {response: text} the reply when pressed. Can hold variables, embeds and more buttons.
  • {limitation: limited} limited stops it after one press; strict stops every button on the message.
  • {ephemeral: true} only whoever pressed it sees the reply.
  • {author_only: true} only the person the message is for can press it.
  • {url: link} makes a saved button a link. Ignored in a message.

In a message, the reply is stored in the button, so it must be short: about 50 characters, fewer with ephemeral, limitation or author_only. A button that doesn't fit is left out; for more, reply with a saved embed, {response: {embed:rules}}, or use /button create.

#Quick buttons

The pieces of {button: …} go in order, or by name.

Link
  • Link: starting with https:// or http://.
  • Label: the text on it.
  • disabled (optional): can't be pressed.
{button: https://utilities.best && Website}
Colored button
  • Color: blurple (or blue), green, grey (or gray) or red.
  • Label: the text on it.
  • Emoji (optional).
  • disabled (optional): greyed out.

Pressing it does nothing. For one that replies, use button code or a saved button.

{button: green && Open && βœ…}
{button: red && Sold out && disabled}
Named pieces
  • label:, style:, url: and emoji:, in any order.
  • disabled (optional).

The only way to make an emoji-only button, or a link with an emoji.

{button: emoji: πŸ‘ && style: blurple}
{button: url: https://utilities.best && label: Website && emoji: 🌐}

#Variables

A reply's variables are filled in for whoever pressed the button. A quick button's label takes them too.

{button}$v{label: Me}$v{response: You are {user.mention}.}

#Where it works

Every message you write for the bot, and inside embed code: welcome, leave and boost messages, autoresponders, sticky messages, button replies and /send. Up to 25 buttons per message. The button editor's Button code box takes it too, {url} included.

#Frequently asked questions

#Why doesn't my button show up?

Button code that can't be used is left out. Check for:

  • A reply too long to fit (see above).
  • A style other than blurple, green, grey or red. primary and blue only work in quick buttons.
  • {ephemeral: false} or {author_only: false}. Leave them out instead.
  • {author_only: true} in a sticky message or /send, where the message isn't for anyone.

#Why is my quick button sent as text?

A piece didn't read: an unknown color, a link not starting with http, or an emoji after a link's label. Use named pieces to give a link an emoji.

#Who is the person a message is for?

The member in a welcome, leave or boost message, whoever set off an autoresponder, and whoever pressed the button a reply came from. Only they can press an author_only button.

#How do I get the code of a saved button?

Give a saved button's name, or a link to a message in your server for the saved buttons on it.

,button code (name)