Skip to content

Instantly share code, notes, and snippets.

@that4chanwolf
Created January 2, 2013 16:36
Show Gist options
  • Save that4chanwolf/4435901 to your computer and use it in GitHub Desktop.
Save that4chanwolf/4435901 to your computer and use it in GitHub Desktop.
Kumagawa.pl
use Irssi;
use strict;
sub halp {
print("I'm a fucking loser.");
};
sub loser {
my ($text, $server) = @_;
if($text eq '') {
return '';
} else {
if(Irssi::active_win()->{active}->{mode} =~ m/c/) {
return "『" . $text . "』";
} else {
return "『" . $text . "\003』";
}
}
}
sub auto_loser {
return unless Irssi::settings_get_bool('auto_loser');
my ($msg, $server, $witem) = @_;
Irssi::signal_stop();
Irssi::signal_remove('send text', 'auto_loser');
Irssi::signal_emit('send text', loser("$msg"), $server, $witem);
Irssi::signal_add('send text', 'auto_loser');
}
sub kumagawa {
my ($text, $server, $dest) = @_;
if(!$server || !$server->{connected}) {
print("Not connected to a server.");
return;
}
return unless $dest;
if ($dest->{type} eq "CHANNEL" || $dest->{type} eq "QUERY") {
$dest->command("/msg " . $dest->{name} . " " . loser($text));
}
}
Irssi::settings_add_bool('Kumagawa', 'auto_loser', 0);
Irssi::signal_add('send text', 'auto_loser');
Irssi::command_bind("kumagawa", "kumagawa");
Irssi::command_bind("kumagawa_help", "halp");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment