| 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:
- Net-IRC (0.75)
- libwww-perl (5.808)
- Time-Piece (1.11)
- URI (1.35)
- WWW-Shorten (1.97)
- WWW-Google-Calculator (0.04)
- WWW-Google-Time (0.0116)
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)
- addr: Enables the !addr command
- autojoin: Auto-join the channel on startup
- bit: Enables the !bit and !q commands
- calc: Enables the !calc and !convert commands
- date: Enables the !date command
- help: Enables the !help command
- inviteonly: Access to channel requires a self-invitation
- linkhost: Full URL before the page title to use for linkification
- linkify: Enables linkification
- respondpm: Responds in a msg
- seen: Enables the !seen command
- source: Enables the !source command
- stats: Enables the !stats command
- time: Enables the !time command
- tinyurl: Enables the !tinyurl command
- tinyurl_links: Linkificated urls are printed as a tinyurl (good for wikis that don't use latin alphabet)
- weather: Enables the !weather command
- xm: Enables the !xm command
[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:
- ~4b481b4a@gateway/web/freenode/x-fcyefaseriauyokl
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.