sb0t calls named global JavaScript functions in your script when server events occur. You define only the events you care about — any event function that is not defined in your script is silently ignored (a no-op stub is registered automatically for every event so the engine never throws a “function not found” error). Every event receives one or more arguments. Events that can cancel the default action do so by returning a falsy value or an empty string, depending on the event type. Events that are purely informational ignore their return value.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.
User lifecycle
onJoinCheck(user)
false to reject the connection entirely.
The connecting user. Because the user has not yet joined, they are not yet in the room user list.
boolean — false rejects the user.
onJoin(user)
The user who joined.
onRejected(user)
onJoinCheck returning false, or by a ban). The user object is a transient snapshot and is not in the room list.
The rejected user.
onPartBefore(user)
The departing user.
onPart(user)
The user who left.
Text events
onTextBefore(user, text)
null.
The user sending the message.
The raw message text as typed by the user.
string — the (possibly modified) text to broadcast. Return "" or null to suppress the message.
onTextAfter(user, text)
The sender.
The text that was broadcast.
onTextReceived(user, text)
onTextBefore processing chain. Use this for logging or side-effects that should not interfere with message flow.
The sender.
The raw received text.
Emote events
onEmoteBefore(user, text)
/me ...) is broadcast. Return a modified string to change the text, or "" / null to cancel.
The user sending the emote.
The emote text.
string — modified emote text, or empty to suppress.
onEmoteAfter(user, text)
The sender.
The text that was broadcast.
onEmoteReceived(user, text)
onEmoteBefore chain.
The sender.
The raw received emote text.
PM events
onPMBefore(user, target, pm)
false to cancel delivery.
The user sending the PM.
The user receiving the PM.
A PM object (carries the message text and other metadata).
boolean — false cancels the PM.
onPM(user, target)
The sender.
The recipient.
onBotPM(user, text)
The user who messaged the bot.
The PM text.
User state
onNick(user, newName)
false to deny the nick change.
The user requesting the name change.
The requested new nickname.
boolean — false denies the name change.
onAvatar(user)
false to reject it.
The user sending the avatar.
boolean — false rejects the avatar.
onScribbleCheck(user, isPM)
false to block it.
The sender.
true if the scribble is a PM scribble.boolean — false blocks the scribble.
onPersonalMessage(user, text)
false to reject the update.
The user updating their status.
The new personal message text.
boolean — false rejects the update.
onIdled(user)
The user who became idle.
onUnidled(user, seconds)
The user who returned from idle.
How many seconds the user was idle.
Admin and authentication
onLoginGranted(user)
The user who logged in.
onInvalidLoginAttempt(user)
The user who made the failed attempt.
onLogout(user)
The user who logged out.
onAdminLevelChanged(user)
The user whose level changed. Check
user.level for the new value.onRegistering(user)
false to deny registration.
The user attempting to register.
boolean — false blocks the registration.
onRegistered(user)
The newly registered user.
onUnregistered(user)
The user who was unregistered.
Room events
onVroomJoinCheck(user, vroom)
false to deny entry.
The user requesting to join the vroom.
The vroom number (0–65535).
boolean — false blocks entry.
onVroomJoin(user)
user.vroom for which room they joined.
The user who changed vrooms.
onCommand(user, cmd, target, args)
/command. Built-in script management commands are intercepted before this event fires.
The user who issued the command.
The full command string (lowercase, without the leading
/).The targeted user, if any was resolved from the command.
null otherwise.Any trailing arguments after the command and target.
onHelp(user)
/help. Use print(user, "...") here to add your own help lines. If the user is at or above ScriptLevel, the built-in scripting help lines are also printed.
The user who requested help.
onFileReceived(user, filename)
The sender.
The name of the file as reported by the client.
onIgnoring(user, target)
false to prevent the ignore.
The user doing the ignoring.
The user being ignored.
boolean — false blocks the ignore action.
onIgnoredStateChanged(user, target, ignored)
The user whose ignore list changed.
The user affected.
true if target was added to the ignore list; false if removed.Flood events
onFloodBefore(user, msgByte)
false to cancel the flood action.
The flooding user.
The message-type byte that triggered the flood detection.
boolean — false suppresses the flood action.
onFlood(user)
The user who triggered flood protection.
onProxyDetected(user)
false (allow anyway), because the built-in proxy check can produce false positives. Return true to reject the connection.
The connecting user.
boolean — true rejects the connection.
Linking events
onLinked()
onUnlinked()
onLinkError(msg)
An integer error code representing the link error type.
onLeafJoin(leaf)
The leaf server that connected.
onLeafPart(leaf)
The leaf server that disconnected.
onLinkedAdminDisabled(leaf, user)
The leaf the user belongs to.
The user whose admin was disabled.
Script lifecycle
onLoad()
Room, Users, Stats, etc.) and global functions are available.