Skip to content
Kicklet.app
SearchK
Main Navigation HomeDocumentation
Appearance
Menu
Return to top
Sidebar Navigation
Documentation
Introduction
Default Commands
JavaScript / Template
How to use JavaScript
Example Commands
Usage of API Token
On this page
Example Commands
Here are some example commands that you can directly copy or modify slightly for your own
stream.
Emoji of the day
Selects a random emoji from the list and displays it.
go
Your Emoji of the Day is:{{randItem "🌟" "🚀" "💎" "🌈"}}
Kill-counter
Every time the command is executed, the counter is incremented by 1, and in the chat, it shows
the new value.
go
The Streamer has {{kicklet.CounterAdd "killcounter" 1}} kills.
Minecraft server players
It is displayed in the chat how many players are currently online on the Minecraft server.
go
There are currently {{minecraft.Players "hypixel.net"}} players on
Hypixel.net!
Random Joke
A random joke is fetched from the "official-joke API" and displayed in the chat.
go
{{$response := http.GetJson "https://official-joke-
api.appspot.com/random_joke"}}
{{$response.setup}} - {{$response.punchline}}
Points Drop/Rain
A command that allows you or your moderators, depending on the permission settings, to
distribute a certain number of points to all currently active chatters at that moment. Usage:
!drop (amount)
go
{{if eq (len args) 1}}
{{ $points := index args 0 }}
{{if and (isInt $points) (ge (parseInt $points) 1)}}
{{ $parsedPoints := parseInt $points }}
{{ $parsedPoints }} points have been distributed to
{{kicklet.AddPointsViewers $parsedPoints}} chatters!
{{else}}
Please enter a valid point value.
{{end}}
{{else}}
Use: !drop (amount)
{{end}}
Roulette
This command is a comprehensive roulette system in which you can bet points on numbers 1-36
and on RED or BLACK.
go
{{define "winMsg"}}
Congratulations, you have won {{mul .Points .Multiplier}} points! 💰
{{end}}
{{define "syntaxError"}}
Invalid syntax. Use: !roulette (1-36 | BLACK | RED) (Points)
{{end}}
{{define "notAnIntError"}}
Please enter a valid point value.
{{end}}
{{define "loseMsg"}}
Unfortunately, you lost. Try again!
{{end}}
{{define "notEnoughPoints"}}
You cannot bet more points than you have.
{{end}}
{{define "numberMsg"}}
🎰 The ball lands on {{.Number}} {{.Emoji}}
{{end}}
{{define "newPointsMsg"}}
You have now {{.NewPoints}} Points.
{{end}}
{{if eq (len args) 2}}
{{ $choice := upper (index args 0) }}
{{ $points := index args 1 }}
{{if and (isInt $points) (ge (parseInt $points) 1)}}
{{ $parsedPoints := parseInt $points }}
{{ $userPoints := kicklet.Points sender.String }}
{{if ge $userPoints $parsedPoints}}
{{ $randNum := rand 0 36 }}
{{ $color := "GREEN" }}
{{ $emoji := "🟢" }}
{{if or (and (ge $randNum 1) (le $randNum 10)) (and (ge $randNum 19)
(le $randNum 28))}}
{{if eq (mod $randNum 2) 1}}
{{ $color = "RED" }}
{{ $emoji = "🔴" }}
{{else}}
{{ $color = "BLACK" }}
{{ $emoji = "⚫" }}
{{end}}
{{else if or (and (ge $randNum 11) (le $randNum 18)) (and (ge
$randNum 29) (le $randNum 36))}}
{{if eq (mod $randNum 2) 1}}
{{ $color = "BLACK" }}
{{ $emoji = "⚫" }}
{{else}}
{{ $color = "RED" }}
{{ $emoji = "🔴" }}
{{end}}
{{end}}
{{if or (eq $choice "BLACK") (eq $choice "RED")}}
{{ template "numberMsg" (dict "Number" $randNum "Emoji" $emoji)
}}
{{if eq $choice $color}}
{{ $newPoints := kicklet.AddPoints sender.String (mul
$parsedPoints 1) }}
{{ template "winMsg" (dict "Points" $parsedPoints
"Multiplier" 2) }}
{{ template "newPointsMsg" (dict "NewPoints" $newPoints)
}}
{{else}}
{{ $newPoints := kicklet.RemovePoints sender.String
$parsedPoints }}
{{ template "loseMsg" }}
{{ template "newPointsMsg" (dict "NewPoints" $newPoints)
}}
{{end}}
{{else if and (isInt $choice) (ge (parseInt $choice) 1) (le
(parseInt $choice) 36)}}
{{ template "numberMsg" (dict "Number" $randNum "Emoji" $emoji)
}}
{{if eq $randNum (parseInt $choice)}}
{{ $newPoints := kicklet.AddPoints sender.String (mul
$parsedPoints 35) }}
{{ template "winMsg" (dict "Points" $parsedPoints
"Multiplier" 36) }}
{{ template "newPointsMsg" (dict "NewPoints" $newPoints)
}}
{{else}}
{{ $newPoints := kicklet.RemovePoints sender.String
$parsedPoints }}
{{ template "loseMsg" }}
{{ template "newPointsMsg" (dict "NewPoints" $newPoints)
}}
{{end}}
{{else}}
{{ template "syntaxError" }}
{{end}}
{{else}}
{{ template "notEnoughPoints" }}
{{end}}
{{else}}
{{ template "notAnIntError" }}
{{end}}
{{else}}
{{ template "syntaxError" }}
{{end}}
Slots (With JavaScript)
The Slots command, written in JavaScript, allows you to bet a certain number of points on a spin,
and if you get three identical fruits, you win five times the amount back.
js
<template>
{{/* Author: Kicklet */}}
{{/* Messages */}}
{{define "slotWinMsg"}}
Congratulations, you have won {{script.Var "winPoints"}} points! 🎉
{{end}}
{{define "slotLoseMsg"}}
Better luck next time! 🍀
{{end}}
{{define "slotSyntaxError"}}
Invalid syntax. Use: !slot (Points)
{{end}}
{{define "notEnoughPoints"}}
You do not have enough Points!
{{end}}
{{/* DO NOT TOUCH */}}
{{script.Call "main"}}
{{$result := script.Var "result"}}
{{if eq $result "WIN"}}
{{template "slotMachineResult"}}
{{template "slotWinMsg"}}
{{else if eq $result "LOSE"}}
{{template "slotMachineResult"}}
{{template "slotLoseMsg"}}
{{else if eq $result "NOT_ENOUGH_POINTS"}}
{{template "notEnoughPoints"}}
{{else if eq $result "SYNTAX_ERROR"}}
{{template "slotSyntaxError"}}
{{end}}
{{define "slotMachineResult"}}
🎰 ➜ {{script.Call "getFormattedSlot"}}
{{end}}
</template>
<script>
const username = $event.getSender();
const args = $event.getCommandArgs();
const items = ['🍇', '🍌', '🍒'];
const winMultiplier = 5;
let result;
let slots = [];
let winPoints = 0;
function getFormattedSlot() {
return `[${slots[0]}|${slots[1]}|${slots[2]}]`;
}
function randItem() {
return items[Math.floor(Math.random() * items.length)];
}
function isInt(value) {
return !isNaN(value) && parseInt(Number(value)) == value &&
!isNaN(parseInt(value, 10));
}
async function main() {
if (args.length == 1 && isInt(args[0])) {
const points = parseInt(Number(args[0]));
if(points >= 1 && isInt(points)){
const pointsResponse = await Kicklet.getPoints(username);
const userPoints = pointsResponse.data.points;
if (userPoints >= points) {
slots[0] = randItem();
slots[1] = randItem();
slots[2] = randItem();
if (slots[0] === slots[1] && slots[1] === slots[2]) {
winPoints = points * winMultiplier;
Kicklet.setPoints(username, userPoints + winPoints);
result = 'WIN';
} else {
Kicklet.setPoints(username, userPoints - points);
result = 'LOSE';
}
} else {
result = 'NOT_ENOUGH_POINTS';
}
} else {
result = 'SYNTAX_ERROR';
}
} else {
result = 'SYNTAX_ERROR';
}
}
</script>
Pager
Previous pageHow to use JavaScript
Next pageUsage of API Token