Created
January 2, 2013 16:36
-
-
Save that4chanwolf/4435901 to your computer and use it in GitHub Desktop.
Kumagawa.pl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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