Skip to content

JavaScript / Template

You can enhance your own Kicklet commands with simple template variables, or even build your own logic using the template language or JavaScript.

Sender

Example (Template):
go
Welcome to my stream, {{sender}}!
  • Returns the name of the user interacting with the chatbot.
Example (JavaScript):
js
const sender = $event.getSender();
  • Returns Sender of the command.

Watchtime

  • Returns the watch-time of a user.
Example (Template):
go
Your watchtime: {{kicklet.Watchtime sender.String}}
The watchtime of exampleUser is: {{kicklet.Watchtime "exampleUser"}}
Example (JavaScript):
js
const watchtime = Kicklet.watchtime('userName')
        .then(resp => resp.data.watchtime);

Follow age

  • Returns the time a user is following the channel.
Example (Template):
go
You are following since: {{kick.FollowAge sender.String}}
Example (JavaScript):
js
const sender = $event.getSender();
const followAge = Kick.getChannelUser(sender)
        .then(resp => resp.following_since);

Followers

  • Returns the number of followers the streamer has.
Example (Template):
go
The streamer has {{kick.Followers}} Followers.
Example (JavaScript):
js
const followersCount = Kick.getChannel()
        .then(resp => resp.followers_count);

Subscriber

  • Returns the number of subscriber the streamer has in the last days.

Parameters

  • days (Number): Specifies the time frame, in days, for which subscriptions should be counted. For example, counting subscriptions from the last 30 days.
Example (Template):
go
The streamer has {{kicklet.SubCount 30}} Subscriber.
Example (JavaScript):
js
const followersCount = Kicklet.subCount(30)
        .then(resp => resp.data.count);

Channel

  • Returns the Kick channel of the streamer.
Example (Template):

No Template example exists yet.

Example (JavaScript):
js
const streamerChannel = await Kick.getChannel()
    .then(resp => resp);

Channel User

  • Returns the Kick channel of requested user.
Example (Template):

No Template example exists yet.

Example (JavaScript):
js
const userChannel = Kick.getChannelUser('userName')
    .then(resp => resp);

Username

  • Returns the Kick username of the streamer.
Example (Template):
go
The streamers username is: {{kick.Username}}
Example (JavaScript):
js
const userName = Kick.getUsername()
    .then(resp => resp);

Slug

  • Returns the Kick slug of the streamer.
Example (Template):
go
The streamers slug is: {{kick.Slug}}
Example (JavaScript):
js
const userName = Kick.getSlug()
    .then(resp => resp);

Viewers

  • Returns the current number of viewers in the stream.
Example (Template):
go
The streamer has {{kick.Viewers}} Viewers.
Example (JavaScript):

No JavaScript example exists yet.

Title

  • Returns the title of the stream.
Example (Template):
go
The stream title is {{kick.Title}}.
Example (JavaScript):

No JavaScript example exists yet.

Category

  • Returns the category of the stream.
Example (Template):
go
The stream is in the {{kick.Category}} category.
Example (JavaScript):

No JavaScript example exists yet.

Uptime

  • Returns the duration the stream has been live.
Example (Template):
go
The stream has been live for {{kick.Uptime}}.
Example (JavaScript):

No JavaScript example exists yet.

Active Chatters Count

  • Returns the current count of active viewers in the stream.
Example (Template):
go
Active viewers count: {{kicklet.ActiveViewersCount}}
Example (JavaScript):

No JavaScript example exists yet.

Active Chatter Random

  • Returns an array of active viewers (up to 10)
Example (Template):
go
Randomly selected viewers:
{{range $viewer := kicklet.ActiveViewersRandom 10}}
ID: {{$viewer.ID}}, Username: {{$viewer.Username}}
{{end}}
Example (JavaScript):

No JavaScript example exists yet.

Active Chatter Random

  • Returns an active viewer
Example (Template):
go
Randomly selected active viewer: {{kicklet.ActiveViewerRandom.Username}}
Example (JavaScript):

No JavaScript example exists yet.

Counter: Get

  • Returns the number of the counter.
Example (Template):
go
This command was used {{kicklet.GetCounter "test"}} times.
Example (JavaScript):
js
const executions = Kicklet.getCounter('test')
    .then(resp => resp.data);

Counter: Set

  • Sets the counter to a specific number without a return.
Example (Template):
go
{{kicklet.SetCounter "test" 0}}
Counter was resetted.
Example (JavaScript):
js
Kicklet.setCounter('test', 0)
    .then(resp => resp.data);

Counter: Add

  • Increments the counter by 1. Returns the number of the incremented count.
Example (Template):
go
This streamer died {{kicklet.CounterAdd "test" 1}} times.
Example (JavaScript):
js
Kicklet.counterAdd('test', 1)
    .then(resp => resp.data);

Points: Get

  • Returns the points of the user.
Example (Template):
go
You have {{kicklet.Points sender.String}} points!
Example (JavaScript):
js
Kicklet.getPoints($event.getSender())
    .then(resp => resp.data.points);

Points: Set

  • Sets the points of the user and returns the points.
Example (Template):
go
You have now {{kicklet.SetPoints sender.String 100}} points!
Example (JavaScript):
js
Kicklet.setPoints($event.getSender(), 100)
    .then(resp => resp.data);

Points: Add

  • Adds 100 points and returns the new points of the user.
Example (Template):
go
You have now {{kicklet.AddPoints sender.String 100}} points!
Example (JavaScript):
js
Kicklet.addPoints($event.getSender(), 100)
    .then(resp => resp.data);

Points: Remove

  • Removes 100 points and returns the points of the user.
Example (Template):
go
You have now {{kicklet.RemovePoints sender.String 100}} points!
Example (JavaScript):
js
Kicklet.removePoints($event.getSender(), 100)
    .then(resp => resp.data);

Points: Add For All Active Chatters

  • Adds 100 points to all active chatters and returns amount of users.
Example (Template):
go
100 Points added to {{kicklet.AddPointsViewers 100}} viewers!
Example (JavaScript):
js
Kicklet.addPointsViewers(100)
    .then(resp => resp.data);

Random Number

  • Returns a random number between the specified min and max values.
Example (Template):
go
Rolling a dice... You got a {{rand 1 6}}!
Example (JavaScript):
js
function getRandomNumber(min, max) {
  return Math.floor(Math.random() * (max - min + 1)) + min;
}

Random Item

  • Returns a random item from the list of provided items.
Example (Template):
go
Let me choose a random item for you: {{randItem "apple" "banana" "orange"}}.
Example (JavaScript):
js
const items = ["apple", "banana", "orange"];

function getRandomItem(items) {
  return items[Math.floor(Math.random() * items.length)];
}

Random Item (Percentage)

  • Returns a random item from the list of provided items with percentage.
Example (Template):
go
Let me choose a random item for you: {{randItemPercentage "apple" 95 "banana" 2.5 "orange" 2.5}}.
Example (JavaScript):
js
const itemsWithPercentage = [
    { value: "apple", weight: 95 },
    { value: "banana", weight: 2.5 },
    { value: "orange", weight: 2.5 }
];

function getRandomItemPercentage(items) {
  const totalWeight = items.reduce((total, item) => total + item.weight, 0);
  let random = Math.random() * totalWeight;

  for (const item of items) {
    if (random < item.weight) {
      return item.value;
    }
    random -= item.weight;
  }
}

Named

  • Returns the value of the named argument from the command data. If the argument is not found, an empty string is returned.
Example (Template):
go
You entered: {{arg "username"}}. Welcome, {{arg "username"}}!
Example (JavaScript):

No JavaScript example exists yet.

Argument Retrieval

  • Returns an array of all parameters from the command data.
Example (Template):
go
Command arguments: {{args}}. There are {{len args}} arguments in total.
Example (JavaScript):
js
const args = $event.getCommandArgs();

Arguments as URL query

Parameters

  • startIndex (Number): The starting index in the args array.
Example (Template):
go
{{argsUrlQuery startIndex}}
Example (JavaScript):

No JavaScript example exists yet.

Time

  • Returns the current time in the specified time zone. The time is formatted as "15:04".
Example (Template):
go
The current time in New York is {{time "America/New_York"}}.
Timezones

Here are some time zones listed as examples:

Country NameTime Zone
AustraliaAustralia/Melbourne
BrazilAmerica/Araguaina
CanadaAmerica/Atikokan
FranceEurope/Paris
GermanyEurope/Berlin
HaitiAmerica/Port-au-Prince
IndiaAsia/Kolkata
JapanAsia/Tokyo
KazakhstanAsia/Qyzylorda
LiechtensteinEurope/Vaduz
MaltaEurope/Malta
NepalAsia/Kathmandu
OmanAsia/Muscat
PakistanAsia/Karachi
QatarAsia/Qatar
RomaniaEurope/Bucharest
SerbiaEurope/Belgrade
ThailandAsia/Bangkok
United StatesAmerica/Adak
VanuatuPacific/Efate
Wallis and FutunaPacific/Wallis
YemenAsia/Aden
ZambiaAfrica/Lusaka

See all timezones here

Example (JavaScript):

No JavaScript example exists yet.

Formatted Time

  • Returns the current time in the specified time zone and format.
Example (Template):
go
The current time in New York is {{timeFmt "America/New_York" "03:04 pm"}}.
The current time in New York is {{timeFmt "America/New_York" "15:04:05"}}.
The current time in New York is {{timeFmt "America/New_York" "Monday January _2 15:04:05 2006"}}.
The current time in New York is {{timeFmt "America/New_York" "Mon Jan _2 15:04:05 2006"}}.
Formatting
yml
Year: "2006" "06"
Month: "Jan" "January" "01" "1"
Day of the week: "Mon" "Monday"
Day of the month: "2" "_2" "02"
Day of the year: "__2" "002"
Hour: "15" "3" "03" (PM or AM)
Minute: "4" "04"
Second: "5" "05"
AM/PM mark: "PM"
Based on: https://pkg.go.dev/time#pkg-constants
Example (JavaScript):

