Created
March 29, 2011 22:14
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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