Skip Navigation

You are here: Home > Projects > Watcher

Watcher

Watcher is a small perl script which, with the help of Net::IRC, will monitor an irc channel keeping tabs on who speaks. If at least X people speak in a rolling Y-second period, the people_talking sub is executed. When the number of people drops below X, the no_people_talking sub is run. You can modify these subs to do something useful when encountering these events.

Download

The script is called watcher.pl. It also requires the Net::IRC module, available from CPAN. Please read on for documentation.

Documentation

Documentation is minimal, but the script is pretty straight forward. Refer to the following sections for necessary information.

Variables to Modify

You will need to modify the variables near the top of the script, including:

$nick
The nickname to use while on irc
$channel
The channel to join upon connecting to the server
$ircname
The ircname to display (shown when someone runs a /whois on the nickname)
$server
The irc server to connect to
$minpeople
The minimum number of people speaking that will trigger sub people_talking
$maxseconds
The maximum number of seconds after someone last spoke before they are removed from consideration

Recognized Messages

The bot will respond to certain messages and provide information or perform a given action. A list of the understood commands follows.

quit
The bot will exit the server and the program will end.
status
The bot will report various status information.
check
The bot will immediately perform a check of people in the channel. Normally checks are performed whenever someone new speaks, provided that at least 5 seconds have elapsed since the last check.
clear
The bot will clear its information on people in the channel
minpeople (number)
Resets the minimum number that, when found speaking, will be considered to mean the channel is active
maxseconds (number)
Resets the number of seconds to pause before considering someone who has not spoken as not contributing to the channel
info (nick)
Provides information on a given nick, including when they last spoke

Command-Line Arguments

The script accepts two command-line arguments. The first is the minimum number of peple, and the second is the maximum number of seconds. If the second argument or both arguments are not supplied, defaults are taken from the lines near the top of the script.