A fucking IRC bot lib in C.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
_____ 85fb24936e Initial commit 9 months ago
examples Initial commit 9 months ago
include Initial commit 9 months ago
src Initial commit 9 months ago
Makefile Initial commit 9 months ago
README.md Initial commit 9 months ago


About IBM

IBM stands for Intercontinental Ballistic Machines. It’s name is unrelated to its function however, because it is a very low level IRC bot library. It currently doesn’t have any dependencies and as such has no support for SSL. I’ll probably add it in the future but it works as it is right now.

Build Instructions

To build libibm.so type make in the command line and it should build it. You can also build all the stuff in examples with make but you must run it first in the main directory. I’ll add a make target to build it as a static library at some point.


To use it you only really need to include ibm.h, irc_functions.h, and maybe errors.h as well as linking libibm. Here is a simple example of a bot:

#include <stdio.h>
#include "ibm.h"
#include "irc_functions.h"

void on_endmotd(ibm_bot *bot, irc_message *imsg) {
	puts("[+] Joining a channel");
	irc_join(*bot, "#achannel");

void on_join(ibm_bot *bot, irc_message *imsg) {
	if(imsg->prefix && imsg->argc >= 1)
		printf("%s joined %s\n", imsg->prefix, imsg->args[0]);

void on_privmsg(ibm_bot *bot, irc_message *imsg) {
	if(imsg->prefix && imsg->args >= 2)
		printf("[%s] %s: %s\n", imsg->args[0], imsg->prefix, imsg->args[1]);

int main() {
	ibm_bot bot;
	int err;

	create_irc_bot(&bot, "a_bot", NULL, NULL, NULL, "irc.anirc.com", 6667);

	ibm_add_callback(&bot, "376", &on_endmotd); /* end motd */
	ibm_add_callback(&bot, "422", &on_endmotd); /* no motd */
	ibm_add_callback(&bot, "JOIN", &on_endmotd);
	ibm_add_callback(&bot, "PRIVMSG", &on_endmotd);

	if(connect_irc_bot(&bot) != 0) {
		fprintf(stderr, "Couldn't connect\n");
		return 0;

	/* Done like this so nonblocking sockets can be introduced for moar bots */
	while(1) {
		if(ibm_bot_pass(&bot) != 0) {
			fprintf(stderr, "Error during bot operation\n");

	return 0;


At some point I’ll probably add SSL capabilities. Also I realize this is a fairly low level library. It wont keep track of nick changes for you, it doesn’t handling multithreading commands, etc. At some point I will probably fork this and write a library like that on top of this, so I suppose that’s something to look forward to.

Other notes

Keep in mind that this was written fairly quickly across two days on little sleep and several drugs. Also it’s C. I wouldn’t trust it to be extremely secure, so just try not to break it. If you do break it, open an issue and tell me how so I can fix it maybe. For now I’d probably run it in a VM if you’re around people or on an IRC that might fuck with it.