Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/AresChat/sb0t/llms.txt

Use this file to discover all available pages before exploring further.

The Crypto static object provides cryptographic hash functions for use in sb0t scripts. It is useful for fingerprinting content, generating tokens, verifying data integrity, or producing checksums for storage and comparison.
MD5 and SHA-1 are not considered cryptographically secure for modern systems. Do not use these functions for password hashing or security-sensitive operations. They are appropriate for checksums, fingerprinting, and non-security content identifiers.

Crypto

Crypto.md5hash(text)

Computes the MD5 hash of a UTF-8 encoded string and returns a CryptoResult object.
text
string
required
The input string to hash. Encoded as UTF-8 before hashing.
Returns: CryptoResult — an object exposing the hash in multiple formats. Returns null if text is null or undefined.

Crypto.sha1hash(text)

Computes the SHA-1 hash of a UTF-8 encoded string and returns a CryptoResult object.
text
string
required
The input string to hash. Encoded as UTF-8 before hashing.
Returns: CryptoResult — an object exposing the hash in multiple formats. Returns null if text is null or undefined.

CryptoResult Object

Both Crypto.md5hash() and Crypto.sha1hash() return a CryptoResult instance with the following methods:

.toHex()

Returns the hash as an uppercase hexadecimal string (e.g. "D41D8CD98F00B204E9800998ECF8427E"). Returns: string

.toBase64()

Returns the hash as a Base64-encoded string. Returns: string

.toArray()

Returns the raw hash bytes as a JavaScript array of integers (0–255), one element per byte. Returns: Array<number>

Examples

var result = Crypto.md5hash("hello world");
room.say("MD5: " + result.toHex());
// e.g. "MD5: 5EB63BBBE01EEED093CB22BB8F5ACDC3"

Base64

The Base64 static object encodes and decodes strings using standard Base64 encoding. Input and output use UTF-8 text.

Base64.encode(text)

Encodes a string as Base64.
text
string
required
The plain-text string to encode.
Returns: string — the Base64-encoded result. Returns null if text is null or undefined.

Base64.decode(text)

Decodes a Base64-encoded string back to plain text.
text
string
required
The Base64-encoded string to decode.
Returns: string — the decoded UTF-8 string, or null if the input is not valid Base64.
var encoded = Base64.encode("hello from sb0t");
room.say("Encoded: " + encoded);

var decoded = Base64.decode(encoded);
room.say("Decoded: " + decoded);

Zip

The Zip static object compresses and decompresses strings using the server’s built-in compression engine. The string is encoded as UTF-8 before compression and decoded from UTF-8 after decompression.

Zip.compress(text)

Compresses a string.
text
string
required
The string to compress.
Returns: string — the compressed data as a string using the system default encoding. Returns null on failure or if text is undefined.

Zip.uncompress(text)

Decompresses a previously compressed string.
text
string
required
The compressed string (as returned by Zip.compress()).
Returns: string — the decompressed UTF-8 string. Returns null on failure.
var compressed = Zip.compress("some long repeated text text text text");
var original   = Zip.uncompress(compressed);
room.say("Restored: " + original);

The Hashlink static object encodes and decodes Ares arlnk:// room links. These links embed a room name, IP address, and port into a compact encrypted string that Ares clients can use to connect directly to a room. Encodes a room descriptor object into an arlnk:// link string.
obj
object
required
A plain JavaScript object with the following properties:
ip
string
required
The external IP address of the room (e.g. "1.2.3.4").
port
number
required
The data port of the room (1–65535).
name
string
required
The display name of the room.
Returns: string — the full arlnk://... link, or null on error.
Decodes an arlnk:// link string into a room descriptor object.
The arlnk:// hashlink string to decode.
Returns: HashlinkResult — an object with name (string), ip (string), and port (number) properties. Returns null if the link is invalid.
var link = Hashlink.encode({ ip: "1.2.3.4", port: 1337, name: "My Room" });
room.say("Join here: " + link);

Spelling

The Spelling static object provides spell-checking utilities backed by the server’s built-in spell checker.

Spelling.check(text)

Checks the spelling of a block of text and returns a corrected version.
text
string
required
The text to check.
Returns: string — the spell-corrected text, or null if text is undefined.

Spelling.suggest(word)

Returns a collection of spelling suggestions for a single word.
word
string
required
The word to get suggestions for.
Returns: SpellingSuggestionCollection — an array-like object with a length property and numeric indexes, each containing a suggested replacement string.

Spelling.confirm(word)

Checks whether a single word is spelled correctly.
word
string
required
The word to check.
Returns: booleantrue if the word is correct, false otherwise.
function onPublicText(user, msg) {
    if (!Spelling.confirm(msg)) {
        var fixed = Spelling.check(msg);
        room.say("Did you mean: " + fixed + "?");
    }
}

Registry

The Registry static object provides persistent key-value storage for scripts using the Windows Registry. All values are stored under HKEY_CURRENT_USER\Software\sb0t\<appname>\scripting\<scriptname>, scoped to the current script.
Registry storage is Windows-only and scoped to the current user account running sb0t. Values survive server restarts. Only string, integer, and floating-point values can be stored.

Registry.exists(key)

Checks whether a named value exists in the registry for this script.
key
string
required
The registry value name to check.
Returns: boolean

Registry.getValue(key)

Reads a stored value from the registry.
key
string
required
The registry value name to read.
Returns: string — the stored value, or null if the key does not exist.

Registry.setValue(key, value)

Writes a value to the registry. Accepts strings, integers, and floating-point numbers.
key
string
required
The registry value name to write.
value
string | number
required
The value to store.
Returns: booleantrue on success, false if the value type is unsupported.

Registry.deleteValue(key)

Deletes a named value from the registry.
key
string
required
The registry value name to delete.
Returns: booleantrue if deleted, false if the key did not exist.

Registry.getKeys()

Returns all stored value names for the current script. Returns: RegistryKeyCollection — an array-like object with a length property and numeric indexes, each containing a key name string.

Registry.clear()

Deletes all registry values stored for the current script. Returns: booleantrue on success.
Registry.setValue("welcomeCount", 0);

function onUserJoin(user) {
    var count = parseInt(Registry.getValue("welcomeCount")) + 1;
    Registry.setValue("welcomeCount", count);
    room.say("Welcome #" + count + ": " + user.name);
}

File

The File static object provides simple text file persistence for scripts. All file operations are sandboxed to the script’s own data/ subfolder inside the server’s data directory. Filenames may not contain .., /, \, or spaces.
The data directory is automatically created on first write. Paths are strictly sandboxed — traversal sequences and directory separators are rejected.

File.exists(filename)

Checks whether a file exists in the script’s data folder.
filename
string
required
The filename to check (no path separators or ..).
Returns: boolean

File.load(filename)

Reads the full text content of a file.
filename
string
required
The filename to read.
Returns: string — the file contents, or null if the file does not exist or the filename is invalid.

File.save(filename, content)

Writes a string to a file, replacing any existing content.
filename
string
required
The filename to write.
content
string
required
The text content to save. Written as UTF-8.
Returns: booleantrue on success.

File.append(filename, content)

Appends a string to a file. Creates the file if it does not exist.
filename
string
required
The filename to append to.
content
string
required
The text to append.
Returns: booleantrue on success.

File.kill(filename)

Deletes a file from the script’s data folder.
filename
string
required
The filename to delete.
Returns: booleantrue if the file existed and was deleted, false otherwise.
File.save("greetings.txt", "Hello, world!");
var content = File.load("greetings.txt");
room.say(content);

Build docs developers (and LLMs) love