public
Last active

IRC bot that notifies via libnotify popups and festival text-to-speech converter

  • Download Gist
freenode.yml
YAML
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
conn_info:
server: irc.freenode.net
port: 6667
channels:
- '#foo'
- '#bar'
nick: foobot
username: foobot
name: defender of the universe
ignore_list:
- redbot
- robot
- srjk
charset: utf-8
#ssl: 1
ironbot.pl
Perl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#!/usr/bin/env perl
package IronBot;
use base qw(Bot::BasicBot);
use strict;
use warnings;
use YAML::XS qw(LoadFile);
 
die "usage: $0 config.yml\n" unless @ARGV;
 
# Callback that gets called whenever something is said
sub said {
my ($self, $params) = @_;
my ($body, $who, $channel) = @$params{qw(body who channel)};
open my $festival, '| festival --tts';
print $festival "$body\n";
system 'notify-send', "$channel - $who", $body;
return;
}
 
my $bot = IronBot->new(%{LoadFile($ARGV[0])->{conn_info}});
$bot->run();

To install dependencies:
cpan Bot::BasicBot POE::Component::SSLify
aptitude install libnotify-bin festival

POE::Component::SSLify is only needed if you want to connect to an irc server via ssl.

Usage:
./ironbot freenode.yml

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.