archive

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

v.pl (786B)

      1 use strict;
      2 use Irssi;
      3 
      4 # The /v command will voice everyone in the channel that doesnt have voice or higher (halfop, op, etc).
      5 
      6 sub cmd_massvoice {
      7     my ($data, $server, $channel) = @_;
      8     Irssi::printformat(MSGLEVEL_CRAP, "v: Not connected to server."),        return if (!$server or !$server->{connected});
      9     Irssi::printformat(MSGLEVEL_CRAP, "v: No active channel in window."),    return if (!$channel or ($channel->{type} ne "CHANNEL"));
     10     my @nicks             = $channel->nicks();
     11     my @normal_nicks      = grep { $_->{prefixes} !~ /[\~\&\@\%\+]/ } @nicks;
     12     my @normal_nick_names = map { $_->{nick} } @normal_nicks;
     13     my $spaced_nicks      = join(" ", @normal_nick_names);
     14     $channel->command("VOICE $spaced_nicks");
     15 }
     16 
     17 Irssi::command_bind('v', 'cmd_massvoice');