Home > Uncategorized > erlbot: The Erlang IRC Bot

erlbot: The Erlang IRC Bot

February 20th, 2013 Leave a comment Go to comments

I recently took a month long introductory course on Erlang. Erlang is a functional language. The closest I’ve come to functional programming is XSLT, so this was quite different for me. Erlang excels at concurrency and fault tolerance. It has made me think differently about how to solve problems which is always great. If you’re interested in Erlang, there is a great free tutorial Learn You Some Erlang

The project I decided to create to help me learn Erlang is an IRC bot. When I first went on the internet in 1995 or so, IRC was one of the first things I found and loved. My network of choice was EFnet. At the time, I recall it was somewhat lawless. People constantly warring over nicks and channels. People were always trying to flood each other off. It was a bit of an arms race. You ran scripts to protect yourself from other users. I bet one of the earliest uses of botnets was IRC. The original purpose was so you could steal a channel or keep one. Thanks to the internet, the world is a lot smaller now. IRC was one of the early technologies that helped regular people connect with each other across the world.

Like many organizations, the one I work for has offices all over the world. I’m on a team that has members in multiple locations. One old, but great way we keep connected is IRC. Different teams have different channels, but you’re free to watch or contribute to the conversation of any group. We use Google Hangouts to do our standups, but everyone I work with uses IRC for fast and easy communication throughout the day. Some people prefer to use an instant messenger client, but I always try to move those conversations to IRC. When you have conversations in a shared space, other people get a chance to listen in and contribute.

Erlbot is no HUBOT (yet). But it is a fun way to learn Erlang for me. I will be maintaining the bot at github: https://github.com/npwolf/erlbot

Features so far:
- Fault tolerance – Using Erlang’s supervisor behavior, an error in a plugin or part of the bot won’t bring the bot down
- Uptime – Erlang supports hot code loading and I’ve built the plugin system to allow the addition of plugins while running
- Extensibility – Plugins!
- Evangelize Plugin – erlbot will send a random fact to the channel when someone mentions Erlang

My one Erlang tip is Reloader from mochiweb. I added this to my erlbot source code and now the first thing I do when I launch the erl shell is reloader:start_link(). This will automatically reload beam files when they are recompiled (say using ./rebar compile).

Categories: Uncategorized Tags: ,
  1. No comments yet.
  1. No trackbacks yet.