No JavaScript example exists yet.

Case Conversion: Upper

  • Returns the provided string in uppercase.
Example (Template):
go
You shouted: {{upper "hello, world!"}}.
Example (JavaScript):
js
console.log("hello, world!".toUpperCase());

Case Conversion: Lower

  • Returns the provided string in lowercase.
Example (Template):
go
You whispered {{lower "I LOVE CHOCOLATE"}}.
Example (JavaScript):
js
console.log("I LOVE CHOCOLATE".toLowerCase());

Minecraft Players

  • Returns the current player count of a Minecraft server or network.
Example (Template):
go
There are currently {{minecraft.Players "hypixel.net"}} players on Hypixel.net!
Example (JavaScript):
js
const playersCount = Minecraft.players('hypixel.net')
    .then(resp => resp.data);

Command List: All

  • Returns all available commands.
Example (Template):
go
Here are the commands available: {{kicklet.Commands}}
Example (JavaScript):
js
const commands = Kicklet.commands()
    .then(resp => resp.data);

Command List: Permission

  • Returns commands that the sender has permission to use.
Example (Template):
go
You have permission to use the following commands: {{kicklet.CommandsWithPermission}}
Example (JavaScript):
js
const commandsWithPerms = Kicklet.commandsWithPermissions()
    .then(resp => resp.data);

Check Permissions

  • Returns a boolean value indicating whether the sender has the corresponding permission.
Example (Template):
go
{{if sender.HasPermission "broadcaster"}}
      You are a broadcaster!
    {{else}}
      You are not a broadcaster..
{{end}}
Example (JavaScript):
js
$event.getSender().hasPermission('broadcaster')

Fetch JSON

  • Returns the object that the API provides. You can then access this object to process individual values.
Example (Template):
go
{{$response := http.GetJson "https://swapi.dev/api/people/1"}}
Name: {{ $response.name }}
Example (JavaScript):

No JavaScript example exists yet.

Fetch JSON with Headers

  • Returns the object from the specified API endpoint while including custom headers. This allows you to retrieve the object and access its properties for further processing.
Example (Template):
go
{{$response := http.GetJsonWithHeaders "https://example.com" (dict "Authorization" "mySuperSecretToken")}}
Name: {{ $response.name }}
Example (JavaScript):

No JavaScript example exists yet.

Fetch Text

  • Returns the text that the API provides.
Example (Template):
go
{{http.GetText "https://example.com"}}
Example (JavaScript):

No JavaScript example exists yet.

Fetch Text with Headers

  • Returns the text from the specified API endpoint while including custom headers.
Example (Template):
go
{{http.GetTextWithHeaders "https://example.com" (dict "Authorization" "mySuperSecretToken")}}
Example (JavaScript):

No JavaScript example exists yet.

Calculate: Add

  • Adds a number to the value of another number.
Example (Template):
go
{{$number := 10}}
Adding 2 to {{$number}} results in {{$number := add $number 2}}
{{$number}}.
Example (JavaScript):

No JavaScript example exists yet.

Calculate: Summing

  • Calculates the sum of the values.
Example (Template):
go
{{$number := 10}}
Summing {{$number}} with 2, 3, and 4 gives {{$result := sum $number 2 3 4}}
{{$result}}.
Example (JavaScript):

No JavaScript example exists yet.

Calculate: Subtracting

  • Subtracts a number from another number.
Example (Template):
go
{$number := 10}}
Subtracting 2 from {{$number}} leads to {{$number := sub $number 2}}
{{$number}}.
Example (JavaScript):

No JavaScript example exists yet.

Calculate: Multiplying

  • Multiplies
Example (Template):
go
{{$number := 10}}
Multiplying {{$number}} by 2.1 gives {{$number := mul $number 2.1}}
{{$number}}.
Example (JavaScript):

No JavaScript example exists yet.

Calculate: Dividing

  • Divides two numbers.
Example (Template):
go
{{$number := 10}}
Dividing {{$number}} by 2 yields {{$number := div $number 2}}
{{$number}}.
Example (JavaScript):

No JavaScript example exists yet.

Calculate: Modulo

  • Returns the remainder of a number divided by another number.
Example (Template):
go
{{$number := 10}}
The remainder of {{$number}} divided by 2 is {{$remainder := mod $number 2}}
{{$remainder}}.
Example (JavaScript):

No JavaScript example exists yet.

Parse: Int

  • This function is used to convert a string representation of an integer into an actual integer value. This is useful when you have numeric data stored as strings and need to perform mathematical operations or comparisons with them.
Example (Template):
go
{{ $str := "42" }}
{{ $intVal := parseInt $str }}
Parsed Integer: {{ $intVal }}
Example (JavaScript):

No JavaScript example exists yet.

Parse: Float

  • This function is used to convert a string representation of a floating-point number into an actual float value. This is helpful when you're dealing with decimal numbers stored as strings and need to perform calculations involving fractions.
