Overview
The BDScript Checker API validates BDScript/BDFD code for syntax errors and common mistakes. It checks for unknown functions, incorrect argument counts, unclosed blocks, and invalid enum values. This endpoint is made specially for the !run command by BDSuper in the BDFD Support Server.
// Base URL https://api.bdtools.xyz/bdscript-checker
/bdscript-checker
Validates BDFD code for syntax errors and common mistakes. Checks for unknown functions, incorrect argument counts, unclosed blocks, and invalid enum values. Returns a list of errors with line numbers. Function definitions are loaded from a local JSON file for fast validation.
Request Body
{ "code": "$setUserVar[test;1;2;3;4]" }
Validation Checks
- 1. Unknown Functions - Warns if a function doesn't exist in the BDFD function list
- 2. Argument Count - Validates minimum and maximum argument counts
- 3. Unclosed Blocks - Detects unclosed $if, $try, $async blocks
- 4. Bracket Matching - Ensures all brackets are properly closed
- 5. Multiple $else - Detects multiple $else in the same $if block
- 6. Enum Validation - Checks if enum arguments have valid values
- 7. Type Validation - Validates Number, Boolean, and Snowflake types
- 8. Empty Arguments - Checks if empty arguments are allowed
Escape Sequences
The validator properly handles BDFD escape sequences:
-
•
$c[]- Escaped dollar sign (displays$as text) -
•
\;- Escaped semicolon (includes;in argument without splitting) -
•
\]- Escaped closing bracket (includes]in argument) -
•
\\- Escaped backslash (displays\as text) -
•
%{DOL}%- Alternative dollar escape -
•
%{-SEMICOL-}%- Alternative semicolon escape -
•
%ESCAPED%- Alternative bracket escape
Error Sorting
Errors are automatically sorted by line number for easier debugging.
Responses
{ "errors": [ { "function": "$setUserVar", "line": 1, "message": "$setUserVar - Too many arguments, expected up to 4, got 5" } ], "hasErrors": true }
{ "errors": [], "hasErrors": false }
{ "error": "Invalid or missing API key." }
{ "error": "Missing or invalid 'code' field" }
{ "error": "Method not allowed. Use POST." }
{ "error": "Internal server error" }
Example BDFD Usage
$httpAddHeader[Authorization;Bearer BDTools-YOUR_API_KEY_HERE] $httpPost[https://api.bdtools.xyz/bdscript-checker; { "code": "$c[Your BDFD code here] $username $if[$message==hello] $sendMessage[Hi!] $endif" } ]