Log in / create account

Networking: Home | Weblog | Wiki | Twitter | Facebook | Email me

Jump to:navigation, search
Linkbot
Author:Zach Hauri
Programming language(s):Perl
License:GPL

Linkbot is a bot for Internet Relay Chat. Information on this page is current as of r76.

Contents

[edit] Installation

To install linkbot from SVN, run the following command:

svn checkout http://code.zachhauri.com/svn/linkbot linkbot

Copy the directory tree to your $HOME directory (so you end up with directories like $HOME/bin, $HOME/etc, $HOME/lib and so on)

[edit] Perl modules

Linkbot requires the following perl modules:

Debian users can use the following command:

# apt-get install libnet-irc-perl libwww-perl libtime-piece-perl liburi-perl libwww-shorten-perl libwww-google-calculator-perl

Otherwise, use CPAN:

cpan> install Net::IRC LWP Time::Piece URI WWW::Shorten WWW::Google::Calculator WWW::Google::Time

(Note: The WWW::Google::Time module does not have a Debian package, so it must be obtained from CPAN)

[edit] MySQL

Logs of !seen are stored in a MySQL database. You can create the tables using the .sql file included in the ~/bin/upgrading/ directory, and, if you already have logs stored in ~/logs/linkbotseen.log, you can use the enclosed perl script in that directory to convert them to MySQL.

[edit] Configuration

To configure linkbot to your needs, copy the enclosed ~/etc/linkbot-conf.pl-dist to ~/etc/linkbot-conf.pl, and edit it to your needs.

[edit] Channel options

Note: Channel options are now stored via MySQL. You can use the linkbot management (under ~/misc) to add/remove/change options now, but needs documentation on installation/use (FIXME: Do that)

[edit] Commands

[edit]  !addr

Syntax: !addr hex IP

This command converts a CGI:IRC hexadecimal IP address to a decimal IP, and provides a link to the contributions page of that IP.

The hex IP should be eight hexadecimal characters (0-9, a-f), and will appear in the hostname of the nick. In the following example:

The hex IP would be 4b481b4a, and would be converted to the decimal IP of 75.72.27.74.

[edit]  !bit

Syntax: !bit question

This command randomly returns a bit (0 or 1). It is a simplified version of the !q command below.

[edit]  !calc

Syntax: !calc equation

This command returns the answer of an equation. It uses Google Calculator to calculate and return the answer.

[edit]  !convert

Syntax: !convert equation

This command is the same as !calc.

[edit]  !date

Syntax: !date

This command prints the current GMT date. This is the same date as the servers for Wikinews.

[edit]  !help

Syntax: !help

This command prints a link to this page.

[edit]  !q

Syntax: !q question

This command randomly returns a yes or no. In essence, you can "ask" it a yes or no question, and it will answer it. The !bit command is a simpler version, which returns just a 0 (no) or 1 (yes).

[edit]  !seen

Syntax: !seen nick

This command tells you the last time it has seen a particular nick on IRC. It will return the date/time in GMT, the channel, and the last thing that person said.

[edit]  !source

Syntax: !source

This command returns a link to this page.

[edit]  !stats

Syntax: !stats

This command prints statistics for the random answer functions. It provides the number of times each answer has been used, and the percentage of that answer compared to the total number of answers.

[edit]  !sys

Syntax: !sys command parameters

This command allows the linkbot to perform system functions, such as channel joins, quits, access list editing, and more. It is only accessible through PM.

A list of sys commands is available here.

[edit]  !time

Syntax: !time locale

This command displays the current time in a given location. Locale is optional; if you omit it, it will return UTC time only.

[edit]  !tinyurl

Syntax: !tinyurl url

This command prints a short URL which redirects to a long URL using TinyURL.

[edit]  !weather

Syntax: !weather ICAO airport code

This command prints the most currently recorded weather conditions at a particular airport.

A list of the ICAO airport codes is available here.

[edit]  !xm

Syntax: !xm station#

This command prints the song currently playing on a particular XM Satellite Radio station.