Example (Template):
go
{{ $str := "3.14" }}
{{ $floatVal := parseFloat $str }}
Parsed Float: {{ $floatVal }}
Example (JavaScript):

No JavaScript example exists yet.

Check if a variable is a number

  • Checks if a variable, for example a user input is an int or float.
Example (Template):
go
{{$strInt := "12"}}
{{isInt $strInt}}

{{$strFloat := "12.7"}}
{{isFloat $strFloat}}
Example (JavaScript):
js
// Check if a variable is an integer
const strInt = "12";
const isInteger = Number.isInteger(Number(strInt));
console.log(`Is "${strInt}" an integer:`, isInteger);

// Check if a variable is a float
const strFloat = "12.7";
const isFloat = !isNaN(strFloat) && Number(strFloat) === parseFloat(strFloat);
console.log(`Is "${strFloat}" a float:`, isFloat);

Define a variable

  • Defines the $variableName as a string with the value "value".
Example (Template):
go
{{$variableName := "value"}}
Example (JavaScript):
js
// Using let
let variableName = "value";

// Using const (for values that should not be reassigned)
const anotherVariableName = "value";

Override a variable in a scope

  • Overrides an existing variable and can thereby overwrite a variable that was written outside the scope. Later, this variable can be used again outside the scope.
Example (Template):
go
{{$variableName := ""}}
{{if eq $variableName ""}}
    {{$variableName = "test"}}
{{end}}

Variable here is: {{$variableName}}
Example (JavaScript):

No JavaScript example exists yet.

Use a variable

  • Represents the variable 'variableName' and its value can be used.
Example (Template):
go
{{$variableName := "value"}}

{{$variableName}}
Example (JavaScript):

No JavaScript example exists yet.

Define

  • With define, you can create a named reusable template section in your Go template. This allows you to define a specific piece of template logic and then call it multiple times using its name.
Example (Template):
go
{{define "greeting"}}
Hello {{sender}}! How are you?
{{end}}

{{template "greeting"}} This will render the "greeting" template at any other point in code.
Example (JavaScript):

No JavaScript example exists yet.

Define with arguments

  • With define and arguments, you can create a more flexible template section that accepts dynamic values as input. This allows you to reuse the same template logic while customizing certain parts of it based on the provided arguments.
Example (Template):
go
{{define "customGreeting"}}
    Hello, {{.Name}}! {{.Message}}
{{end}}

{{ template "customGreeting" $object }}  // This will render the customGreeting template with the provided data.

{{ template "customGreeting" (dict "Name" "Alice" "Message" "Have a great day!") }} // This will render the "customGreeting" template with the provided data at any other point in code.
Example (JavaScript):

No JavaScript example exists yet.

If statement

  • If statements are used to conditionally execute code based on specified conditions.
Example (Template):
go
{{$string := "test"}}
{{if eq $string "test"}}
  The String is test.
{{end}}
Example (JavaScript):
js
let string = "test";
if (string === "test") {
  console.log("The string is test.");
}

If-Else Statement

  • If-Else statements are used to provide an alternative code block that executes when the condition specified in the If statement is not met.
Example (Template):
go
{{$string := "test"}}
{{if eq $string "test"}}
    The String is test.
{{else}}
    The String is not test.
{{end}}
Example (JavaScript):
js
let string = "test";
if (string === "test") {
    console.log("The string is test.");
} else {
    console.log("The string is not test.");
}

If-Else If Statement

  • If-Else If statements allow you to test multiple conditions in a sequential manner. When the first condition is met, the corresponding code block is executed, and the rest of the conditions are not checked.
Example (Template):
go
{{$value := 3}}
{{if eq $value 1}}
    The value is 1.
{{else if eq $value 2}}
    The value is 2.
{{else if eq $value 3}}
    The value is 3.
{{else}}
    The value is something else.
{{end}}
Example (JavaScript):
js
let value = 3;
if (value === 1) {
    console.log("The value is 1.");
} else if (value === 2) {
    console.log("The value is 2.");
} else if (value === 3) {
    console.log("The value is 3.");
} else {
    console.log("The value is something else.");
}

Get specific element of an array

  • Returns the specific element from the array provided.
Example (Template):
go
The first element of the array is: {{index array 0}}
Example (JavaScript):
js
let array = ['apple', 'banana', 'cherry'];
console.log("The first element of the array is:", array[0]);

Get elements of all command args as String

  • Returns all arguments as a string starting from the specified position in the array.
Example (Template):
go
This command has the following args: {{argsString 0}}
Example (JavaScript):

No JavaScript example exists yet.

Create a command

  • Will create a command with a response.
Example (Template):
go
{{$resp := kicklet.CreateCommand "discord" "Join on my discord: discord.gg/my-discord"}}
{{if eq $resp.Error 0}}
  create command successfully
{{else if eq $resp.Error 1}}
  command limit is reached
{{else if eq $resp.Error 2}}
  command already exists
{{end}}
Example (JavaScript):

No JavaScript example exists yet.

