1. 29
  1.  

  2. 5

    It’s a bit more complicated these days because any self respecting IRC channel will require a SSL connection. Still, it’s not that hard to add a SSL layer to the connection and then parse lines as usual. I have several IRC bots that have been running for years, and it’s a lot of fun.

    1. 5

      The Haskell Wiki has an article on writing your own IRC bot that was really illuminating for me when I started out writing in that language

      1. 4

        More languages should have guides on this kind of stuff. It’s a practical task that explains so much about so many topics and it can be expanded in pretty much any direction you want. It’s excellent for beginners.

      2. 4

        I wrote an IRC bot framework in (GNU) AWK earlier this year, that’s quite nice to work with. Of course it has the instability of AWK, and the fact that it can only react but can’t act on it’s own, but it’s super easy to create a new bot in just a few lines of code.

        For example:

        BEGIN {
            irc_setup("irc.server.com", 0, "bot");
            irc_join("#test");
        }
        
        JOIN { irc_msg("greetings, welcome to " TO); }
        

        this will do nothing more that greet everyone to who joins #test on irc.server.com.

        Here’s one that prints fortunes when someone starts a message with !fortune:

        BEGIN {
                prog = "fortune -s"
                irc_setup("irc.server.com", "ssl", "fortune", "!");
        }
        
        READ("^!fortune") {
            while ((prog | getline line) > 0)
                irc_msg(line)
            close(prog)
        }
        

        It’s really hacky inside, but if anyone is interested a wrote a manual (in German) here. I might translate it at some point, but I would have to stabilize the thing a bit more before I do that.

        1. 1

          That’s pretty neat, it looks like it’s super easy to pipe anything into IRC with only a few lines of awk. Eggdrop was a bit like that I imagine, for someone mastering TCL.

        2. 3

          “IRC is over 20 years old” actually, already over 30 years!

          (Yes, even when this blog was originally published.)

          1. 2

            Can highly recommend playing with the rust-irc library. It’s fun.