WARNING

A lockfile is stuck; please send me e-mail to let me know.

Frogbot

Frogbot is an IRC bot I wrote in Perl. It is based on Net::IRC and has about 4,000 lines of code, not including several CPAN modules. At this time, it is not Open Source.

Yes, I know about POE::Component::IRC; if you want to make your own bot, you should use that instead. After building this much code on Net::IRC, I'm not switching.

You can find Frogbot on the NullIRC and FreeNode networks.

Requests

Requests may be invoked in one of three ways:

  • .foo
  • frogbot: foo
  • /msg frogbot foo

In the second case, both the punctuation and the space are required after the nick. The leading period should only be used in the first case.

Frogbot will respond in the same way it was addressed So, if you send it a private message, it will reply with a private message.

For a complete list of all available Requests, type .help (or however you prefer to invoke the “help” request). For help on a particular Request, type .help foo where foo is the name of the Request.

Commands

Commands are similar to Requests, but may only be invoked by addressing frogbot directly, i.e. frogbot: foo or /msg frogbot foo. Several Commands are reserved for privileged users only. Available commands include:

  • google
  • ping
  • in
  • at
  • cancel
  • jobs
  • userinfo
  • df
  • memory
  • perl
  • channels
Seen

Frogbot's most popular Request is seen, which tells you when frogbot last saw someone and what they said or did. This feature is global across networks, which may lead to nick conflicts (i.e. if two people on two different networks share the same nick, they'll be treated like they're the same person).

This feature is case-insensitive, but does not respect RFC1459 case-insensitivity of {}|~ and []\^ characters. On a server that uses RFC1459 casemapping, foo[] and foo{} are the same nick, but if someone's nick was foo[], querying frogbot with .seen FOO[] will find them but .seen foo{} will not.

Note that frogbot does not see itself (this is partly intentional). Also, there's a version of seen implemented as a Command which will give different results in two instances.

Headlines

Frogbot has the ability to monitor news headlines from RSS feeds and display them in a channel. This is configured on a per-channel, per-server, per-feed basis. Headlines are displayed in dark grey, with (news) at the beginning, to make it obvious that they're not part of the normal conversation. Note that this will show up as black if you're using a CLI IRC client in Apple's Terminal program on Mac OS X; I submitted this to Apple as bug 4139123 and they marked it as a duplicate of an existing bug (which doesn't necessarily mean they'll fix it, but does mean they're aware of the issue).

If you would like headlines from a particular feed displayed in your channel, let me know. If you want to block the display of headlines in your IRC client, look here.

Also, .headline will return headlines that match specified search terms, or by itself will give a list of RSS feeds currently being monitored.

Help

If you're interested in implementing a help feature in your own bot, and would like it to work cooperatively with frogbot (or other bots), here's the logic I use:

  • If the user requests help, without providing a specific command they want help on, respond with a list of commands.
  • If the user requests help on a specific command, and addresses the bot directly (e.g. frogbot: help foo in a channel, or via private /msg), respond with the requested info or an error message if there is no such thing.
  • If the user requests help on a specific command by typing e.g. .help foo in a channel (but not addressing a particular bot), respond only if your bot understands that command. If not, ignore it and do not respond with an error.

The important thing is, if a user says .help foo and your bot doesn't understand what “foo” means, it should assume that another bot might understand, and keep its mouth shut. In other cases, error messages are appropriate.

If you're using IQ, let me know; I have a help module, but it should be updated for the new version of IQ and I've been lazy.

HCounter

Frogbot maintains a count of the number of times someone has said “heh” on a line by itself; this count is stored in an SQL table (for persistance) and has a scalar tied to it (because I wanted to learn how to tie things). So, when someone said “heh”, the count is incremented with $HCounter++; which updates the database. Note that this count is global across channels and networks, and has no relevance to anything.

Spelling

Frogbot queries Google for spelling suggestions. Results are not guaranteed to be accurate, only popular. Google returns identical results for words that are spelled correctly, or words that are so badly misspelled that there are no suggestions. Use the .sp Request, or simply type (sp?) after the word or phrase you're not sure about.

See Also

Props to f0rked's IQ, an IRC bot written in PHP (as disturbing a concept as that is). We've exchanged ideas from time to time.