Skip to content

$awaitComponents

$awaitComponents awaits components for given amount of uses.

Usage

$awaitComponents[channelID;messageID;userFilter;customIDs;commands;awaitedCmd;uses?;time]

Parameters

FieldTypeDescriptionRequired
channelIDnumberChannel ID of the message where it will be awaited.true
messageIDnumberThe ID of the message that will be awaited.true
userFilterstringUsers who can use the interaction.
1. everyone
2. specific user ID - any user ID.
true
customIDnumberCustom IDs that will be awaited, use , for multiple custom IDs.true
commandsstringThe new interaction names to be used in interaction commands for the awaited customIDs, use , for multiple awaited commands.true
awaitedCmdstringAwaited command to execute if time ran out.true
uses?numberThe times the awaited interactions can be used (default 1).false
timestringThe duration for which the interaction can be used.true

Example(s)

This will send a message with a button. It will wait for 30 seconds for the button to be clicked, examplebuttonresults will be executed if the button has been clicked before the time runs out, otherwise errormessage will be executed:

1
client.command({
2
name: "awaitComponents",
3
code: `$awaitComponents[$channelID;$get[messageID];$authorID;examplebutton;examplebuttonresults;errormessage;1;30s]
4
$let[messageID;$sendMessage[Please click on the button.{actionRow:{button:Random Button:2:examplebutton:false}};true]]`
5
});
6
7
client.interactionCommand({
8
name: "examplebuttonresults",
9
prototype: "button",
10
code: `$interactionReply[You clicked the button!]`
11
});
12
13
client.awaitedCommand({
14
name: "errormessage",
15
code: `$editMessage[$get[messageID];Too late! Time has ran out!{actionRow:{button:Random Button:2:examplebutton:true}};$channelID]`
16
});