Template Reference

Each command has a context, which describes where the command was called and which command it is.

WARNING

This is tested on Twitch and may not work on other platforms.

Command

FieldTypeDescription
command.commandstringThe command.
command.commandsarrayList of all aliases including base command.
command.command_aliasesarrayList of all aliases without base command.
command.responsemixedUser defined response or template script.
command.command_regexstringNot used. Regex that will be evaluated when a user enters a command.
command.permissionsintLimit who can execute the command.
command.priceintPrice paid for each call.
command.send_asstringThe way the response is sent.
command.enable_whenstringCommands can only be triggered offline/online/both.
command.user_cooldownintUser Cooldown in seconds during which the command may not be executed.
command.global_cooldownintChannel Cooldown in seconds during which the command may not be executed.
command.is_visibleboolIndicating whether the command is displayed in the command overview.

Arguments

FieldTypeDescription
argsarrayList of all arguments including base command.

IRC

FieldTypeDescription
irc.channelstringRaw channel username.
irc.messagestringRaw message.

Object Reference

Some functions (described below) of the chatbot return objects. All objects are listed here:

User

FieldTypeDescription
idstringUser's ID.
namestringUser's display name.
typestringUser's broadcaster type: "partner", "affiliate", or "".
descriptionstringUser's channel description.
view_countintTotal number of views of the user's channel.

Channel

FieldTypeDescription
idstringTwitch User ID of this channel owner.
namestringTwitch user display name of this channel owner
urlstringLink to the channel.
languagestringLanguage of the channel.
titlestringTitle of the stream.
gamestringName of the game being played on the channel.

Functions beta

Database

You have access to a basic set of Database functions, this is almost a key value store ordered by the key and value combined.

We lazy-load the data from the database. This means that if you use set and then make a db, you may still have cached data.

FunctionDescription
db('channel').nameFetch the name from the channel table.
inc('membership', 'currency', 1)Increment the currency from the membership table.
dec('membership', 'currency', 1)Decrement the currency from the membership table.
set('membership', 'currency', 1)Set the currency from the membership table.

Cache

You also have access to a basic set of Cache functions, this is almost a key value store ordered by the key and value combined.

Data is stored in the cache for a maximum of one day. Always assume that data could not exist in a cache.

FunctionDescription
cache('timely')Fetch the value for the specified key.
cache('timely', 1, 300)Sets the value for the specified key to the specified value. With Expiration in seconds.
cache('timely', 1)Sets the value for the specified key to the specified value. With a default expiration of one day.

API

If you want to retrieve twitch related information, then the following methods are available to you. Note that twitch now works with ID's instead of login name, so for some functions you have to enter the user ID instead of login name.

FunctionDescription
user('username')Fetch the user object from the twitch api by login name. The response returns a User object or null.
channel('106415581')Fetch the channel object from the twitch api by user-id. The response returns a Channel object or null.

HTTP JSON Requests

With the json function you can download data from a JSON API. The response can be an array, or null if the api returns an error.

Random Quote: {{ json('GET', 'https://api.quotable.io/random').content }}

TIP

Cache your json responses. Requests that take longer than 5 seconds are automatically aborted. Furthermore, this method has a rate limit of 15 requests per minute.