This is meant to be the basis for a discussion on this topic. It will cover some of the background as well as the ideas I currently have for handling this.
Commonly people as about how to run ZenIRCBot against multiple IRC servers, as well as running multiple bots in the same instance of redis. My original thoughts on this were to make it so the bot could instantiate the underlying IRC lib once for each IRC server, then pass along what server the message came from in the protocol. Requiring all clients to reply with the server they want their message to go to as well.
I found this to be a less savory method due to the need to manage multiple connections within the same bot. Pinging the server for each of them and making sure they are still alive.
This at first feels like a very clean solution. The problem comes when you need to let the client services know what the prefix is. You can point them at the bot's config, which works alright for services that are long running. Services that are started from other applications or run other servers will need to include the prefix in their individual config or be hardcoded.
This doesn't require a protocol change, so the messages can still come through as version 1. But older services wont know to look for prefix so they wont be able to communicate with the bot. This requires the bot to listen/publish on the original channels as well which is a debugging nightmare, or just drop support for all of them.
This takes a note from the polyserver thought I had above. But is also
inspired by Justin Abrahms while talking to him on our way to hack together.
The idea is instead of a server
field to the envelope, adding in a bot
field. So when the bot receives a message from IRC, it will include its own
name. And when a service replies, it will also include the bot it wants to say
the message.
Services could be configured to whitelist/blacklist bots, or just reply to all messages that come in. Bot name could be auto generated from server name + nick, or could be defined in the config.
This would require an iteration of the protocol version, but because channel names stay the same, there can be a path for handling version 1 messages.
My gut instinct says that if you have version 1 services running all bots would attempt to act on the messages. This means if you are only running one bot then you can put off upgrading your services, but if you want to move to multiple bots then you will also need to upgrade your services to be version 2.
I am leaning very hard toward the bot name idea. This would allow someone to implement a polyserver bot, as well having a more sane backwards compatibility story.