mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
20 lines
484 B
Perl
20 lines
484 B
Perl
|
# listen PRIVMSGs - send a notice to yourself when your nick is meantioned
|
||
|
|
||
|
use Irssi;
|
||
|
|
||
|
sub event_privmsg {
|
||
|
my ($data, $server, $nick, $address) = @_;
|
||
|
my ($target, $text) = $data =~ /^(\S*)\s:(.*)/;
|
||
|
|
||
|
return if (!Irssi::is_channel($target));
|
||
|
|
||
|
%sinfo = %{$server->values()};
|
||
|
$mynick = $sinfo{'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");
|