Moderation Actions
Use code moderation actions only for commands that are restricted to trusted roles. For normal automated moderation, use the dashboard moderation rules.
Single-Viewer Actions
- Engine v2
- Engine v1
Timeout Viewer
Times out one viewer from Kick chat.
API reference
moderation.timeout
moderation.timeout(username, minutes)
Input
usernamestringKick username.
minutesnumberTimeout duration in minutes.
Output
booleanTrue when the timeout request completed.
moderation.timeout("JohnKicklet", 1);
async.messages.send("Viewer timed out.");
Ban Viewer
Bans one viewer from Kick chat.
API reference
moderation.ban
moderation.ban(username)
Input
usernamestringKick username.
Output
booleanTrue when the ban request completed.
moderation.ban("JohnKicklet");
async.messages.send("Viewer banned.");
Clear Chat
Clears the Kick chat.
API reference
moderation.clearChat
moderation.clearChat()
Input
This helper does not take input parameters.
Output
booleanTrue when the clear request completed.
moderation.clearChat();
{{kick.Timeout "JohnKicklet" 1}}
{{kick.Ban "JohnKicklet"}}
{{kick.ClearChat}}
Bulk Actions
Bulk actions target viewers who recently sent a matching message. Use excludedRoles to protect trusted roles and similarity when near-matches should count.
- Engine v2
- Engine v1
Ban Matching Messages
Bans viewers who recently sent a matching message.
API reference
moderation.banAll
moderation.banAll(message, options?)
Input
messagestringMessage text to match.
optionsoptionalobjectOptional similarity and excludedRoles settings.
Output
numberNumber of affected viewers.
const amount = moderation.banAll("spam text");
async.messages.send(`Banned ${amount} viewers.`);
const amount = moderation.banAll("spam text", {
similarity: 40,
excludedRoles: ["vip", "og"],
});
async.messages.send(`Banned ${amount} viewers.`);
Timeout Matching Messages
Times out viewers who recently sent a matching message.
API reference
moderation.timeoutAll
moderation.timeoutAll(message, minutes, options?)
Input
messagestringMessage text to match.
minutesnumberTimeout duration in minutes.
optionsoptionalobjectOptional similarity and excludedRoles settings.
Output
numberNumber of affected viewers.
const amount = moderation.timeoutAll("spam text", 2, {
similarity: 40,
excludedRoles: ["vip", "og"],
});
async.messages.send(`Timed out ${amount} viewers.`);
Async Moderation Actions
Async wrapper for moderation.ban(username).
API reference
async.moderation.ban
async.moderation.ban(username)
Input
usernamestringKick username.
Output
booleanTrue when the ban request completed.
Async wrapper for moderation.timeout(username, minutes).
API reference
async.moderation.timeout
async.moderation.timeout(username, minutes)
Input
usernamestringKick username.
minutesnumberTimeout duration in minutes.
Output
booleanTrue when the timeout request completed.
Async wrapper for moderation.clearChat().
API reference
async.moderation.clearChat
async.moderation.clearChat()
Input
This helper does not take input parameters.
Output
booleanTrue when the clear request completed.
Async wrapper for moderation.banAll(message, options?).
API reference
async.moderation.banAll
async.moderation.banAll(message, options?)
Input
messagestringMessage text to match.
optionsoptionalobjectOptional similarity and excludedRoles settings.
Output
numberNumber of affected viewers.
Async wrapper for moderation.timeoutAll(message, minutes, options?).
API reference
async.moderation.timeoutAll
async.moderation.timeoutAll(message, minutes, options?)
Input
messagestringMessage text to match.
minutesnumberTimeout duration in minutes.
optionsoptionalobjectOptional similarity and excludedRoles settings.
Output
numberNumber of affected viewers.
Banned {{kick.BanAll "spam text"}} viewers
Banned {{kick.BanAllSimilarity "spam text" 40 "vip" "og"}} viewers
Timed out {{kick.TimeoutAll "spam text" 2}} viewers
Timed out {{kick.TimeoutAllSimilarity "spam text" 2 40 "vip" "og"}} viewers