Awaited Commands

Awaited commands are a special type of command where the bot waits for the user's response.

end result

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, if user ID is not given.
  • channel ID - The channel id where the command should be awaited. Uses current channel, if channel 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, keep filter 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

    Screenshot_20220812_204604 Screenshot_20220812_204552 Screenshot_20220812_205309

  • Choice Filter

    Screenshot_20220813_072224 Screenshot_20220813_072236 Screenshot_20220813_072322 Screenshot_20220813_072131

    ⚠️ The above example requires BDScript 2 since it contains $elseif.

  • Numeric Filter

    Screenshot_20220812_211213 Screenshot_20220812_211252 Screenshot_20220812_211311 Screenshot_20220812_211155