I've wanted to try making a bot for a while now, but couldn't make the time for it until now. I'm quite familiar with Twitch, so I thought it would be fun to make my own bot. In addition, I enjoy working with APIs, and all the data they offer.

What it does

When the file is run, the client (on this computer) connects to Twitch's server. Three messages are sent from the client to the server, in order to log in to Twitch with the bot account and join a specific streamer's chat room. The bot then finds out what game the streamer is streaming, using the Twitch API, and passes the game's name to the Deviant Art API. Using the DA API, I searched for works relating to the game, and took the top 250 most popular (as defined by Deviant Art) URLs. From there, I generated a random integer between 0 and the length of the list containing all the URLs, and used that integer to decide which link the bot would post. The bot posts the specified link, and repeats this process every 5 minutes.

How I built it

I read a lot of documentation and watched a few YouTube videos in order to get started. From there, I used what I learned in my classes and applied it to this bot.

Challenges I ran into

I struggled for a long time trying to read the documentation for the Twitch API, and setting it up in Python. My program wouldn't let me log into Twitch, and I kept trying to figure out why for a few hours; it wasn't until I asked my friend who was also developing a bot that I figured it out.

Accomplishments that I'm proud of

What I learned

I learned to utilize resources found on the Internet, and how to create a simple bot.

What's next for Twitch Chatbot

I actually am not entirely sure how my bot works, so I'll probably try to figure that out first. I also need to clean up my code. I'd like to add more sources of fan-made content too--not just those found on Deviant Art.

Built With

Share this project: