Quick References
Common integration patterns for Wasabi Chat (wasabi_chat).
Messagesβ
Send a message to a player (server)β
exports.wasabi_chat:sendMessage(source, { name = 'Pacific Bank', color = '#4caf50' }, 'Your loan was approved.')
Send a message to a job (server)β
exports.wasabi_chat:sendToJob('police', { name = 'Dispatch', color = '#3b82f6' }, '10-90 at Fleeca Bank', { onDuty = true })
Send a message to nearby players (server)β
exports.wasabi_chat:sendNearby(source, 15, { name = 'Store Clerk' }, 'We close in 5 minutes.')
Check why a message was not sent (server)β
local ok, reason = exports.wasabi_chat:sendMessage(source, { name = 'Pacific Bank' }, 'Your loan was approved.')
if not ok then
print('Message not sent: ' .. reason)
end
Wrist Linkβ
if exports.wasabi_chat:hasWristLink(source) then
exports.wasabi_chat:sendWristNotification(source, { title = 'Dispatch', text = 'New call assigned' })
end
exports.wasabi_chat:sendSystemDM(source, { name = 'Maze Bank' }, 'Your loan payment of $500 is due tomorrow.')
Moderationβ
exports.wasabi_chat:mutePlayer(source, 10, 'Spamming OOC')
local muted, secondsLeft, reason = exports.wasabi_chat:isMuted(source)
exports.wasabi_chat:unmutePlayer(source)
exports.wasabi_chat:setSlowMode('ooc', 10)
local text, matched = exports.wasabi_chat:filterText(input)
Hide the chatβ
While your own UI is open (client)β
exports.wasabi_chat:setChatHidden(true) -- your UI opens
exports.wasabi_chat:setChatHidden(false) -- your UI closes
Stock chat scriptsβ
Scripts written for the stock chat keep working without changes:
exports.chat:addMessage(-1, { color = { 255, 200, 0 }, args = { 'Server', 'Restart in 10 minutes.' } })
TriggerClientEvent('chat:addMessage', source, { args = { 'Server', 'Welcome!' } })
Bannersβ
Banners appear above job announcements and custom messages. The shipped banners are in ui/build/assets/: banner-police.png, banner-ems.png, banner-mechanic.png, banner-business.png, and banner-staff.png.
To add your own:
- Make a PNG at 3:1 (the shipped banners are 960x320). A template is in
_BANNER_TEMPLATE/. - Save it in
ui/build/assets/. If you build the UI from source, also put it inui/public/assets/. - Use its file name in
announcements.jobs.<job>.banneror in an export'sbanneroption.
File names may only use A-Z a-z 0-9 _ -, up to 60 characters, plus .png.
Discordβ
Chat logβ
Set discordLogs.enabled = true and put the webhook in server.cfg so it stays out of your config files. The convar wins over discordLogs.webhook.
set wasabi_chat_webhook "https://discord.com/api/webhooks/..."
Wrist Link DMs are private. They are logged only if discordLogs.directMessages and messageLog.logDirectMessages are both true. Tell your players if you turn this on.
Emojis and stickersβ
Emojis and stickers come from your own Discord server, through a bot that is a member of it. The bot token stays on the server.
set wasabi_chat_discord_guild_id "123456789012345678"
set wasabi_chat_discord_bot_token "your-bot-token"
set wasabi_chat_discord_cache_seconds 300 # optional, 30-3600
Commandsβ
Playersβ
/wsbchat_open(keyT): open the chat./wristlink: open Wrist Link (no key by default). In item mode this command is not registered; players use the item./me,/do,/roll [NdM](default1d6),/try: overhead bubbles./jobannounce <status> <text>: job announcement card (open,closed,hiring,event,general)./clear: clear your own chat feed.
Staffβ
/announce <text>,/clearall./mute <id> [minutes] [reason],/unmute <id or identifier>,/mutes./slowmode <local|ooc|staff|groups|dm|all> <seconds>./wristlinkresetpw <player id | account name>(item mode only)./say <text>: console or acecommand.sayonly.
The mute and slow mode commands are allowed for the console, staffGroups, or the ace command.<name> (for example add_ace group.mod command.mute allow). To let a group skip slow mode (and the word filter, when bypassStaff = true), add add_ace group.mod wasabichat.bypass allow.
Integration hooksβ
Use Listeners for editable callbacks and Events for chat activity. Do not call undocumented internal network events as an integration API.