Examples
Everything here is a complete plugin. Copy it into a .chatt file in your plugins folder, reload, and switch it on.
The eight that ship with Chattler
Three are on when you install: Repeat offender, AutoMod waiting and Suspicious user watch.
Repeat offender
Speaks up when the same person keeps getting actioned. On by default.
plugin "Repeat offender"
description "Speaks up when the same person keeps getting timed out or banned in a short space of time."
author "Chattler"
setting actions = 3 "Mod actions before alerting"
setting window = 15 minutes "How far back to look"
define seen(who, where) do
let key = where + "/" + who
bump(key)
let n = count(key, window)
if n >= actions and cooldown(key, window) then
alert(who + " has had " + n + " mod actions in " + where + " in the last " + round(window / 60000) + " minutes", "warn")
end
end
on timeout do
seen(event.user, event.channel)
end
on ban do
seen(event.user, event.channel)
end
AutoMod waiting
Nudges you when a held message has been sitting there unanswered. On by default.
plugin "AutoMod waiting"
description "Reminds you when a held message has been sitting in AutoMod without an answer."
author "Chattler"
setting wait = 45 seconds "How long before nudging you"
setting chime_too = true "Play the AutoMod chime as well"
on automod_waiting do
if event.seconds < round(wait / 1000) then
stop
end
if cooldown(event.channel + "/" + event.user, 2 minutes) then
alert("AutoMod has been holding a message from " + event.user + " in " + event.channel + " for " + event.seconds + " seconds", "urgent")
if chime_too then
chime("automod")
end
end
end
Suspicious user watch
Alerts when someone Twitch has flagged talks in your chat. On by default.
plugin "Suspicious user watch"
description "Alerts when someone Twitch flags as suspicious, restricted or monitored says something."
author "Chattler"
setting restricted_only = false "Only alert for restricted people"
setting quiet_for = 5 minutes "Only alert once per person in this time"
on suspicious do
if restricted_only and event.status != "restricted" then
stop
end
if cooldown(event.channel + "/" + event.user, quiet_for) then
alert(event.user + " (" + event.status + ") is talking in " + event.channel, "urgent")
chime()
end
end
Mod storm
Your team suddenly doing a lot usually means a raid or a spam wave.
plugin "Mod storm"
description "Tells you when your mod team is suddenly very busy, which usually means a raid or a spam wave."
author "Chattler"
setting actions = 8 "Mod actions in the window before alerting"
setting window = 60 seconds "The window to count over"
on modaction do
bump(event.channel)
let n = count(event.channel, window)
if n >= actions and cooldown(event.channel, 5 minutes) then
alert("Busy in " + event.channel + ": " + n + " mod actions in the last " + round(window / 1000) + " seconds", "warn")
end
end
Chat flood
Catch a chat speeding up before it gets away from you.
plugin "Chat flood"
description "Alerts when a chat suddenly speeds up, so you can switch on slow mode before it gets away."
author "Chattler"
setting busy = 400 "Messages a minute before alerting"
setting quiet_for = 3 minutes "Only alert once per chat in this time"
on speed do
if event.rate >= busy and cooldown(event.channel, quiet_for) then
alert(event.channel + " is at " + event.rate + " messages a minute", "warn")
chime()
end
end
Copypasta watch
The same line, over and over, from everyone.
plugin "Copypasta watch"
description "Notices the same message being posted over and over by chat."
author "Chattler"
setting repeats = 5 "Copies before alerting"
setting window = 30 seconds "The window to count over"
setting shortest = 12 "Ignore messages shorter than this"
on message do
if length(event.text) < shortest then
stop
end
let key = event.channel + "/" + lower(trim(event.text))
bump(key)
let n = count(key, window)
if n >= repeats and cooldown(key, 5 minutes) then
alert("Copypasta in " + event.channel + ", posted " + n + " times: " + event.text, "warn")
end
end
First-timer links
A link in somebody's very first message is worth a look.
plugin "First-timer links"
description "Flags links posted by someone whose first message in the chat this is."
author "Chattler"
setting also_watch = ["bit.ly", "discord.gg", "free", "gift"] "Words worth a second look"
define looks_like_a_link(what) do
if what contains "http" or what contains "www." or what contains ".com" or what contains ".gg" then
return true
end
return false
end
on message do
if not event.is_first then
stop
end
let suspect = looks_like_a_link(event.text)
for each word in also_watch do
if event.text contains word then
set suspect = true
end
end
if suspect then
alert("First message from " + event.user + " in " + event.channel + " has a link: " + event.text, "warn")
end
end
Raid watch
plugin "Raid watch"
description "Announces raids, and says how big they are so you know what is coming."
author "Chattler"
setting smallest = 5 "Ignore raids smaller than this"
setting big = 100 "Treat raids this size as urgent"
on raid do
if event.viewers < smallest then
stop
end
let level = "info"
if event.viewers >= big then
set level = "urgent"
end
alert(event.user + " is raiding " + event.channel + " with " + event.viewers + " viewers", level)
chime()
end
More recipes
Ban wave after a raid
Two events, one story: a raid, then a pile of timeouts right after it.
plugin "Raid gone wrong"
description "Alerts when a raid is followed by a burst of mod actions."
setting window = 3 minutes "How long a raid counts as recent"
setting actions = 5 "Mod actions in that time before alerting"
on raid do
remember("raided/" + event.channel, now())
end
on timeout do
let when = recall("raided/" + event.channel, 0)
if when = 0 or minutes_since(when) > round(window / 60000) then
stop
end
bump("after/" + event.channel)
if count("after/" + event.channel, window) >= actions and cooldown(event.channel, window) then
alert("The raid on " + event.channel + " is turning into work", "urgent")
chime()
end
end
Watch one person
plugin "Watchlist"
description "Alerts whenever someone on your list talks."
setting people = ["grumbleweed", "sneaky"] "Logins to watch"
on message do
if has(people, event.user) and cooldown(event.user, 2 minutes) then
alert(event.name + " is talking in " + event.channel + ": " + event.text, "warn")
end
end
Someone typing in all caps, repeatedly
plugin "Shouting"
description "Alerts when one person keeps shouting."
setting shouts = 3 "Shouty messages before alerting"
setting window = 2 minutes "The window to count over"
on message do
if length(event.text) < 15 or event.text != upper(event.text) then
stop
end
bump(event.user)
if count(event.user, window) >= shouts and cooldown(event.user, 10 minutes) then
alert(event.name + " keeps shouting in " + event.channel, "warn")
end
end
Big gift subs
plugin "Gift alert"
description "Calls out large gift sub drops."
setting big = 10 "Gifts in one go before alerting"
on sub do
if event.gifted and event.count >= big then
alert(event.user + " just gifted " + event.count + " subs in " + event.channel, "urgent")
chime()
notify("Gift subs", event.user + " gifted " + event.count)
end
end
An expensive redemption
plugin "Big redemptions"
description "Notices when someone spends a lot of channel points."
setting cost = 10000 "Points before alerting"
on redemption do
if event.cost >= cost then
alert(event.user + " redeemed " + event.reward + " for " + event.cost + " points")
end
end
A quiet chat
Useful if you are watching several at once and one has gone silent.
plugin "Gone quiet"
description "Tells you when a chat that was busy has gone quiet."
setting was_busy = 30 "Messages a minute that counts as busy"
setting now_quiet = 3 "Messages a minute that counts as quiet"
on speed do
let before = recall(event.channel, 0)
remember(event.channel, event.rate)
if before >= was_busy and event.rate <= now_quiet and cooldown(event.channel, 10 minutes) then
alert(event.channel + " has gone quiet")
end
end