insobot update #1 — The Owl and the Polls went to IRC

This is a quick-ish blog with a rundown of recent changes, and upcoming plans.

Last month, shortly after insobot joined HMN, Miblo made a request for poll functionality and mod_poll was created. It was quite rote, and so did not take long to get an initial version up and running.

The current version is mostly the same, but now saves polls locally across module reloads and has a private message confirmation for !vote. Hopefully it's useful; I was considering a web interface to it, but I think Strawpoll already handles that better than I could. They do have an API that I could use, but syncing up votes via them with votes via IRC wouldn't be possible — I'll probably just keep mod_poll as-is unless someone thinks of a cool idea for it.

The next addition wasn't to insobot itself, but to the handmade hero chat — that is the addition of quartertron's Owlbot. It lights up when mentioned, basically a Casey IRQ. This is relevant here since Casey added insobot to Owlbot's trusted users, meaning Owlbot'll respond when insobot mentions it.

At the time, this was perhaps risky, (not to be confused with ~riscy) since there were various ways to trick insobot into saying '@Owlbot' and lighting The Owl Signal™. This prompted the inclusion of the 'on_filter' callback into the module API, and bumped the API version*. In short, this callback allows modules to intercept messages the bot is about to send and modify them. An accompanying mod_filter was made to do just that — it reads a list of regexen from its config file and replaces any matches with asterisks in outgoing messages; I'm including a regex for "owlbot" by default.

But since insobot has this owl ability (owlbility?), why not make use of it? Users in insobot's whitelist can now use !owlbot in the handmade hero IRC or twitch chat to start a vote whether or not the owl should be lit (implemented in mod_hmh around here). If successful, insobot will give Owlbot a mention that bypasses the filtering. Use it responsibly or I might have to make it admin only...

The bypass mechanism also required some API changes, specifically send_msg and send_raw now return an int that uniquely identifies the message; mod_filter looks for the MOD_MSG† called 'filter_permit' which can be given one of these IDs. The on_filter callback passes along the ID of the outgoing message, so these IDs can be matched and used to skip the filtering process.

Lastly I did some more work on mod_schedule. It, along with its website, had started to gather some dust, mainly due to the burden of requiring constant manual updates and having an awkward interface — even the most bearded of CLI users could have some trouble getting a schedule added correctly.

To improve things a bit, I added mod_twitter which looks for tweets about upcoming streams and adds them to the schedule automatically. Currently it's pretty half-baked and only understands the bulk format shared by handmade_hero and hmn_riscy; the plan is to add support for more ad-hoc parsing so that it can pick up one-off streams and time changes / cancellations. This could be made easier if there was a standard format for such tweets, but I'm not sure what that would look like.

Other things in the TODO list are improving mod_psa and mod_markov, maybe integrating @ChronalDragon's ~twc, and perhaps most importantly improving the documentation.

Speaking of, if for some reason you read a blog about an IRC bot down this far, then maybe you could help answer how you would like the documentation to be presented. Currently there is the quite unhelpful !help command, and a fairly sparse GitHub wiki. I could improve !help but I realise there's only so far a single line of text can go, so I'm leaning towards either filling out the wiki or making a dedicated site for docs. Additionally I wouldn't mind writing some more blogs or forum posts that detail various aspects of insobot. If you have an opinion on the matter, I'd be happy to hear it!

* The ABI remained backwards compatible though — I'd like to expand on the API versioning scheme at some point, maybe in another blog.

† The MOD_MSG inter-module-communication system: another good candidate for a separate blog.
Why not a more interactive help through priv msgs? It avoids the spam and still lets the user get detailed docs.
Alex Baines,
Yeah that's not a bad idea.
Abner Coimbre, Edited by Abner Coimbre on
Why not a more interactive help through priv msgs?