Making a twitch bot with html graphics and need some help\advice

html
javascript

#1

So basically I am making a twitch bot that lets users vote with emotes in chat and then generates a little HTML graphics (two emotes on different sides and a third one that moves closer to the one that is currently ahead in votes), and ran into some technical issues due to my insufficient knowledge in web dev.

I have a working twitch text bot in one .js file and a HTML page with graphics which are controlled by another .js file. (1. Is this a bad setup for what I am trying to make?)

The first problem is that I am unable to run both the bot and the HTML at the same time. (2. Is it possible on Glitch at all? 3. Is it possible with my current setup and if so, how?)
When I run the bot and click live it endlessly shows me the “Starting” page.

The second problem is that I don’t how my HTML js script can grab my twitch bots voting data\variable to change the HTML accordingly.
Would love to hear solutions\things I need to learn to make this work.


#2

Maybe have a package.json starting the project on the bot js file, then inside the bot file, have express running the html! That should work maybe.


#3

Hey @Zitgard, welcome to the Glitch forum!

I’ll give my quick opinions on your questions:

  1. from what I understand about your requirements this seems like a reasonable architecture
  2. Yes, this is possible. Your bot doesn’t use the open port that Glitch provides for its normal operations, so you can set up some sort of web server to serve your web page that listens to the proper port and serves up your site. Express is a great npm package for this, and is the default that a new Glitch project starts you out with. Here’s a sample express config that might get you started, but let folks here know if you need more info.
  3. I think this is answered by (2) above. Once you have that set up and operating, the constant Starting page and the continual restarts will also stop.

I’ll let smarter folks than me weigh in on the Twitch bot side of things - I have little experience there. But it will probably help if you can tell us the name of the project you’re working on, since specific answers will make more sense than general ones.

Happy Glitching!