Author Topic: The Green IRC Bot  (Read 2785 times)

0 Members and 1 Guest are viewing this topic.

Offline greenfox

  • Hero Member
  • Species: Fox
  • struct fox_t = { .color = COLOR_GREEN };
  • *****
  • Male
  • Posts: 664
The Green IRC Bot
« on: June 13, 2014, 01:28:03 am »
I've been on Furtopia IRC a lot these last few months, and at some point I decided to script my client to keep track of what was happening while I was out, and so was born the first iteration of "greenbot".  Eventually, though, I started using ZNC, and that functionality was no longer relevant to me; however, developing that script had been a lot of fun, so I decided to write a /real/ bot that would make that functionality available to everyone else (or me, if ZNC were disconnected for some reason).


Enter greenbot 2.0!  Greenbot simply records and logs channel messages (currently, the logs are not limited by size, but roll over to the last 150 lines at midnight).  So, if you just joined the chat, and you want to see what was happening before you signed on, greenbot can tell you.  There are two commands for viewing the chat history: LINK and PLAY

     * LINK (/MSG greenbot LINK #chan): The LINK command will send back an HTTP link where you can view the complete chat history for that channel.  The reason for the link is to avoid flooding you with 500 lines of chat history, which would take forever to arrive.

     * PLAY (/MSG greenbot PLAY #chan): The PLAY command will simply send you the last few lines (by default, ~15-25 lines) of the chat in your IRC window.  Unfortunately, UnrealIRCD seems to apply an artificial lag to the playback, so it is rather slow. (I removed this, since it's too slow, and rather unecessary, given LINK.)

To see the rest of the commands, you can use the HELP command.  The interface was designed to be familiar (it's similar to the Atheme Services).  I also wrote up documentation at http://lagopus.tamalin.org/greenbot.txt for those interested (though, much of the document is mainly geared toward staff).


Of course, if there are any questions, comments, concerns, or whatnot, post them here, PM me, or find me in #green (the bot's official home).  At some point, when I can clean things up, I'd like to share the code.

~Surprisingly, the hardest part of writing this bot was dealing with encoding :P.  I spent several days searching the code for any lines which weren't explicitly converted to unicode, as the use of nonstandard characters was causing it to die silently.
« Last Edit: November 09, 2014, 12:41:42 am by greenfox »
"Vira pyveþ maze lirno kaietello jai."
I am only a lone man with ten-thousand dreams.

Weasyl: http://www.weasyl.com/~quyk

Offline greenfox

  • Hero Member
  • Species: Fox
  • struct fox_t = { .color = COLOR_GREEN };
  • *****
  • Male
  • Posts: 664
Re: The Green IRC Bot
« Reply #1 on: June 25, 2014, 01:17:13 am »
I added one more command to greenbot; syntax: ALIAS <nick>

It's not very complicated, it simply lists all the nicks that <nick> has switched to or from (using the NICK command) recently (for as far back as the logs go).  This is better than just reading the logs and searching for nick changes manually because (a) computers are designed to do stuff like that for you, and (b) the viewable logs roll over at midnight (ECT), but greenbot can still access older logs for a much longer period of time.
I added it because I sometimes got confused when people changed their nick to something I didn't recognize:

Quote
* user1 is now known as happyuser
...
* greenfox has joined #channel
happyuser: hey greenfox
greenfox: hi... who are you?

Here's a quick example:
Quote
/MSG greenbot ALIAS greenfox
Generating alias list for greenfox...
greenfox, sleepfox, greenfox|afk, greenie, greenie|afk
^Yeah, I'm one of those people who likes to play with their nicks - sorry :P

I've been thinking of a lot of interesting possibilities for functions the bot can perform with its data; of course, if anybody can think of things they would like it to be able do for them, I'm happy to attempt to implement it. ;)  I've had tons of fun coding it so far.
« Last Edit: June 02, 2015, 08:13:29 pm by greenfox »
"Vira pyveþ maze lirno kaietello jai."
I am only a lone man with ten-thousand dreams.

Weasyl: http://www.weasyl.com/~quyk