Skip to content

Instantly share code, notes, and snippets.

@ironcamel
Created March 29, 2011 22:14
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ironcamel/893457 to your computer and use it in GitHub Desktop.
IRC bot that notifies via libnotify popups and festival text-to-speech converter
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
#!/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();
@ironcamel
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment