$awaitButton

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

This function supports message curl format

That 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...]


::: details 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[$get[PressedButton]!=red]
Wrong!
$else
Correct!
$endif
/* If the button id is different from red, which is the right answer, them incorrect. Else, correct. */

choosing something other them red, or nothing.

choosing red.

:::

Note

You can send embed using Message Curl Format

Function difficulty: Medium
Tags: await button interaction click