summaryrefslogtreecommitdiff
path: root/irssi/irssi-jtv.pl
blob: e9e72f5e24fa58f1ebaed672322793d8d4267f28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use Irssi 0.8.10 ();
use strict;

use vars qw($VERSION %IRSSI);

$VERSION="0.1.7";
%IRSSI = (
        authors=> 'jrayhawk',
        name=> 'jtv',
        description=> 'repeats JTV information',
        license=> 'GPL v2',
);

sub jtv_say {
        my ($server, $msg, $nick, $address) = @_;

        return if ($nick ne 'jtv');

        return if ($msg !~ /(.+) is now hosting you for (.+) viewers\./ );

        open(FILE, "~/.config/twitch/channel");
        my $channel = <FILE>;
        $channel = chomp($channel);
        close(FILE);

        $server->command("msg $channel Welcome, $2 viewers! Thanks for the host, $1!");
}

Irssi::signal_add_last('message private', 'jtv_say');