1
0
mirror of https://github.com/irssi/irssi.git synced 2024-07-07 02:54:19 -04:00
irssi/scripts/privmsg.pl

18 lines
453 B
Perl
Raw Normal View History

# listen PRIVMSGs - send a notice to yourself when your nick is meantioned
use Irssi;
sub event_privmsg {
my ($server, $data, $nick, $address) = @_;
my ($target, $text) = $data =~ /^(\S*)\s:(.*)/;
return if (!$server->ischannel($target));
$mynick = $server->{nick};
return if ($text !~ /\b$mynick\b/);
$server->command("/notice $mynick In channel $target, $nick!$address said: $text");
}
Irssi::signal_add("event privmsg", "event_privmsg");