Meta
Differences with BDFD
Most BDFD scripts run unchanged, but a few behaviors differ. Some are extensions, some are deliberate choices kept on purpose, and some are conventions the official BDFD wiki does not specify. Read this page when a script ported from BDFD does not do what it did there.
“Kept” means the difference is intentional and will not be aligned with BDFD.
Differences kept on purpose
| Function | Bot Creator | BDFD wiki |
|---|---|---|
$useChannel in a slash command |
Also redirects the main response; the interaction gets no reply. Use $channelSendMessage[channelID;text] to answer and write elsewhere. |
Does not redirect the response of a slash command. |
$noMention |
Cuts all notifications of the response, including <@id> written on purpose. Add $allowUserMentions[ID] or $allowRoleMentions[ID] to notify someone. |
Only removes the automatic mention of the author; written mentions still notify. |
$removeContains |
Removes a pattern from a text; the form [word;...;amount] is refused. Nothing is deleted from the channel. |
Purges recent messages that contain the words. |
$ignoreTriggerCase |
Accepted, no effect: prefix command names and aliases already ignore case. | Makes triggers case-insensitive (premium). |
$alternativeParsing, $optOff, $disableInnerSpaceRemoval, $disableSpecialEscaping |
Accepted, no effect: their BDFD effect on brackets, semicolons and spaces is not reproduced. | Change how the script is read. |
Slash commands and moderation
$message[option]of auser,channel,roleormentionableoption returns the ID, not the name. Use$username[...],$channelName[...]or$roleName[...]for the name.$message[1],$message[>]and ranges also work in slash commands (they read the option values in order).$banIDand$unBanIDwithout an ID are an error in a slash command (Missing or invalid user ID.). The fallback on the last word of the message only exists in prefix commands. IDs must be decimal digits.$mentionedreturns the command author when nobody is mentioned (historical BDFD default). Write$mentioned[1;no]in guards. Mentions are numbered in the order of the text.$kick[],$kick[;reason]and$bannever fall back to the author.$customIDonly exists in the script run for a click (aninteractionCreateworkflow withcustomIdFilter), never in the slash command; a button is handled by a workflow.$ephemeraland$defer[yes]are decided when the interaction is acknowledged (the engine reads the script first). A script with$newModal,$callWorkflow,$evalor$funcCallis not deferred.$channelSendMessageand$sendEmbedMessageonly send their own channel message; they do not touch the response being built or its flags ($reply,$ephemeral,$nomention,$dm…). The third argument of$channelSendMessage(message to reply to) is an extension.
Reading the script
- Function names are case-insensitive; temporary variable names are case-sensitive.
- Only
\$,\[,\]and\;are escapes. A balanced pair of[]inside an argument keeps its content, semicolons included. - An unknown function is left as text, arguments included (the Manager’s validator reports it as an error).
- Spaces in arguments are kept, not trimmed.
- The whole script is validated before anything runs (arity of every known function, even in a branch not taken).
- A value produced by a variable or an option is never re-read as BDFD. Only
$eval[...]evaluates text.
Structures
$if…$endifis accepted inside the argument of another function. The block closes inside its argument (\;for a literal semicolon). Loops,$try,$jsonForEachand$funcare still refused there.- Conditions: finite decimal numbers are compared exactly as numbers, anything else as text. The operator is searched outside Discord tokens (
<@id>,<#id>…). A condition without an operator that is nottrueorfalseis an error. $async/$endAsync/$await: a block nobody awaits is waited for before the response is sent. 25 blocks per execution.- Limits: 100,000 steps per execution, 128 nested blocks, a shared time budget per invocation.
$scriptLanguagealways returnsBDScript 2.
Extensions
- Autocomplete by script:
$appendOptionSuggestion,$autoCompleteOptionName,$autoCompleteOptionValue. The code is stored with the option instead of an$onAutoComplete[Name]callback; 25 suggestions, 2 seconds. $modifyChannel: an empty argument leaves the field unchanged;!clearerases the topic.$jsonForEach, the 6th argument of$modifyRole(position), and thebdfd.userVariableSemanticssetting for user variables.$membersCount[Presence]needs the privileged Guild Presence intent.
Some conventions have not been checked against a real BDFD bot (spaces in arguments, empty brackets on $else[], semicolons inside a block in an argument). Do not assume identical behavior for those.