Awaited Commands
Awaited commands are a special type of command where the bot waits for the user’s response.
Content
Functions Used > Supported Filters > $awaitFunc[] > $awaitedCommand[] > $awaitedCommandError[] > Creating an awaited command
Functions Used
Supported Filters
<numeric>
: Accepts only number input.<word1/word2/...>
: Accepts only specified words provided inside<>
. Use/
as a separator for multiple words.
$awaitFunc
Used to initiate an awaited command.
Syntax
$awaitFunc[Command name;(User ID;Channel ID)]
Parameters
Command name
(Type: String || Flag: Required)
: The name used inside$awaitedCommand[]
and$awaitedCommandError[]
callbacks.User ID
(Type: Snowflake || Flag: Vacantable)
: The user the awaited command will trigger for. Uses command author, ifUser ID
is not given.Channel ID
(Type: Snowflake || Flag: Optional)
: The channel where the command will be awaited. Uses current channel, ifChannel ID
is not given.
Example
$nomention
What do you want me to say?
$awaitFunc[say]
$awaitedCommand
Triggered when an awaited command gets responded to.
$awaitedCommand[]
is a callback, which means it’s used in the command trigger (not the code). The command is only run when an awaited command gets responded to.
Syntax
$awaitedCommand[Name;(Filter)]
Parameters
Name
(Type: String || Flag: Required)
: The name used in$awaitFunc[]
function.Filter
(Type: String || Flag: Emptiable)
: Used to limit user input (Supported filters). If no filter is provided, it accepts any input.
Example
Without filter
Trigger: $awaitedCommand[say;]
$nomention
$message
With choose filter
Trigger: $awaitedCommand[odd;<yes/no/cancel>]
$nomention
$if[$message==yes]
Your answer is correct!
$elseif[$message==no]
Your answer is incorrect!
$elseif[$message==cancel]
Command cancelled!
$endif
With numeric filter
Trigger: $awaitedCommand[odd;<numeric>]
$nomention
You have provided a number: $message
$awaitedCommandError
Triggered when an awaited command doesn’t match with provided filter.
$awaitedCommandError[]
is a callback, which means it’s used in the command trigger (not the code). The command is only run when an awaited command doesn’t match with provided filter.
Syntax
$awaitedCommandError[Name]
Parameters
Name
(Type: String || Flag: Required)
: The name used in$awaitFunc[]
function.
Example
Trigger: $awaitedCommandError[number]
$nomention
Invalid number!
Creating an awaited command
Without filter
- Create two commands with
!say
and$awaitedCommand[say;]
triggers. - Paste the following code:
Code for the !say
command:
$nomention
What do you want me to say?
$awaitFunc[say]
Code for the command with the $awaitedCommand[say;]
trigger:
$nomention
$message
- Execute command
!say
With choose filter
- Create two commands with
!odd
and$awaitedCommand[odd;<yes/no/cancel>]
triggers. - Paste the following code:
Code for the !odd
command:
$nomention
Is '19' an odd number?
$awaitFunc[odd]
Code for the command with the $awaitedCommand[odd;<yes/no/cancel>]
trigger:
$nomention
$if[$message==yes]
Your answer is correct!
$elseif[$message==no]
Your answer is incorrect!
$elseif[$message==cancel]
Command cancelled!
$endif
- Execute command
!odd
With numeric filter
- Create two commands with
!number
and$awaitedCommand[number;<numeric>]
triggers. - Paste the following code:
Code for the !number
command:
$nomention
Provide a number!
$awaitFunc[number]
Code for the command with the $awaitedCommand[number;<numeric>]
trigger:
$nomention
You have provided a number: $message
- Execute command
!number