archive

- Random tools & helpful resources for IRC
git clone git://git.acid.vegas/archive.git
Log | Files | Refs | Archive

voicer.pl (829B)

      1 use strict;
      2 use warnings;
      3 use Irssi;
      4 use Irssi::Irc;
      5 
      6 our $VERSION = '1.0';
      7 our %IRSSI = (
      8     authors     => 'acidvegas (help from www)',
      9     contact     => 'acidvegas@supernets.org',
     10     name        => 'Voicer',
     11     description => 'A script to auto voice anyone who joins the channel after voicer_delay seconds..',
     12     license     => 'ISC',
     13     url         => 'http://github.coM/acidvegas/irssi',
     14 );
     15 
     16 sub send_voice {
     17     my ($server, $channel, $nick) = @{$_[0]};
     18     $server->command("/mode $channel +v $nick");
     19 }
     20 
     21 sub event_join {
     22     my ($server, $channel, $nick) = @_;
     23     my $delay = Irssi::settings_get_int('voicer_delay');
     24     Irssi::timeout_add_once( $delay * 1000, \&send_voice, [$server, $channel, $nick]);
     25 }
     26 
     27 Irssi::settings_add_int('misc', 'voicer_delay', 10);
     28 Irssi::signal_add_last('message join', 'event_join');