Awaited Commands
Awaited commands are a special type of command where the bot waits for the user's response.
In the above screenshot, the bot asks the user to provide a number and then checks, if provided value is a number.
Getting Started
To create an awaited command, following function and callbacks are used -
$awaitFunc[]
$awaitFunc
is a function. It's used to initiate an awaited command.
Usage
$awaitFunc[command name;(user ID;channel ID)]
command name
- The name which is used inside$awaitedCommand
and$awaitedCommandError
callback.user ID
- The user the awaited command will trigger for. Uses command author, ifuser ID
is not given.channel ID
- The channel id where the command should be awaited. Uses current channel, ifchannel ID
is not given.
$awaitedCommand[]
$awaitedCommand
is a callback. It gets triggered when an awaited command gets initiated.
Usage
$awaitedCommand[name;(filter)]
name
- The name which is used in$awaitFunc
function.filter
- It is used to limit user input. Supported filters are<numeric>
- Accepts only number input.<word1/word2>
- Accepts only those specified words provided inside<>
. Use/
as separator for multiple words.empty
- Accepts any input from the user. To use this filter, keepfilter
argument empty.
$awaitedCommandError[]
$awaitedCommandError[]
is a callback. It gets triggered when an awaited command doesn't match with provided filter.
Usage
$awaitedCommandError[name]
name
- The name which is used in$awaitFunc
function.
Examples
-
Empty Filter
-
Choice Filter
⚠️ The above example requires BDScript 2 since it contains
$elseif
. -
Numeric Filter