Skip to content

$setTimeout

$setTimeout will set a timeout for a given action (which will even continue to run after bot restart).

Usage

$setTimeout[awaitedCmd;duration;timeoutData;returnId?;pulse?]

Parameters

FieldTypeDescriptionRequired
awaitedCmdstringAwaited command to execute after duration ends.true
durationstring, numberAfter how much time it will execute / this cannot go over 21 days.true
timeoutDataobjectTimeout data.true
returnId?booleanReturn timeout ID.false
pulse?numberPulse.false
  • You can retrieve timeout data using $timeoutData[name].
  • Note that the duration may not go over 21 days.

Example(s)

This will send “Hello!” after 10 seconds in the command execution channel:

1
client.command({
2
name: "setTimeout",
3
code: `
4
$setTimeout[timeoutCommand;10s;{"channelID": "$channelID", "authorID": "$authorID"};false]
5
`
6
});
7
8
client.timeoutCommand({
9
name: "timeoutCommand",
10
code: `
11
$channelSendMessage[$timeoutData[channelID];Hello, <@$timeoutData[authorID]>!]
12
`
13
});