$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
Field | Type | Description | Required |
---|---|---|---|
awaitedCmd | string | Awaited command to execute after duration ends. | true |
duration | string, number | After how much time it will execute / this cannot go over 21 days. | true |
timeoutData | object | Timeout data. | true |
returnId? | boolean | Return 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:
1client.command({2 name: "setTimeout",3 code: `$setTimeout[timeoutCommand;10s;{"channelID": "$channelID", "authorID": "$authorID"};false]`,4});5
6client.timeoutCommand({7 name: "timeoutCommand",8 code: `$channelSendMessage[$timeoutData[channelID];Hello, <@$timeoutData[authorID]>!]`9});