-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathduckbang.pl
47 lines (37 loc) · 984 Bytes
/
duckbang.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
45
use Irssi;
use Irssi::Irc;
use strict;
use vars qw($VERSION %IRSSI);
use Encode;
$VERSION = "0.0.3";
%IRSSI = (
authors => "Eiken",
contact => "",
name => "duckbang",
description => "",
license => "",
url => "",
);
sub sig_public {
my ($server, $msg, $nick, $address, $target) = @_;
my $botnick = "gonzobot";
my $swedenchan = "#Sweden";
if ($botnick eq $nick) {
if ($target eq $swedenchan) {
Irssi::print "duckbang: gonzobot said $msg";
my $msg2 = encode('ascii', $msg);
my $littlestring = '\?\?\?\?\?';
my @matches = $msg2 =~ /($littlestring)/g;
my $count = @matches;
if ($count > 0) {
Irssi::print "bang";
#my $sleepTime = 10+int(rand(10));
my $sleepTime = 0;
Irssi::print $sleepTime;
sleep($sleepTime);
$server->command("MSG $target .bang");
}
}
}
}
Irssi::signal_add_last('message public', 'sig_public');