Request Tracker IRC Bot in Perl
At work we use Request Tracker for our ticket management, and IRC for our internal communication. I decided to take on a project of combining them in a more usable form. This wasn’t too difficult with the available perl modules, but I could not find a single implementation example, so I’m attaching my script below.
#!/usr/bin/perl
#Example IRC Bot for Request Tracker (RT)
#Errors about a DBI already existing are expected (after the first time you save variables)
#Built off: http://search.cpan.org/~mdom/Bot-BasicBot-Pluggable-0.70/lib/Bot/BasicBot/Pluggable.pm
#http://wiki.bestpractical.com/view/Contributions
#http://search.cpan.org/~dams/Bot-BasicBot-Pluggable-Module-RT/lib/Bot/BasicBot/Pluggable/Module/RT.pm
use warnings;
use strict;
package MyBot;
use base qw( Bot::BasicBot Bot::BasicBot::Pluggable );
# with all known options
my $bot = Bot::BasicBot::Pluggable->new( channels => ["#chan1","#chan2","#chan3"],
server => "irc.example.com",
port => "6667",
password => "your_server_password",
nick => "rtbot",
alt_nicks => "rtbot_",
username => "rtbot",
ssl => 1,
name => "Request Tracker IRC Bot",
ignore_list => [qw( dadadodo laotse dipsy)],
);
#Load this new Request Tracker Module
my $rt_module = $bot->load("RT");
#Required by RT to set variables
#Be sure to uncomment after initial setting, or its a security vulnerability!
#someone could /msg botnick !vars RT
my $vars_module = $bot->load("Vars");
$bot->run();
Update: Always make sure to DISABLE the Vars module after setting your variables, otherwise someone can read your password over IRC!
Post a comment