$awaitButton

Wait a button to be pressed and return its button Id, or undefined in case of no button pressed until the timeout.

Tip

This function supports the Message Curl Format. This way, you can send a message with buttons by using {button:label:style/url:emoji:id:newline(yes/no)}.

Usage: $awaitButton[Message (optional);user id (optional, default:author);timeout (optional, default:15s);button id1 (optional);button id2...]


Timeout

It means the maximum time bot can wait user button click for.
it accept format of time like 10s.
The max time is 60 x bot tier seconds, for example for tier 3 it would be 180 seconds.

Examples
Examples

(Simple response)

(Usage example)

$let[pressedButton;$awaitButton[Which color is my favorite?
{button:Green:GREEN::green}
{button:Blue:BLUE::blue}
{button:Red:RED::red};$authorID;15s;red;blue;green]]
/* Saves the pressed button id in a temporary var, so you can retrieve later */

$if[$pressedButton!=red]
Wrong!
$else
Correct!
$endif
/* If the button id is different from red, which is the right answer, then incorrect. Else, correct. */

Choosing something other them red, or nothing.

Choosing red.

Note

You can send an embed using the Message Curl Format.

Function difficulty: Medium
Tags: await button interaction click