Wednesday, September 5, 2018

Inventing some virtual friends for our robot overlords

For quite a while now, I've been writing a Twitch.tv bot, that will sit in channels it's been invited into and perform some basic housekeeping tasks (dealing with spammers, keeping track of gifts, subscriptions and follows, rolling dice, notifying what channels are live and when the last time someone said something, things like that). This is all well and good, but I need something to test it against. I don't want to put in-development code into a live channel, and I don't have access (personally) to some of the features I want to code for (subscriptions and the like - that would get expensive, fast!).

So, I'm writing a kind of "test harness". It's a node.js program that will sit and wait for websocket connections. When it gets a connection, it behaves like a real twitch.tv instance, letting you log into channels, and populating those channels with "people", moderators, chatters, spammers, staff and so on. Those "people" will talk away to each other, will timeout or ban people, purchase subs (including gift subs and multi-gift subs), join, part, things like that. It won't (currently, and for the foreseeable future) do any of the web APIs, PubSub or Web Push, as that would essentially require me to re-write the entire of Twitch's backend, but this will give me something to test against, at least.

I'm wondering, however, if this will be useful for anyone else. I know other people are building twitch bots, and this will be platform agnostic (It doesn't matter what you're developing on, this little service will appear the same). And ideally when your bot is done, you just change the connection from "localhost" to "irc-ws.chat.twitch.tv" and everything just works.