Skip to content

Instantly share code, notes, and snippets.

@cjfields
Created February 27, 2010 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjfields/316353 to your computer and use it in GitHub Desktop.
Save cjfields/316353 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl -w
#svn_bioperl_irc.pl
use strict;
use warnings;
use WWW::Shorten 'TinyURL';
my $server = "irc.freenode.net";
my $port = 6667;
my $nick = "driveby_bot";
my $ident = "driveby_bot";
my $realname = "BioPerl CommitBot";
my $chan = "#bioperl";
my $pass = "";
use IO::Socket;
my ($REPOS, $REV, $USER, $COMMIT) = @ARGV;
my $shorturl = makeashorterlink("http://code.open-bio.org/svnweb/index.cgi/bioperl/revision?rev=$REV");
my $log = "$REPOS: r$REV ($USER) : $COMMIT";
my $irc=IO::Socket::INET->new(
PeerAddr=>$server,
PeerPort=>$port,
Proto=>'tcp') or die "Argh!";
#print $irc "USER $ident $ident $ident $ident :$realname\n";
print $irc "NICK $nick\n";
#print $irc "PRIVMSG nickserv/@/services.dal.net :identify $pass\n";
print $irc "USER $ident 8 * :$ident\n";
print $irc "join $chan\n";
while(defined(my $in=<$irc>)) {
if($in=~/^:(.+)\!.+ JOIN\b/) {
print $irc "PRIVMSG $chan :$log \n";
print $irc "PRIVMSG $chan :Diff: $shorturl \n";
last;
}
}
close($irc);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment