Changes in v2
Version 2 of the Chatbox API, prepared for SwitchCraft 3, focuses on internal codebase improvements and making the API more consistent. All events have been moved to the event
packet.
API route
- New: The API is now versioned and is accessed via
wss://chat.sc3.io/v2/TOKEN
. - The documentation is now accessed via
https://docs.sc3.io/chatbox
.
Events
- The
message
andcommand
packets have been merged into theevent
packet. Newevent
types are:chat_ingame
chat_discord
chat_chatbox
command
world_change
- The
chat_me
event has been removed. - The
afkReturn
event has been renamed toafk_return
.- New: Owner-only chatbox commands are now available. Prefix a command with a caret (
^
, e.g.^command
) or a pipe (|
, e.g.|command
) to send acommand
event exclusively to websockets authenticated with your license token. TheownerOnly
boolean in thecommand
event will be true.
- New: Owner-only chatbox commands are now available. Prefix a command with a caret (
- New: The
server_restart_scheduled
andserver_restart_cancelled
events have been added.
Fields
- In the
hello
packet,licenceOwner
has been renamed tolicenseOwner
. - New 2024-03-11: In the
hello
packet,licenceOwnerUser
has been added. - In the
chat_discord
event,discordID
has been renamed todiscordId
. - In the
chat_ingame
,chat_discord
andchat_chatbox
events, thechannel
field has been removed. - In the
event
packet, allevent
types are now snake_case instead of camelCase (e.g.afkReturn
->afk_return
). - In the
error
packet, allerror
types are now snake_case instead of camelCase (e.g.rateLimited
->rate_limited
). - In the
user
object,world
now returns full identifiers (e.g.minecraft:overworld
,minecraft:the_nether
,minecraft:the_end
). - All error messages and close reasons containing
licence
now saylicense
. - The
disabledLicenceKey
error is nowdisabled_license
. - The
displayNameFormatted
field in theuser
object has been removed.
Lua API
- The
chat
event has been renamed tochat_ingame
. - The
chat_me
event has been removed. - The
chatbox.licence_key
setting has been renamed tochatbox.license_key
. - The
chatbox.getLicenceOwner()
function has been renamed tochatbox.getLicenseOwner()
. - The
server_restart_scheduled
andserver_restart_cancelled
events have been added.