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?]

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
  • You can retrieve timeout data using $timeoutData[name].

Example(s)

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

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