Skip to content

$loop

$loop will execute awaited commands a given amount of times.

Usage

$loop[time;awaitData;...awaitedCmds]

Parameters

FieldTypeDescriptionRequired
timestringHow often to execute the loop.true
awaitDataobjectAwaited Data.true
…awaitedCmdsstringAwaited Commands to execute.true

Example(s)

This will execute a loop that will edit the sent message 5 times with the given content in awaitData:

1
client.command({
2
name: "loop",
3
code: `
4
$loop[5;{ "message": "$get[messageID]", "channel": "$channelID" };editMessage]
5
$let[messageID;$sendMessage[My ping is: $pingMS;true]]
6
`
7
});

We use $awaitData to retrieve the given properties in the awaitData field in the loop command.

1
client.awaitedCommand({
2
name: "editMessage",
3
code: `
4
$editMessage[$awaitData[message];$pingMS;$awaitData[channel]]
5
$wait[5s]
6
`
7
});