Skip to content

Instantly share code, notes, and snippets.

@resilar
Last active February 25, 2017 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save resilar/16b6e0b6f81745ecf1d5d95e583e1741 to your computer and use it in GitHub Desktop.
Save resilar/16b6e0b6f81745ecf1d5d95e583e1741 to your computer and use it in GitHub Desktop.
irssi script
use strict;
use warnings;
use Irssi;
our $VERSION = '0.0.6283185307';
our %IRSSI = (
authors => 'def',
contact => 'def <def@lelantos.org>',
name => 'spoiler',
description => 'Colorize lines of idiots with black on black text',
license => 'Public domain',
);
# /load spoiler.pl
# /set spoiler_nicks lamia
# /set -clear spoiler_nicks
my @spoiler_nicks;
sub message_public {
my ($server, $msg, $nick, $address, $target) = @_;
my $color = '';
$color = "\0031,1" if (grep $_ eq $nick, @spoiler_nicks);
$server->command('/^format pubmsg {pubmsgnick $2 {pubnick $0}}' . $color . '$1');
}
sub setup_changed { @spoiler_nicks = split /\s+|,/, Irssi::settings_get_str('spoiler_nicks'); }
Irssi::signal_add('message public', 'message_public');
Irssi::signal_add_last('setup changed', 'setup_changed');
Irssi::settings_add_str('spoiler', 'spoiler_nicks' => '');
setup_changed();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment