It has been a while since I’ve started my IRC bot project. The bot is taking shape, and can already be found in the #blaatschaap chatroom, relieving it’s grandpa BlaatBot2005 (DarkShadow). The BlaatBot2025 as currently present implements the “!randomquote” command as the old bot did.

But let’s have a look at what this new bot looks like. This generation of IRC bots features a modular design. The API between modules is primarily a C++ API, however, a C API is also in the working, to allow C and other languages that offer C bindings to be used to write modules. However, let’s focus on the C++ design.

There exists a base class, PluginLoadable, from which all loadable modules inherit. These are loaded by the PluginLoader. There are some basic plugin types, such as Client, which implements a Client, which in the first release will be the BotClient, implementing bot features. In this design, a GuiClient could be implemented to create an IRC client, but that’s for later project.

From there, a Protocol gets loaded. For now, there is an IRCProtocol. The design is made in such way other protocols can be implemented, for example XMPP or Matrix. The IRCProtocol class implements the IRC Protocol, and forwards messages in a way abstracted from the protocol to the Client, and takes abstracted messages from the Client and sends the appropriate IRC message to the server.

The IRCProtocol, takes an instance of a Connection, which initially will be a TcpConnection and a LibreTlsConnection, implementing a plain TCP connection, and a TLS connection using LibreTLS. This way we are not tied to a specific TLS implementation. Future connection types could inlucde other TLS libraries, WebSockets, or a SCTP connection.

Then, let’s look again at the BotClient. The BotClient loads BotModules. A BotModule implements some command, and registers this command with the BotClient. This is the first place where we will be looking at implementing a C API additionally to the C++ API.