InfoBot

From s23
Jump to navigation Jump to search

http://www.infobot.org/

--> see Infobot

The infobot connects to an Internet Relay Chat (IRC) server, joins some channels (maybe), and begins accumulating factoids. To run one, download the source, uncompress it, untar it, edit the config files, and it up.

Interacting with the bot is pretty straightforward. Most of the commands and variables available to users are listed below. The bot will interact via message or on-channel. Interacting with an Infobot

Commands[edit]

    * setting factoids: X is Y

      Saying something like "X is Y" somewhere that the infobot can see it will cause the bot to store a factoid, unless X is already defined. It sets the value of X to Y.

    * accessing factoids: What is X?

      You can ask an infobot about something in a number of different ways, including "what is X?", "where is X?", or just plain "X?".
    * altering factoids: s/A/B/

      if you just want to change a part of a factoid, use the s///operator. you have to address the bot or use a private medium to do this.

      MyBot, X =~ s/A/B/

      will change the first occurence of A to B in the factoid called X.

    * appending to existing entries: also

      One can extend an existing factoid using the keyword also

            poink is also a silly word 

    * erasing a factoid: forget

      A factoid can easily be deleted by using

      infobot, forget poink

    * changing a factoid: no, ...

      You can change the entry for a factoid completely using

            no, infobot, x is wugga wugga. 

      which deletes the prior entry (if possible) and replaces it with the new one.

    * having the bot tell someone else something: tell

      A user can ask an infobot to tell someone else something.

            infobot, tell fimmtiu about no web

    * karma / plusplus

      karma for a concept may be incremented or decremeted using ++ and --. You can get the current karma 'score' for something by asking for it.

            oznoid++

            oznoid--

            karma for oznoid

    * status

      infobots reply to status requests.

      -> [url] status

      [url!infobot@ALF5.SPEECH.CS.CMU.EDU] Since Fri Mar 26 06:42:27 1999, there have been 409 modifications and 2604 questions. I have been awake for 5 days, 4 hours, 24 minutes, 18 seconds this session, and currently reference 47529 factoids.

    * joining an allowed channel: join #infobot

      On IRC, you can tell the infobot to join a channel that it's allowed to join with

            infobot, join #infobot 

      If it is allowed to (in its paramter settings), it will try to join the channel.

    * leaving a channel: part #infobot

      This causes the bot to leave the given channel

            infobot, part #infobot 

      leave is a synonym for part.

    * random responses with |

      You can set a list from which to pick a random response by using |

            x is a|b|c|d 

      When x is asked about, the infobot will randomly choose from the |-spearated list.

    * The <reply> factoid tag.

      Normally, when the infobot replies to "What is X", it says "X is Y". This form makes it just reply "Y".

            X is <reply> Y 

    * The <action> factoid tag (as of 0.43.5)

      This causes the bot to respond as with except as an ACTION.

            X is <action> Y 

    * backwacking

      Use  to protect items from evaluation.

            x is y is y 

      will normally set x =is=> y is y, but

            x is y is y 

      will set

            x is y =is=> y 

      The forget and no (update) operators apply before checking for this. This is also useful for getting around the dereferencing of "i" and "me" and so on.

    * the $who variable

      Contains the nickname person currently addressing the bot. It can be used effectively in replies.

            nice day is <reply> you betcha, $who. 

    * the $date variable

      Contains the current date and time, at the bot's host.

    * weather for KAGC (0.43.6+)

      Retrieves the weather from NOAA station KAGC. See www.noaa.gov. Note: Requires LWP.

          o metar KAGC (0.43.6+) 

      Retrieves METAR info from NOAA station KAGC. See www.noaa.gov. Note: Requires Geo::METAR and LWP.

    * nslookup irc.cs.cmu.edu

      performs DNS lookup or reverse-lookup on the hostname or IP.

    * internic yahoo.com

      gets the internic WHOIS record

    * traceroute apple.com

      gets the traceroute results from the bot's machine to the target machine. Summary only.

    * imdb, websters, foldoc

      outputs a well-formed url for a search of IMDB (the Internet Movie DataBase), the Webster's 1913 dictionary, or the foldoc dictionary of geek terms.

            imdb for clerks

            webster for lucre 

    * New in 0.44.3:

          o literal foo

            returns the value without the usual post-processing.
          o change 100 USD to DEM

            converts currency. Retrieves the current exchange rates from the net. Requires LWP.
          o <rss="http://www.foo.com/summary.rss">

            looks up the RSS file (RDF Site Summary) and returns it in-place where the tag is. Requires XML::RSS and LWP.
          o give me an excuse, or excuse

            connects to the excuse server and returns an excuse. requires Net::Telnet.

    * Ignoring users: ignore nickname, ignore *.a.com

      Users with the P (oP) flag can tell the bot to ignore people or hostmasks. And 'unignore'. use 'ignorelist' to get the current list of ignored masks, if you have the P flag.
    * op on channel

      The 'p' (oP) flag in the userfile allows this to work. You'll need to set a hostmask. See files/infobot.users Also uses a crypted password.

      /msg <bot> <password> op

    * die

      If the bot owner (+O, Owner) says this or messages it to the bot, it will kill itself.

