Giter Site home page Giter Site logo

twitchpopups's Introduction

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

  1. Extract the zip archive
  2. Edit settings.js and change "Limmy" to your Twitch channel name
  3. Use OBS/Streamlabs OBS to add twitchpopups.htm as a browser source (Fit to Screen, 1920x1080)
  4. 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

  1. Open your existing twitchpopups.htm and copy your configuration settings
  2. Download the latest version
  3. Open the zip archive and open the TwitchPopups-master directory
  4. 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!
  5. Edit the configuration section at the top of twitchpopups.htm, pasting in your settings from step 1.
  6. 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.

  1. Do you want it to fire based on a !command?
  2. Do you want it to fire on every chat?
  3. What security should prevent the handler being fired? e.g mod only, spotlight only etc.
  4. What should the handler do?

Once you have answered those questions you are ready to add the handler.

  1. Navigate to the handlers.js
  2. 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
    }
};
  1. 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
    }
});
  1. 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.

twitchpopups's People

Contributors

cohan avatar daftlimmy-zz avatar gantonator avatar jeddunk avatar m3lbz avatar rcjuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

twitchpopups's Issues

HELP: load anims into iframe

I NEED YOUR HELP! I've talked about this before, but I've created a new branch called load-anims-into-iframe, and the mission is to load the animations into an iframe.

Why?

So that the streamer can create various html pages with animations and popups of every description without cluttering the main twitchpopups.html page.

By doing it that way, I think it'll be more straightforward for the streamer (e.g. me) to create each animation page independently, test it more easily, not worry about css conflicts and so on. And they can receive variables either through GET or localstorage or some other method.

I've attempted it myself and it works alright, but the animations sometimes stutter when I load in the page, even though I've got them running after onload. Don't know why.

Anyway, I'D APPRECIATE YOUR HELP.

Feel free to tell me if you think it's a bad idea.

[Bug] Over extended background on first run

I have notices a minor bug where the first time an alert is shown, the alert box is extended, and subsequent run appears to work fine though.

What I did:
Run an !alert test test

What I expected:
A popup to appear with correct dimensions: (screen grab taken when I ran the alert a second time)
image

What happens:
image

Readme.md needs updating

Readme.md instructions section says to edit twitchpopups.htm instead of the new settings.js file.

Usernames are cut off when omitting @ symbol in command

Script should gracefully handle usernames whether provided with preceding @ symbol or not.

e.g. !hotseat roachfrags should produce same behaviour as !hotseat @roachfrags

Currently, the script assumes the first character is @ and removes it regardless.

image

[Discussion] Making it hosted

MojoChin on the discord suggested that instead of having this as a download, have it hosted like https://daftlimmy.github.io/Swearing-Xylophone/

This way instead of downloading the package, streamers could instead put in their browser source something like

https://daftlimmy.github.io/TwitchPopups/?channel=Limmy&bgColour=123456

and they'd have the latest, new, up to date version of the code with just a source refresh

[Feature request] Display last 5 messages of the user

Would be nice to have the latest message bottom, but then, above it, the last 4 messages in a smaller font.

While doing that, maybe when activating the hotseat, we can already display the last message (which is likely the one that triggered the hotseat activation) of the user instead of waiting for a new message.

[Discussion] Move configuration to its own file

If we move the configuration to its own file (e.g. something like configuration.js) we can then keep a configuration-sample.js in the git repository and instruct the user to copy that file to configuration.js and edit it when they first install.

This also means when they update they don't overwrite their configuration each time

Having it as its own file instead of a big wall of text at the top of twitchpopups.htm makes it less imposing for non-coder types and means we can put more options in there. For example maybe one streamer doesn't want to call it a hotseat, there could be hotseatName = 'the bin', hotseatCommand = '!bin" config options.

[Feature request] Handle long messages.

As highlighted on the stream long messages to the hotseat are cut off. Maybe there is a better way of displaying messages that still looks good and can handle a broader range of messages.

[Feature request] Implement a banned/cursed word list

Hey there,

Wouldn't it be nice to have the possibility to obfuscate curse words to avoid people being abusing the system?

Not sure how we would go about this.
Maybe have a separate JS with the list, but then we need an efficient way of mask those words in the user's message.

What are your thoughts?

[Feature request] Only talk to Limmy in the hotseat!

Hi @DaftLimmy , I know you know this because you're a pro-coder. But for others, this is the issues section of github which can track bugs that need fixing or suggesting new features. Like a to do list. Anyway here is the 'issue':

If someone in the hotseat @ replies to another user, that message should be ignored by the hotseat.

[Suggestion] Move the consts (twitch channel, twitch emotes etc.) to config or .env file

This will prevent mistakes where someone forgets to change their channel name back after committing their changes. Would be useful to prevent a rare case of abuse or just any time wasted figuring out why the commands aren't working only to find out it was someone elses channel in the const.

Moving these constants into a .env file or web.config setup will mean no live config file will need to be committed. Instead a .env.example file pulled on first instance with example variables which can be copied into a .env and populated with the user's preferred details.

The .env/config file can be added to a .gitignore preventing anybody from accidentally leaving their channel details or preferences committed (e.g. colors etc.). Will save time on having to keep track of what constants have been changed on every commit.

I can add this if wanted.

Loading external html

I'm maybe overcomplicating things here but I've been thinking of redoing the code that it loads in the animations from external html files.

That way, streamers can do a slight tweak to the main twitchpopups.html file to say which pages are to be loaded in for which commands, and then they can make a separate page for each animation.

Imagine you had a dozen animations, maybe even twenty or thirty. You wouldn't want all those animations coded in the main page would you?

Anyway, I tried it and I ran into one issue after another.

Before anybody goes ahead and attempts it, what are your thoughts?

Can't get it working?

I've followed these instructions as accurately as possible and I can't get it working for me at all. Has this happened for anyone else?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.