This application is highly customizable with simple JavaScript configuration. Here you will find all of the options we have built-in and how to use them.
Table of Contents:
This app is pre-configured to my needs for the time being. Feel free to fork and use your own configuration. In the future we hope to make configuration even simpler with JSON which could allow upgrade paths to receive new features.
Configuration is stored at src/pages/obs-overlays/*
.
The main configuration that holds some loose items and imports additional configuration from config/*
.
Required options:
NOTIFICATION_AUTO_CLOSE_TIMEOUT
is stored in millisecondsDEFAULT_NOTIFICATION_TEMPLATE
fromindex.html
(defaults to"message-template"
)DEFAULT_NOTIFICATION_SOUND
fromconfig/sourceSounds.mjs
names (defaults to"wow"
)DEFAULT_SOUND_CLIP_VOLUME
is used in Sound Player as a fallback ifconfig/soundSources.mjs
entry does not contain avolume
(defaults to0.8
)
This file stores all the event listeners from TAU's websocket_event.event_type
.
Some sample events are channel-follow
, channel-subscribe
, channel-raid
, etc. To see a full list, visit Twitch Events Specs page.
Each event has respective data so we use eventCommandCallback(eventData)
to allow you to pull data as needed. You can see the format of eventData
under the "Websocket Stream" in the TAU Dashboard
Example tauListener config
{
eventName: "channel-follow",
eventCommandCallback: (eventData) => ({
clientCommand: "renderTemplate",
args: [{
title: "New Follower",
userName: eventData.user_name,
action: "follwed",
sound: "coin",
timeout: 7 * 1000,
template: "user-action-template"
}]
})
}
Additional configuration available:
sound
which maps to aconfig.soundSources.*
nametimeout
which controls the auto-close of a notification (a millisecond value7 * 1000
, orfalse
to leave open)template
which matches the id of anindex.html
<script>
template (defaults tomessage-template
)- the remaining properties are passed to template HTML and available as
{propName}
(e.g.{userName} just {action}!
)
All of the eventCommands
will be emitted to the if you listen for it. We don't emit events if you don't have a listener for it.
This file holds all chat commands we are listening for. A chat command is triggered via Twitch Chat using a message like !clap
or with args !brb Bathroom Break
.
Commands can have specific traits to them, such as simple (minimum props required), alias, shortcuts, or provide arguments.
We start with a simple command as the bare bones for triggering things when a chat command is used.
Example of simple command:
{
commandName: "sounds",
allowedRoles: ["any"],
chatCommandCallback: () => ({
clientCommand: "renderSoundButtons"
})
}
Simple Command Props (available in all type of commands):
commandName
is the name of the command, minus the!
(e.g.!sound wow
would becommandName: "sound"
)allowedRoles
are the chatter roles required for this command to run. A chatter can run a command if they match ANY of the roles. Available roles in order of exclusivity:broadcaster
the user who is broadcasting. We use this as default to prevent exposing commands ifallowedRoles
not provided.moderator
is a moderator in the channelvip
is a vip in the channelsubscriber
is someone who is currently subscribed in the channelany
is any viewer who can send a chat
chatCommandCallback()
is used to format our data and configuration for calling client commands. Available client commands are:renderSoundButtons
renders available sound names on screen, has no argsclearScreen
clears all content on the screen, has no argsplaySound
plays a sound by name (e.g.args: ["soundName"]
)renderTemplate
renders a matchingindex.html
<script>
template by id (e.g.args: ["template-id"]
)sendBotMessage
sends a message to chat from your bot account (e.g.args: ["Message to send"]
)ignore
allows you to skip running aclientCommand
for this entry. Alternatively, you can return a falsy value fromchatCommandCallback()
.- Invalid command names and args will be ignored
- See Argument Commands for args info on
chatCommandCallback()
We define an alias command as a command with the aliases
array which allows this command to be called with a different commandName
.
Example of alias command:
{
commandName: "sound",
aliases: ["s"],
allowedRoles: ["any"],
chatCommandCallback: ({ commandName, args }) => ({
clientCommand: "playSound",
args
})
}
Alias Command Props:
aliases
should be an array of alias strings (e.g.aliases: ["s"]
allows!s soundName
to rewrite to!sound soundName
). Any arguments passed will be passed along to maincommandName
.
We define a shortcut command as a command with the shortcuts
property which triggers additional commands you've defined.
Example of shortcut command:
{
commandName: "clap",
allowedRoles: ["any"],
shortcuts: ["!s clap"]
}
Shortcut Command Props:
- Inherits all simple command props
shortcuts
allow us to run other commands. It works as if a user was to send a message with the shortcut (e.g.ched_dev: !sound wow
) so permissions of the shortcut will be honored by their command (e.g.commandName: "sound"
)- can still use
chatCommandCallback()
if desired
We define an argument command as a command that passes arguments on to the client command. You can pass args through as they were given, or generate your own args based on passed in args.
Example of argument command:
{
commandName: "sound",
aliases: ["s"],
allowedRoles: ["any"],
chatCommandCallback: ({ commandName, args }) => ({
clientCommand: "playSound",
args
})
}
Argument Command Props:
- Inherits props from all other types of commands
chatCommandCallback()
should returnargs
that are passed on to the client command. They are spread on as arguments (e.g.args: ["one", "two"]
will becomeplaySound("one", "two")
).
Example of chatCommandCallback()
with dynamic args:
{
commandName: "brb",
allowedRoles: ["broadcaster"],
chatCommandCallback: ({ commandName, args }) => ({
clientCommand: "renderTemplate",
args: [
{
template: "message-template",
message: `BRB ~ ${args.join(" ") || "Feeding the cat"}`,
sound: "brb",
timeout: false
}
]
})
}
chatCommandCallback()
arguments:
commandInfo
is the only argument passed tochatCommandCallback()
and it's an object with the following properties:commandName
is the name of the command (e.g.sound
,s
,brb
). This could be different than thecommandName
on the top level because it could be one of thealiasCommands
.args
is the remaining values split on an empty string (e.g.!brb Bathroom Break
->args: ["Bathroom", "Break"]
and!sound wow
->args: ["wow"]
). You can use the args to allow subcommands or combine back to one value (e.g.args.join(" ")
->"Bathroom Break"
).channelName
is the name of the channel this is running in (e.g.#ched_dev
)chatter
is aggregated information about the chatter. Available properties include:roles
- see roles
features
firstMessage
is true if it's the users first message in this channelhighlightedMessage
is whether the message was redeemed with "Highlight My Message"
This file holds all sounds that can be played with the Sound Player. The key of the object is the sound name. The sound name is what matches with the !sound soundName
command.
Example of sound source config:
'airhorn': {
audioSource: 'sounds/air-horn.mp3',
volume: 0.2
}
Sound source props:
- the key name (e.g.
'airhorn'
) is how we reference thesoundName
. It can be formatted how you please (e.g.air-horn
,air_horn
,airHorn
) but cannot contain spaces and is case sensitive. audioSource
is the path to the sound file. We store all sounds insounds/*
.volume
is the volume level to set for this specific sound. A value of0 ... 1
(e.g.0.3
,1.0
). If none is provided we use a default value fromconfig/config.mjs
. We use this to level out volume of loud vs quiet clips, then you can set the global volume level in OBS audio output.
This file holds additional configuration related to tmi.js, but we don't support additional tmi.js configuration yet.