Scripts and Utilities
The infobot comes with some scripts for working with the DBM files.

    * update_db

      This takes a flat ascii file and inserts it into a DBM file. It creates a new DBM if it didn't exist.

            scripts/update_db factpacks/code_to_country.txt infobot-is 

      will add the factoids in code_to_country.txt to the infobot-is DBM.

    * dump_db

      The converse. It dumps out the DBM file to a flat ascii file. Note there is no extension on the DBM name, even though the system may use one.

            scripts/dump_db infobot-is 

      Note there is no extension on the DBM name, even though the system may use one (like .pag and .dir or .db).

Add-on Modules
This is incomplete, it's gotten to be quite difficult to keep this documentation up to date on all of the new additions being submitted and added.

    * nickometer, by Adam Spiers. Guages how 'lame' a nickname is, as a percentage!

            nickometer l33tn1ck 

    * babel.pl by jdf. translates using the babelfish web site for machine translation. In this implementation, English is assumed to be the 'main' language, thus everything is translated to or from another language.

            (x|translate) (to|from) (de|fr|pt|es|it|german|french|portugese|spanish|italian)

            translate to german this is a test
            x to german this is another test
            x to de and a third
            x from de ein bisschen Deutsch

            German, French, Spanish, Italian, and Portugese are currently supported by babelfish. 

    * METAR support, courtesy of mendel

      metar KAGC

      retrieves METAR information for KAGC, the Allegheny County airport station.

    * NOAA weather station support, courtesy of oznoid

            weather KAGC 

      retrieves the NOAA weather information from (in this example) KAGC. uses the same codes as metar info.

    * slashdot headlines, originally from Chris Tessone, current version from Rahga.

            slashdot
            slashdot headlines 

      retrieves the current slashdot headlines from www.slashdot.org.
    * W3Search: search web engines for links; thanks to Simon Couzins for this one. Requires WWW::Search and WWW::Search::Google.
            search google for foo
            google for foo
            altavista for foo
            dejanews for foo Currently supports what WWW::Search and WWW::Search::Google support, namely: Dejanews, Google, Gopher, Excite, Infoseek, HotBot, Lycos, AltaVista, Magellan, PLweb, SFgate, and Verity.

    * US Airways In-flight info.
            usair flight 781 retrieves the in-flight information for the appropriate USAir flight. Note: Requires LWP. 

Configuration

    * editing the parameter file

      The parameter file, usually in files/infobot.config, is the most direct way to customize the settings on your infobot.

    * editing the user file

      The user file, usually in files/infobot.users, is the most direct way to customize the settings on your infobot.

    * editing the main script

      There are certain items you may need to fiddle with in the main script of the infobot, but normally you shouldn't have to. The usual reasons are

          o changing the bang path to perl

            If you get

                  infobot: Command not found. 

            or something like it, you need to edit the infobot script at the top level directory (the script named 'infobot') and set the path to you perl interpreter in the very first line of the script to

                  #!/path/to/perl 

            with, of course, the full path to your perl binary.

          o explicitly setting normally relative paths

            If you don't have . in your path, you will probably need to set some variables explicitly that are normally determined relative to the infobot script. This is done in the 'infobot' script.

    * Installing Modules to enable features

      Several add-ons, like weather and web search require perl modules to be installed. The easiest way to get all the things you need is to install the CPAN.pm module, available from CPAN, and use it to install what you need. This is best done as root.

      Once you have the CPAN module installed, use it to install the required modules:

          o the main thing: install Bundle::LWP
          o for METAR: install Geo::METAR
          o for W3Search:
                + install WWW::Search
                + install WWW::Search::Google 
      Once these are installed, start or restart your infobot. 

Running the Infobot

    * starting it up

      This should be as simple as entering the infobot parent directory and executing

            infobot 

      This starts up the script and generates a whole lot of text. It's useful and interesting to see what's going on "in the infobot's head". You can control the amount of verbage that comes out with the VERBOSITY parameter, of you can dump all the output to the bitbucket and background the process at the same time with

            nohup infobot > /dev/null & 

    * the console

      Should you choose to look at the stream if consciousness in the bot, and you haven't reduced the output to nothing or consigned it to the void, you will be presented with the console.

      The first thing you should see, assuming all goes well with making a connection, is the motd (message-of-the-day) of the server the bot has been configured to connect to.

      Next, you should see the result of the channel joins specified in the parameter files, and you may see the bot recognizing hostmasks of people in the userfile, if any have been put in there.

      If you have the ansi_control paramter set, and your terminal supports it, the output will be in color.

      NOTE that the 'console' is NOT interactive. You can't type anything into it; it's just for viewing what's going on.

    * cronning the infobot

      You can set the infobot to automatically start up using cron. See the included example crontab file, in files/infobot.crontab 

Shutting it Down
If you have set yourself as the bot's master in the user file (infobot.users, unless you changed the default), you can just say or message 'die' to the bot.

Otherwise, kill the process or hit control-c in the console.