Edit a command

  • Will edit the command with the response.
Example (Template):
go
{{$resp := kicklet.EditCommand "command" "new message"}}
{{if eq $resp.Error 0}}
  command updated successfully
{{else if eq $resp.Error 1}}
  command not exists
{{end}}
Example (JavaScript):

No JavaScript example exists yet.

Activate/deactivate a command

  • Will activate/deactivate the specific command.
Example (Template):
go
{{$resp := kicklet.ActivateCommand "discord" true}}
{{if eq $resp.Error 0}}
  command activated successfully
{{else if eq $resp.Error 1}}
  command not exists
{{end}}
Example (JavaScript):

No JavaScript example exists yet.

Activate/deactivate a command group

  • Will activate/deactivate the specific command group.
Example (Template):
go
{{$resp := kicklet.ActivateCommandGroup "groupName" true}}
{{if eq $resp.Error 0}}
command group activated successfully
{{else if eq $resp.Error 1}}
command group not exists
{{end}}
Example (JavaScript):

No JavaScript example exists yet.

Binary Comparison Operators

In this section, we describe a set of binary comparison operators defined as functions. These operators are used to compare two values and return boolean results based on the specified condition.

EQ

  • Returns the boolean truth of whether arg1 is equal to arg2.
Example (Template):
go
{{if eq 10 10}}
    This condition is true.
{{else}}
    This condition is false.
{{end}}

