Overview
Escape/unescape BDFD special characters and calculate Discord permission bitfields. Accepts JSON or plain text input depending on the endpoint. All endpoints are public and require no authentication.
// Base URL for all tools endpoints https://api.bdtools.xyz/tools
/character-escape
Escapes BDFD special characters ($,
;,
],
\) into safe representations using your choice of escape style per
character. Accepts JSON, returns plain text so the result can be
copy-pasted directly.
Request Body
{ "text": "$hello; world] test\\123", "rules": { "dollar": "a", "semicolon": "a", "bracket": "a" } }
Fields
| Field | Type | Default | Description |
|---|---|---|---|
| text | stringrequired | — | Raw BDScript code to escape. |
| rules.dollar | string |
"a"
|
Escape style for
$.
"a" →
$$c[],
"b" →
%{DOL}%
|
| rules.semicolon | string |
"a"
|
Escape style for
;.
"a" →
\;,
"b" →
%{-SEMICOL-}%
|
| rules.bracket | string |
"a"
|
Escape style for
].
"a" →
\],
"b" →
%ESCAPED%
|
Escape Order
Characters are escaped in a specific order to prevent conflicts:
1. Backslashes first (\ → \\) 2. Semicolons (; → \; or %{-SEMICOL-}%) 3. Closing brackets (] → \] or %ESCAPED%) 4. Dollar signs last ($ → $$c[] or %{DOL}%)
Responses
Content-Type:
text/plain
$$c[]hello\; world\] test\\123
{ "error": "Missing or invalid 'text' field." }
{ "error": "Invalid JSON body." }
{ "error": "Method not allowed. Use POST." }
Example Usage
$httpPost[https://api.bdtools.xyz/character-escape;{"text":"$ping","rules":{"dollar":"a"}}]
/character-unescape
Reverses the escape operation. Accepts raw plain text (not JSON). Pass the escaper output directly as the request body. Both style A and style B patterns are detected and replaced automatically, so you don't need to specify which style was used.
Request
POST /character-unescape
Content-Type: text/plain
$$c[]hello\; world\] test%{DOL}%
Just send the raw escaped text as the body. No JSON wrapper needed.
Unescape Mappings
| Character | Style A Pattern | Style B Pattern |
|---|---|---|
$ |
$$c[] |
%{DOL}%
|
; |
\; |
%{-SEMICOL-}%
|
] |
\] |
%ESCAPED%
|
\ |
\\ |
— |
Mixed-style input is handled fine. Style A and style B patterns can appear in the same string.
Responses
Content-Type:
text/plain
$hello; world] test$
{ "error": "Internal server error." }
Example Usage
$httpPost[https://api.bdtools.xyz/character-unescape;$$c[]hello]
/permissions/calculate
Calculates a Discord permission bitfield from a list of permission
names. Uses BigInt internally so it handles values beyond
Number.MAX_SAFE_INTEGER
correctly. Unknown permission names are silently ignored.
Request Body
{ "permissions": [ "Administrator", "Kick Members", "Ban Members" ] }
Fields
| Field | Type | Description |
|---|---|---|
| permissions | arrayrequired | Array of permission name strings (case-insensitive). |
Supported Permissions (42 total)
// General Server Permissions Create Invite, Manage Server, View Audit Log, View Server Insights, Administrator // Member Management Kick Members, Ban Members, Manage Nicknames, Change Nickname // Channel Management Manage Channels, Manage Roles, Manage Webhooks, View Channels // Text Permissions Send Messages, Send Messages in Threads, Create Public Threads, Create Private Threads, Embed Links, Attach Files, Add Reactions, Use External Emoji, Use External Stickers, Mention everyone here All Roles, Manage Messages, Manage Threads, Read Message History, Send Text-to-Speech Messages, Use Application Commands // Voice Permissions Connect, Speak, Video, Start Activities, Use Voice Activity, Priority Speaker, Mute Members, Deafen Members, Move Members, Request to Speak // Other Permissions Manage Emojis and Stickers, Manage Events
Responses
{ "bitfield": "14", "hex": "0xE", "count": 3, "permissions": [ "Administrator", "Kick Members", "Ban Members" ] }
Response Fields
| Field | Type | Description |
|---|---|---|
| bitfield | string | Decimal representation of the permission bitfield (as string to preserve precision). |
| hex | string |
Hexadecimal representation prefixed with
0x.
|
| count | number | Number of permissions that matched (unknown names are silently ignored). |
| permissions | array | Resolved permission names with standardised casing. |
{ "error": "Missing or empty 'permissions' array." }
{ "error": "Invalid JSON body." }
{ "error": "Unknown endpoint. Use /permissions/calculate or /permissions/decode" }
Example Usage
$httpPost[https://api.bdtools.xyz/permissions/calculate;{"permissions":["Administrator","Ban Members"]}]
/permissions/decode
Performs the reverse operation: given a permission bitfield, returns the list of enabled permission names. Useful for debugging bot permission integers, checking what an invite link grants, or auditing existing bots.
Request Body
{ "bitfield": "14" }
Fields
| Field | Type | Description |
|---|---|---|
| bitfield | stringrequired | Decimal or hex permission integer (BigInt-compatible, pass as string to preserve precision). |
Responses
{ "bitfield": "14", "hex": "0xE", "count": 3, "permissions": [ "Administrator", "Kick Members", "Ban Members" ] }
{ "error": "Missing 'bitfield' field." }
{ "error": "Invalid bitfield value." }
{ "error": "Unknown endpoint. Use /permissions/calculate or /permissions/decode" }
Example Usage
$httpPost[https://api.bdtools.xyz/permissions/decode;{"bitfield":"14"}]