-
Notifications
You must be signed in to change notification settings - Fork 0
/
antibullybot.pl
44 lines (36 loc) · 1.28 KB
/
antibullybot.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use Irssi;
use Irssi::Irc;
use vars qw($VERSION %IRSSI);
$VERSION = "0.1";
%IRSSI = (
authors => 'Nico Bengtsson',
contact => '[email protected]',
name => 'AntiBullyBot',
description => 'Bot for Stop IRC Bullying Foundation',
license => 'WTFPL',
);
sub antibullybot {
my ($server, $data, $nick, $address) = @_;
my ( $chan, $msg ) = split(' :', $data);
if (!$server->ischannel($target)) {
if (lc($msg) eq 'voice') {
$server->command("MODE ##stop-irc-bullying +v $nick");
$server->command("MSG $nick Sure thing!");
}
}
if ($server->ischannel($chan)) {
my @string = split(/ /, $msg);
if ($string[0] eq '!bully') {
$server->command("MSG $chan $string[1]: $nick feels offended by your recent action(s). Please read http://stop-irc-bullying.info/stop");
}
}
}
sub greeter {
my ($server, $data, $nick, $address) = @_;
my ( $chan, $msg ) = split(' :', $data);
if ($chan eq '##stop-irc-bullying') {
$server->command("MSG $chan Welcome $nick! I hope you feel at home here!");
}
}
Irssi::signal_add('event privmsg', \&antibullybot);
Irssi::signal_add('event join', \&greeter);