NE

  • Returns the boolean truth of whether arg1is not equal toarg2`.
Example (Template):
go
{{if ne "apple" "banana"}}
    This condition is true.
{{else}}
    This condition is false.
{{end}}

LT

  • Returns the boolean truth of whether arg1 is less than arg2.
Example (Template):
go
{{if lt 5 10}}
    This condition is true.
{{else}}
    This condition is false.
{{end}}

LE

  • Returns the boolean truth of whether arg1 is less than or equal to arg2.
Example (Template):
go
{{if le 20 20}}
    This condition is true.
{{else}}
    This condition is false.
{{end}}

GT

  • Returns the boolean truth of whether arg1 is greater than arg2.
Example (Template):
go
{{if gt 100 50}}
    This condition is true.
{{else}}
    This condition is false.
{{end}}

GE

  • Returns the boolean truth of whether arg1 is greater than or equal to arg2.
Example (Template):
go
{{if ge 30 40}}
    This condition is true.
{{else}}
    This condition is false.
{{end}}

Send Discord Webhooks

  • It is possible to send a Discord webhook directly within a template, which means sending a message to a specific Discord channel. Simply define the Discord scope in which you can specify the content to be sent to Discord. Outside of that, you can call this template and provide a link to which the Discord message should be sent
Example (Template):
go
{{discord.SendMessage "https://discord.com/api/webhooks/xx/xx" "discord"}}

{{define "discord"}}
    {"content": "{{sender}} has {{kick.Followers}} followers"}
{{end}}
Example (JavaScript):
js
const json = {
  "content": "Hello from JavaScript!"
};

function sendDiscordWebhook() {
    Discord.sendMessage('https://discord.com/api/webhooks/xx/xx', json);
}

Console Logging

  • Logs the provided object to the console. Note that the console log is limited to 100 items, and if the provided string is longer than 200 characters, it won't be logged.
Example (Template):
go
{{console "hello console!"}}
Example (JavaScript):
js
console.log('hello console!');

Comments

  • Represents a comment in the code that neither provides functionality nor gets rendered in the template.
Example (Template):
go
{{/* Author: Kicklet */}}
Example (JavaScript):
js
// Author: Kicklet

Get Currency Name

  • Returns the currency name configured by the streamer.
Example (Template):
go
{{kicklet.Currency}}
Example (JavaScript):
js
const currency = Kicklet.getCurrency();

Get Messages Count

Example (Template):

Get the count of messages by viewer kickUsername

go
{{kicklet.MessagesCount "kickUsername"}}

Get the count of messages by command sender

go
{{kicklet.MessagesCount sender.String}}
Example (JavaScript):
js
const messages = Kicklet.messagesCount('kickUsername')
  .then(resp => resp.data);

Command Execution Amount

  • Returns the command execution amount in the last given timespan.
Example (Template):
go
{{kicklet.CommandsExecutions "1d"}}
Example (JavaScript):
js
const executions = Kicklet.commandsExecutions('1d')
    .then(resp => resp.data);

Specific Command Execution Amount

  • Returns the command execution amount for a specific command in the last given timespan.
Example (Template):
go
{{kicklet.CommandExecutions "command" "1d"}}
Example (JavaScript):
js
const executions = Kicklet.commandExecutions('command', '1d')
    .then(resp => resp.data);

Command Execution Ranking

  • Returns a command execution ranking in the last given timespan.

Parameters

  • amount (String): Indicates the number of top commands to be displayed. For example, the top 5.
  • timespan (String): Specifies the time span for which the command ranking should be shown. For example, "1d".
Example (Template):
go
{{kicklet.CommandsExecutionsRanking 5 "1d"}}
Example (JavaScript):

No JavaScript example exists yet.

Current Song

  • Returns the current song playing in the requests.
Example (Template):
go
{{kicklet.CurrentSongTitle}}
Example (JavaScript):
js
const currentSong = Kicklet.getCurrentSong()
    .then(resp => resp.data.title);

Clear Song requests

  • Returns: result.
Example (Template):

No Template example exists yet.

Example (JavaScript):
js
Kicklet.clearSongRequests();

Skip Song

  • Returns: result.
Example (Template):

No Template example exists yet.

Example (JavaScript):
js
Kicklet.skipSong();

Request a Song

  • Returns: result.
Example (Template):

No Template example exists yet.

Example (JavaScript):
js
const sender = $event.getSender();
const result = Kicklet.songRequest(sender, 'video-id', 300);

300 is the maximum time in seconds for the song.

Set Global Variable

Sets a global variable with a specified key and an optional time duration (TTL). This operation allows you to store data globally for a specified timeframe or indefinitely if no TTL is provided.

Parameters

  • variableName (String): The name of the variable.
  • variable (Any): The variable to be stored. It can be of any data type, but it should be JSON-serializable.
  • ttl (Integer, optional): Time to live for the variable in seconds. If provided, the variable will only be stored for the specified duration. If not provided, the variable will be stored indefinitely.
Example (Template):

This variable will exists for 600 seconds:

go
{{kicklet.SetGlobalVar "myVariable" "theValue" 600}}

This variable will exists forever:

go
{{kicklet.SetGlobalVar "myVariable" "theValue" 0}}
Example (JavaScript):

This variable will exists for 600 seconds:

js
Kicklet.setGlobalVar('myVariable', 'theValue', 600);

This variable will exists forever:

js
Kicklet.setGlobalVar('myVariable', 'theValue');

Get Global Variable

Retrieves the value of a global variable based on the specified variable name.

Parameters

  • variableName (String): The name of the global variable for which you want to retrieve the value.
Example (Template):
go
{{kicklet.GetGlobalVar "myVariable"}}
Example (JavaScript):
js
const value = Kicklet.getGlobalVar('myVariable');

Delete Global Variable

Deletes a global variable based on the specified variable name. This operation allows you to remove the stored data associated with a particular global variable.

Parameters

  • variableName (String): The name of the global variable for which you want to delete the value.
Example (Template):
go
{{kicklet.DeleteGlobalVar "myVariable"}}
Example (JavaScript):
js
Kicklet.deleteGlobalVar('myVariable');

Set Viewer Variable

Sets a viewer variable with a specified key and an optional time duration (TTL). This operation allows you to store data specific to an individual user either for a certain timeframe (temporary) or permanently if no TTL is provided.

Parameters

  • variableName (String): The name of the variable.
  • viewer (String): The name of the viewer/user for whom the variable is being set.
  • variable (Any): The variable to be stored. It can be of any data type, but it should be JSON-serializable.
  • ttl (Integer, optional): Time to live for the variable in seconds. If provided, the variable will only be stored for the specified duration. If not provided, the variable will be stored indefinitely.
Example (Template):

The following example illustrates how to assign the value theValue to the variable myVariable. The variable has a lifespan of 120 seconds.

go
{{kicklet.SetViewerVar "myVariable" sender.String "theValue" 120}}

The following example demonstrates how to assign the value theValue to the variable myVariable for the specific user. Since the TTL is set to 0, the variable will be stored permanently and will not expire.

go
{{kicklet.SetViewerVar "myVariable" sender.String "theValue" 0}}
Example (JavaScript):
js
const sender = $event.getSender();
Kicklet.setViewerVar('myVariable', sender, {
    points: 12,
    anotherThing: 'just a string'
}, 120);

Get Viewer Variable

Retrieves the value of a viewer variable based on the specified variable name and viewer.

Parameters

  • variableName (String): The name of the variable for which you want to retrieve the value.
  • viewer (String): The name of the viewer/user for whom the variable value is being retrieved.
Example (Template):
go
{{kicklet.GetViewerVar "myVariable" sender.String}}
Example (JavaScript):
js
const sender = $event.getSender();
const v = Kicklet.getViewerVar('myVariable', sender);

Delete Viewer Variable

Deletes a viewer variable based on the specified variable name and viewer. This allows you to remove stored data associated with a particular user and variable.

Parameters

  • variableName (String): The name of the variable for which you want to delete the value.
  • viewer (String): The name of the viewer/user for whom the variable value is being deleted.
Example (Template):
go
{{kicklet.DeleteViewerVar "myVariable" sender.String}}
Example (JavaScript):
js
const sender = $event.getSender();
Kicklet.deleteViewerVar('myVariable', sender);

Clear Viewer Variables

Clears all instances of a viewer variable for all viewers. This operation removes the stored data associated with a particular variable, affecting all users who have data stored under that variable name.

Parameters

  • variableName (String): The name of the variable for which you want to clear all instances.
Example (Template):
go
{{kicklet.ClearViewerVar "myVariable"}}
Example (JavaScript):
js
// delete variable myVariable for all viewers
Kicklet.clearViewerVar('myVariable');

Play Gif

Plays a GIF for a specified duration.

Parameters

  • url (String): The URL of the GIF to play. It must be a string pointing to a valid GIF file.
  • duration (Integer): The duration in seconds for which the GIF should be played.
Example (Template):
go
{{kicklet.PlayGif "https://files.kicklet.app/the-file.gif" 5}}
Example (JavaScript):
js
async function play() {
    await Kicklet.playGif('https://files.kicklet.app/the-file.gif', 5);
}

TIP

Pressing CTRL + I in the Advanced Editor opens the menu for selecting asset files.

Play Sound

Plays a sound file for a specified duration with optional volume control.

Parameters

  • url (String): The URL of the sound file to play. It must be a string pointing to a valid sound file.
  • duration (Integer): The duration in seconds for which the sound should be played.
  • volume (Integer, optional): The volume percentage from 0 to 100. If not specified, the default volume setting will be used.
Example (Template):
go
{{kicklet.PlaySound "https://files.kicklet.app/the-file.mp3" 5 10}}
Example (JavaScript):
js
async function play() {
    await Kicklet.playSound('https://files.kicklet.app/the-file.mp3', 5, 10);
}

TIP

Pressing CTRL + I in the Advanced Editor opens the menu for selecting asset files.

Play Sound and Gif

Plays a sound file and a GIF simultaneously for a specified duration with optional volume control.

Parameters

  • soundUrl (String): The URL of the sound file to play.
  • gifUrl (String): The URL of the GIF to display.
  • duration (Integer): The duration in seconds for which the sound and GIF should be played.
  • volume (Integer, optional): The volume percentage for the sound. If not specified, the default volume setting will be used.
Example (Template):
go
{{kicklet.PlaySoundGif "https://files.kicklet.app/the-sound.mp3" "https://kicklet.app/the-gif.gif" 5 10}}
Example (JavaScript):
js
async function play() {
    await Kicklet.playSoundGif('https://files.kicklet.app/the-sound.mp3', 'https://kicklet.app/the-gif.gif', 5, 10);
}

TIP

Pressing CTRL + I in the Advanced Editor opens the menu for selecting asset files.

Custom Event

Initiates a custom event, optionally carrying extra data, designed for integration within custom overlay widgets.

Parameters

  • eventName (String): The name of the event. It must be a string.
  • data (Any, optional): Additional data to pass with the event. This can be text, numbers, nil, or a dictionary containing multiple values. The data should be JSON-serializable.
Example (Template):
go
{{kicklet.CustomEvent "myEvent" "a additional text"}}
{{kicklet.CustomEvent "myEvent" nil}}
{{kicklet.CustomEvent "myEvent" 190}}
{{kicklet.CustomEvent "myEvent" (dict "text" "a simple text as variable" "num" 190)}}
Example (JavaScript):
js
async function trigger() {
    await Kicklet.customEvent('myEvent', {
        text: 'a simple text as variable',
        num: 190,
    });
}

Set Auto Title

Sets the title of the stream.

Parameters

  • title (String): The title to set for the stream.
Example (Template):
go
{{kicklet.SetAutoTitle "my stream title"}}
Example (JavaScript):
js
await Kicklet.setAutoTitle('my stream title');

Set Auto Title Active

Activates or deactivates the automatic title setting for the stream.

Parameters

  • isActive (Boolean): A boolean value to activate (true) or deactivate (false) the auto title setting.
Example (Template):
go
{{kicklet.SetAutoTitleActive true}}
{{kicklet.SetAutoTitleActive false}}
Example (JavaScript):
js
await Kicklet.setAutoTitleActive(true);
await Kicklet.setAutoTitleActive(false);

Timeout

Temporarily prevents a user from interacting with the chat for a specified duration in minutes.

Parameters

  • user (String): The username of the user to be timed out. This can be sender or a specific username.
  • duration (Integer): The duration of the timeout in minutes.
Example (Template):
go
{{kick.Timeout sender 1}}
{{kick.Timeout "JohnKicklet" 1}}
Example (JavaScript):
js
await Kick.timeout('JohnKicklet', 1);

Ban

Permanently prevents a user from interacting with the chat.

Parameters

  • user (String): The username of the user to be timed out. This can be sender or a specific username.
Example (Template):
go
{{kick.Ban sender}}
{{kick.Ban "JohnKicklet"}}
Example (JavaScript):
js
await Kick.ban('JohnKicklet');

Clear Chat

Clears all messages in the chat.

Example (Template):
go
{{kick.ClearChat}}
Example (JavaScript):
js
await Kick.clearChat();

Ban All

Bans all users whose messages match the given text.

Parameters

  • text (String): The text to match messages against.
Example (Template):
go
Banned {{kick.BanAll "hello"}} viewers
Example (JavaScript):
js
async function ban() {
    await Kick.banAll('hello');
}

Ban All with Excluded Roles

Bans all users whose messages match the given text, excluding users with specified roles.

Parameters

  • text (String): The text to match messages against.
  • roles (List): The roles to be excluded from the ban.
Example (Template):
go
Banned {{kick.BanAll "hello" "vip" "og"}} viewers
Example (JavaScript):
js
async function ban() {
    await Kick.banAll('hello', {
        excludedRoles: ['vip', 'og'],
    });
}

Ban All with Similarity Threshold

Bans all users whose messages match the given text based on a similarity threshold.

Parameters

  • text (String): The text to match messages against.
  • threshold (Integer): The similarity threshold (percentage).
Example (Template):
go
Banned {{kick.BanAllSimilarity "hello" 40}} users
Example (JavaScript):
js
async function ban() {
    await Kick.banAll('hello', {
        similarity: 40,
    });
}

Ban All with Similarity Threshold and Excluded Roles

Bans all users whose messages match the given text based on a similarity threshold, excluding users with specified roles.

Parameters

  • text (String): The text to match messages against.
  • threshold (Integer): The similarity threshold (percentage).
  • roles (List): The roles to be excluded from the ban.
Example (Template):
go
Banned {{kick.BanAllSimilarity "hello" 40 "vip" "og"}} users
Example (JavaScript):
js
async function ban() {
    await Kick.banAll('hello', {
        similarity: 40,
        excludedRoles: ['vip', 'og'],
    });
}

Timeout All

Temporarily prevents all users whose messages match the given text from interacting with the chat for a specified duration in minutes.

Parameters

  • text (String): The text to match messages against.
  • duration (Integer): The duration of the timeout in minutes.
Example (Template):
go
Timed out {{kick.TimeoutAll "hello" 2}} users two minutes
Example (JavaScript):
js
async function timeout() {
    await Kick.timeoutAll('hello', 2);
}

Timeout All with Excluded Roles

Temporarily prevents all users whose messages match the given text from interacting with the chat for a specified duration in minutes, excluding users with specified roles.

Parameters

  • text (String): The text to match messages against.
  • duration (Integer): The duration of the timeout in minutes.
  • roles (List): The roles to be excluded from the ban.
Example (Template):
go
Timed out {{kick.TimeoutAll "hello" 2 "vip" "og"}} users two minutes
Example (JavaScript):
js
async function timeout() {
    await Kick.timeoutAll('hello', 2, {
        excludedRoles: ['vip', 'og'],
    });
}

Timeout All with Similarity Threshold

emporarily prevents all users whose messages match the given text from interacting with the chat for a specified duration in minutes based on a similarity threshold.

Parameters

  • text (String): The text to match messages against.
  • duration (Integer): The duration of the timeout in minutes.
  • threshold (Integer): The similarity threshold (percentage).
Example (Template):
go
Timed out {{kick.TimeoutAllSimilarity "hello" 2 40}} users two minutes
Example (JavaScript):
js
async function timeout() {
    await Kick.timeoutAll('hello', 2, {
        similarity: 40,
    });
}

Timeout All with Similarity Threshold and Excluded Roles

Temporarily prevents all users whose messages match the given text from interacting with the chat for a specified duration in minutes based on a similarity threshold, excluding users with specified roles.

Parameters

  • text (String): The text to match messages against.
  • duration (Integer): The duration of the timeout in minutes.
  • threshold (Integer): The similarity threshold (percentage).
  • roles (List): The roles to be excluded from the ban.
Example (Template):
go
Timed out {{kick.TimeoutAllSimilarity "hello" 2 40 "vip" "og"}} users two minutes
Example (JavaScript):
js
async function timeout() {
    await Kick.timeoutAll('hello', 2, {
        similarity: 40,
        excludedRoles: ['vip', 'og'],
    });
}

Text-to-Speech (TTS) with Specified Voice

Converts the given text to speech using a specified voice.

Parameters

  • voice (String): The voice to be used for the TTS. This could be a predefined voice type available in the system.
  • text (String): The text to be converted to speech.
Example (Template):
go
{{ kicklet.TTS "Brian" "Hello, this is a test message." }}
Example (JavaScript):
js
await Kicklet.tts('Brian', 'Hello, this is a test message.');
Voices

Here are some voices listed as examples:

vidnameflaglangaccentgender
BrianBrianGBEnglishBritishM
AmyAmyGBEnglishBritishF
EmmaEmmaGBEnglishBritishF
GeraintGeraintGB-WLSEnglishWelshM
RussellRussellAUEnglishAustralianM
NicoleNicoleAUEnglishAustralianF
JoeyJoeyUSEnglishAmericanM
JustinJustinUSEnglishAmericanM
MatthewMatthewUSEnglishAmericanM
IvyIvyUSEnglishAmericanF
JoannaJoannaUSEnglishAmericanF
KendraKendraUSEnglishAmericanF
KimberlyKimberlyUSEnglishAmericanF
SalliSalliUSEnglishAmericanF
RaveenaRaveenaINEnglishIndianF

See all voices here