Guillaume “Zifro” Desrat’s former blog

Don’t fear the bot (”Thou shalt op me !”)

Filed under: code, Ruby — Zifro August 20, 2006 @ 9:43 pm

It’s Sunday evening, my sister came to visit me (and browse the Internet for a job offers) and I’m writing this post while she’s watching Ocean’s Eleven.

I updated the system and the applications on my mother’s laptop, removed what was useless, cleaned the hard drive and KaoLLa tested it all the afternoon. Cool, it works well, a bit faster than before (even with the Service Pack 2 installed). Now I’m using it to write this post. Strangely, I always experience difficulties to access pages from my OpenBSD box, and it seems to work fine with Windows XP. Weird, no ?

So, the main topic of this post is the IRC bot I have developped for years (which doesn’t mean it is fully usable, featuring cutting-edge mechanisms (err… in fact it does) and all stuff. Here is the story :
I coding a Perl IRC bot in 2002 March-April, then started writing another with Ruby, which I discovered thanks to Maz (not Matz heh !).
After he dropped the development at an early stage, I kept on working on it from time to time, when I wanted to. Firstly named “MiKeRWIB”, for “Micro-Kernel Ruby Written IRC Bot”, I separated the IRC library from the micro-kernel (it wasn’t a true, pure, one before), and renamed it “YAIB”, a recursive acronym standing for “YAIB is Another IRC Bot” (too bad someone already used “Yet Another IRC Bot”).

This bot features a micro-kernel, an IRC library and a skeleton for user-made modules. Because by itself, the bot doesn’t do anything. It needs a module to connect to an IRC Server, call the IRC messages transformation process and send those to the other modules via the micro-kernel. This one dispatches the messages to the running modules, which it shares messageboxes with, and grabs messages from those ones to send them to the IRC server, via the CONNECTION_MODULE.

Is this clear ? Does it make sense to you ?

The module skeleton system helps the user (also called “the developer” at this point, because YAIB aims at being used by IRC bots developers) save time (and energy) by hiding all the magical mechanisms like transforming a call to the method “join” into the creation of a JoinMessage, formated in order to be sent, then passed to the micro-kernel for being delivered to the CONNECTION_MODULE, and then sent to the IRC server. It’s sort or “role-based” or “aspect-oriented” programming. I learnt that after I coded it :p

These last days, kedare on #rubyfr @ Freenode asked for things to code, and I helped him writing a simple module. He went on and developed a complete module to manage one of his channel (well, as far as I know, that’s what he did).
Then guiguilinux on the same channel showed us a Ruby script to translate morse code to human-readable characters both ways, which I ported to a YAIB module (it has been intensively tested on IRC by many folks who played with it ’till I disconnected the bot).

So I’m truly happy to see people try and enjoy what I code :D

If ever you’re interested in this project, let me know (by commenting, emailing me at [zifro] _at_ [yaib] _dot_ [net], or hanging on Freenode (I’m always on #rubyfr and #ruby-lang).

As part of my night courses, I’m (slowly) developing and websites with Ruby on Rails. The first one will present the project, display the day-to-day changelog, the development news, offer documentation and downloads ; the second will be sort of RAA, allowing developers to share and promote their modules. I try to stick to the idea of making them both clear and simple (without Javascript, without CSS hacks) since I have another Web 2.0 (current buzzword !) Rails website : Hazzard community’s one.

For the impatient ones, you’ll find something to download and run at . Although it requires you to tune the IRCConnection.rb file to connect where you need, and the Services (another nice feature) to be turn off, it’s a toy you can play with and use as you like. Last words : it requires Ruby 1.6 or later and it’s released under the GPL (which might be changed in a near future…).

WordPress database error: [Table 'hazzard.wp_comments' doesn't exist]
SELECT * FROM wp_comments WHERE comment_post_ID = '24' AND comment_approved = '1' ORDER BY comment_date


No comments yet.

RSS feed for comments on this post.

Leave a comment