It's 2:15 in the morning. I have bloodshot eyes, a mug of coffee that's been cold for at least three hours, and the constant hum of fans in the background. I've spent the whole damn night banging my head against the keyboard over nonsense. The reason for my insomnia is nothing other than a TCL script for an Eggdrop that refuses to give op to registered users in my IRC Hispano channel.
For those of you coming from other networks, maintaining a channel on IRC Hispano is no joke. If you drop your guard for five minutes, four random nicks join, they do a takeover, steal the channel, and you're left looking like a fool. That's why having a 24/7 bot is almost mandatory if you want to maintain order.
Tinkering with Eggdrop and TCL
Up until now, I managed quite well with classic mIRC scripts. Writing code in mSL (mIRC Scripting Language) has its charm. It's fast, you see the results on the fly in your own client, and for doing automatic kicks on jokers who type in all caps, it works wonderfully. Something as simple as:
on *:TEXT:*:*:{
if ($upper($1-) == $1-) && ($len($1-) > 10) {
kick # $nick Don't yell, we are not deaf!
}
}
It saves your life. But of course, this requires having the computer on all day. And with the cost of the electricity bill, that's not a plan. The natural evolution for those of us who like to tinker is to rent a shell on some godforsaken server and put an Eggdrop there.
The Eggdrop is an engineering marvel, a robust bot written in C that has been with us since '93, but configuring it... oh, boy! That's another story. To really bring it to life you have to get into the mud with TCL (Tool Command Language).
The problem tonight came from the interaction between the Eggdrop and the legendary NiCK (the official services bot of IRC Hispano). I wanted my bot to recognize legitimate users of the channel by checking their encrypted virtual host.
After compiling the bot on the shell (bless make config and make), I started writing the damn TCL script. The syntax of TCL is... peculiar. Everything is commands and lists, and if you leave a damn curly brace open, the Eggdrop crashes in your face without giving you too many explanations.
bind join - * join_op
proc join_op {nick uhost handle channel} {
if {[matchattr $handle o]} {
putserv "MODE $channel +o $nick"
putlog "Giving OP to $nick on $channel"
} else {
putlog "The user $nick ($uhost) does not have permissions on $channel."
}
}
The bug that kept me awake was as stupid as me not correctly assigning the user flags in the bot's .user file. Three hours to realize that I was typing the chattr command wrong in the Eggdrop's partyline. Frustrating as hell, but the feeling of satisfaction when a buddy finally joined the channel and the bot automatically threw the @ at him instantly is priceless.
The future of automation
As I finish the last sip of cold coffee, I can't help but reflect on where all this is going. Right now, to maintain a channel we need to rent Linux shells, learn arcane languages like TCL, and compile things by hand. It's the work of craftsmen, of people who like to get their hands dirty.
Sometimes I think that in a few years this will all be much easier. Perhaps platforms will appear where everything is integrated, and we won't need to write scripts at two in the morning to prevent four trolls from blowing up our community. Although, to be honest, I hope that level of "ease" never gets to take away this magic. That adrenaline rush of knowing you have a small program running autonomously on a server thousands of miles away, obeying the rules you wrote yourself.
I have to get up early tomorrow, so I'm logging off. The bot stays on guard. Long live IRC!