Builtins
This page is the complete list of everything a plugin can call. There is nothing else: no network, no files, no way into the app.
Telling you about it
alert(text, level)
Puts a message on screen, labelled with the plugin's name.
alert("chat is going fast")
alert("this needs a look", "warn")
alert("this needs you now", "urgent")
level is "info" (the default), "warn" (amber) or "urgent" (red). Returns false if the alert was dropped for coming too fast - six per plugin per ten seconds.
Every alert is also written to the plugin's Recent alerts list in Settings.
notify(title, text)
A Windows desktop notification. Only when Chattler is not the window you are looking at, and never while streamer mode is on.
notify("Raid", event.user + " brought " + event.viewers + " viewers")
chime(which)
Plays a sound. No argument for the highlight chime, "automod" for the AutoMod one.
chime()
chime("automod")
Silent while streamer mode is on, and at most one chime a second across the whole app.
log(text)
Writes to the plugin's own list in Settings without putting anything on screen. Your print statement.
log("saw " + event.user)
Counting
bump(key, amount)
Notes that something happened, now. amount defaults to 1.
bump(event.channel + "/" + event.user)
count(key, window)
How many times that key was bumped inside window. Leave window out for everything remembered.
count(event.user, 10 minutes)
Each key remembers its last 120 bumps, and a plugin keeps up to 200 keys; the least recently used is dropped after that.
cooldown(key, wait)
true the first time, then false until wait has passed. The way to stop an alert repeating.
if cooldown("flood/" + event.channel, 3 minutes) then
alert(event.channel + " is flooding")
end
remember(key, value) / recall(key, fallback) / forget(key)
Keep a value between events.
remember("last", event.user)
let who = recall("last", "nobody")
forget("last")
Counters and notes live in memory only: they start empty each time Chattler opens.
Asking about chat
speed(channel)
Messages a minute in that chat, over the last minute. No argument means the chat you are looking at.
if speed(event.channel) > 500 then
now()
The time now, as a number. Subtract two of them to get milliseconds.
seconds_since(time) / minutes_since(time)
remember("started", now())
if minutes_since(recall("started", now())) > 30 then
Text and lists
| Function | What it does |
|---|---|
lower(text) | lower case |
upper(text) | UPPER CASE |
trim(text) | strips spaces from both ends |
text(value) | turns anything into text |
number(value) | turns text into a number |
round(number) | nearest whole number |
length(value) | letters in text, or items in a list |
words(text) | splits text into a list of words |
join(list, separator) | glues a list into text |
item(list, position) | one item, counting from 1 |
has(list, value) | whether the list holds that value, ignoring case |
let shouty = event.text = upper(event.text)
let first_word = item(words(event.text), 1)
alert(join(["a", "b", "c"], " and "))
What is deliberately missing
There is no way to:
- time anyone out, ban, delete a message or change chat settings
- send a message, a whisper or a shoutout
- read your token, your settings, your channels or your history
- open a file, or make a network request of any kind
- reach the page, the window, or anything else in the app
If a plugin claims it can do any of that, it cannot. The language has no syntax for it, and fetch, window and friends are simply names that evaluate to nothing.