TwitchPopups
Allows Twitch mods to display popup text on the stream via chat commands
COMMAND LIST
- !alert: will display whatever text comes after the !alert command
- !spotlight [@username]: will display the chat of the specified user from that point on
- !delete: will delete the popup
DOWNLOAD
The latest version of TwitchPopups can be found as a zip archive here
INSTRUCTIONS
- Extract the zip archive
- Edit settings.js and change "Limmy" to your Twitch channel name
- Use OBS/Streamlabs OBS to add twitchpopups.htm as a browser source (Fit to Screen, 1920x1080)
- Tick "Shutdown source when not visible" in browser source properties. That way, any tweaks you make are reloaded when you toggle the visibility button
UPGRADE
- Open your existing twitchpopups.htm and copy your configuration settings
- Download the latest version
- Open the zip archive and open the TwitchPopups-master directory
- Select all of the files and drag them into your existing TwitchPopups directory. Say yes to any prompts to overwrite files but be careful not to overwrite your custom animations!
- Edit the configuration section at the top of twitchpopups.htm, pasting in your settings from step 1.
- If OBS hasn't recognized the update press the "refresh cache of current page" button in browser source properties.
ADVANCED: ADD CUSTOM HANDLERS
If you want to add your own handlers, you will need to understand JavaScript and the tmi.js library. There are a few extra things to consider.
- Do you want it to fire based on a !command?
- Do you want it to fire on every chat?
- What security should prevent the handler being fired? e.g mod only, spotlight only etc.
- What should the handler do?
Once you have answered those questions you are ready to add the handler.
- Navigate to the handlers.js
- If you want a command copy the following code into the file:
actionHandlers['!command'] = {
security: (context, textContent) => {
return true; // This should return a boolean, true will fire the handler
},
handle: (context, textContent) => {
// Place handle script here
}
};
- If you want a general command copy the following code into the file:
allHandlers.push({
security: (context, textContent) => {
return true; // This should return a boolean, true will fire the handler
},
handle: (context, textContent) => {
// Place handle script here
}
});
- Complete your handler and don't forget to add a description to the readme.md
ADVANCED: POPUP HELPER
The popup helper contains a few functions so you don't need to worry about the animations for the popup box! it can be accessed anywhere by typing popup
followed by a function.
Methods:
popup.showText(text, bgColour)
: Displays popup on screen with the given text and colour.
popup.delete()
: Removes popup from screen and resets state of all commands.
popup.formatEmotes(message, emotes, upperCase)
: Formats text with emotes, This must be past only and all message un-formatted or emotes wont be replaced properly. e.g popup.formatEmotes('Hello Twitch', context.emotes, true).substr(7)
The substr function removes the !command, just change the number to the length of the command.