summaryrefslogtreecommitdiff
path: root/scripts/privmsg.pl
blob: 9fdcdcb19b0fa0a51d0f43258773e12008e91769 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# listen PRIVMSGs - send a notice to yourself when your nick is meantioned

use Irssi;
use Irssi::Irc;

sub event_privmsg {
	my ($data, $server, $nick, $address) = @_;
	my ($target, $text) = $data =~ /^(\S*)\s:(.*)/;

	return if (!$server->ischannel($target));

	$mynick = $server->values()->{'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");