Getting started with simple channel game bot

Hey, so KyleBosman on the EasyAllies twitch channel asked if someone could make a bot for a simple stream game and I thought it was a fun challenge. This is what he wanted:

  1. He plays Tetris and wants people to guess what his best score for the night is gonna be.
  2. At the end of the night he would announce the user who was the closest to his actual score.

I started making a bot in mIRC but it was a PITA to say the least. After a day I got basic setup and store/show score mechanics sorted but basic if statements wouldn’t work when I wanted to add more advanced logic so I was stuck.

I made some additional research and found tmi.js but I’m not sure what a good setup would be here. Where’s a good place to setup a server? What’s a good basic setup for a game like this?

I have access to an ftp and webspace and I have some node knowledge and work with JavaScript daily so I think I have the experience for the game once I have a server running somewhere. I can’t really start a node server on there though since I can’t install node etc.


Hmm ok so looking at the example here Kyle could just fire up my bot in a tab by going to a specific url where I’ve setup the bot. And I could modify this example to collect scores and respond to commands from users and store their guesses in a nosql db somewhere?

Sounds doable, though its a bit more work than I though it would take :slight_smile:

Most folks host their applications in placed like AWS or DigitalOcean since both can be scaled if usage spikes. It really just depends on what you’re comfortable with. :slight_smile:

Cool, thanks. Any general idea where the limit for a regular ol’ webspace would be? I mean the bot is just talking to twitch as a client if I understood this correctly, all the users are actually on twitch? So the load on my server should be pretty minimal?

There are too many variables to give any sort of guidelines around servers. It’ll be up to you to do capacity planning.

I wouldn’t say minimal load. It could be anywhere from minimal to reddit hug-of-death load. You’re taking user input (from the bot) and storing it. Imagine every user in chat simultaneously guesses a score. Can your service handle that from a storage perspective as well as command processing perspective? Imagine someone spamming hundreds of guesses. Even if your bot doesn’t allow that, you still have to do something with the request. The users are sending the commands from Twitch, so you don’t have to worry about that. You do have to worry about once the request gets to your bot and service.

$20 droplet on Digital Ocean was plenty enough to handle moderation on AGDQ (along with a few quieter chats) at 14k messages a minute. Start small and upgrade if necessary, it’s not that important to get it right the first time. If everything’s via chat, you shouldn’t have to worry about hardware resources too much. If you have a web interface, that can increase the load by quite a bit.

1 Like

If it’s a bot only service (IE: command line app that processes messages, sends messages, and potentially logs messages), with no user interface AWS micro is sufficient. If there’s a UI, it very quickly depends on what you’re doing.

Logging messages would quickly ramp up your requirements in terms of storage and cpu requirements as usage scale goes up. Just parsing/responding would be negligable impact.

At the moment I’m using the browserversion and just opening the bot in a tab so its the computer running the bot handling the load. Next step is of course running the program on a node server and permantently store and load guesses. The channel has views in the thousands and I would expect at most 10’s of guesses in a minute so I think a minimal service should suffice.

As far as load per request its negligable for the !guess action at the moment since its just storing the guess. If tons and tons of users guess and many people ask whos closest (!pilot command) at the same time I will definitely have a problem since its looping through the guesses and finding out whos leading. That could of course be separated to a timed calculation rather than a per request calculation as I do now.

I’ll check out the cheapest tier on DigitalOcean. Made a free account on AWS but it felt huge. Don’t even know where to start setting up the server or get commandline or file access there. Hopefully there are better starting guides on DigitalOcean.

AWS free tier (which lasts 1 year) allows you to create a variety of services for free. The EC2 instances (micro) allows you to create 1 t2.micro windows server, and 1 t2.micro linux server and run it with 100% utilization for the month (750 hours I think). You’d want to be careful about bandwidth/storage usage (read the terms of service and follow them, you pay for any usage over free tier allowance)

It also includes free tier RDS which would be a mysql (aurora) or sql server express instance.

AWS works on a ‘Get what you need’ model, where you add services as you’re growing, verse something like digital ocean that’s targeted more at ‘Collect everything in one place’ which tends to have scaling issues (though with a bot, it’s probably not a big deal when you’re micro sized).

Thansk for the info. Though, AWS sound way overkill for small hobby projects like this. I just want something lightweight and simple. DO looks a bit better in that regard. Frankly, I wish there was an extremely simple service available where I could just upload my script and it works for things like this :slight_smile: I’m not that interested in the devops side of things, just want to build the app.

AWS and Azure both have code deployments, where you upload your project and it executes it :stuck_out_tongue: But I personally don’t care where you host, we’ve just had great experience with Amazon EC2’s, and the micro are only $7/mo after the free tier expires, which is a pretty good deal imo, and it’s a full virtual machine that you can remote desktop into, not a shared file explorer. (Though DO droplets might be the same, and I work with other people who have had great DO experiences, though most of them use docker image containers)

Yeah I’m sure they’re great if you have the time to configure them and figure out their process but I thought there would be something simpler for a simple use-case like mine. And there was! My friend pointed me to I could create a project and database and deploy to their node container in no-time! I definitely recommend so far to anyone like me who just wanna setup a quick project in the cloud. If anyone’s interested I’ll update with my experience with them but so far its just what I wanted.

It’s now running at modulus and Kyle ran it for the stream, thanks for your help everyone! It was kicked for being too noisy though :slight_smile: I’ll make it whisper and talk less and make it a mod in the channel and that should be enough I think?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.