|
|
|
@ -4,10 +4,11 @@ use Data::Dumper;
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
|
|
my $irc = new Net::IRC;
|
|
|
|
|
my $conn = $irc->newconn(Nick => 'puddingbrumsel',
|
|
|
|
|
my $mynick = "puddingbrumsel";
|
|
|
|
|
my $conn = $irc->newconn(Nick => "$mynick",
|
|
|
|
|
Server => shift || 'irc.belwue.de');
|
|
|
|
|
|
|
|
|
|
$conn->{channel} = shift || "!6Y9HIabcde";
|
|
|
|
|
$conn->{channel} = shift || "!6ZVX3puddingtest";
|
|
|
|
|
$conn->{lastpudding} = time();
|
|
|
|
|
$conn->{specialwday} = 0;
|
|
|
|
|
|
|
|
|
@ -19,6 +20,11 @@ sub pudding {
|
|
|
|
|
} elsif (rand(4) > 3) {
|
|
|
|
|
$pudding = "ah, ",
|
|
|
|
|
}
|
|
|
|
|
if (rand(4) > 3) {
|
|
|
|
|
$pudding = "mehr ",
|
|
|
|
|
} elsif (rand(4) > 3) {
|
|
|
|
|
$pudding = "viel ",
|
|
|
|
|
}
|
|
|
|
|
my (undef, undef, undef, undef, undef, undef, $wday) = localtime(time());
|
|
|
|
|
if ($wday == $conn->{specialwday}) {
|
|
|
|
|
my @foo = ( "spinat", "wirsing", "eisbein", "sauerkraut", "tomaten", "hafer" );
|
|
|
|
@ -27,6 +33,8 @@ sub pudding {
|
|
|
|
|
$pudding .= "pudding";
|
|
|
|
|
if (rand(4) > 3) {
|
|
|
|
|
$pudding .= "!";
|
|
|
|
|
} elsif (rand(4) > 3) {
|
|
|
|
|
$pudding .= "?";
|
|
|
|
|
} else {
|
|
|
|
|
$pudding .= ".";
|
|
|
|
|
}
|
|
|
|
@ -38,6 +46,9 @@ sub pudding {
|
|
|
|
|
if ($wday == $conn->{specialwday}) {
|
|
|
|
|
$brums .= " *brums*";
|
|
|
|
|
}
|
|
|
|
|
if (rand(5) > 4) {
|
|
|
|
|
$brums .= " :)";
|
|
|
|
|
}
|
|
|
|
|
return "$pudding $brums";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -55,17 +66,29 @@ sub on_msg {
|
|
|
|
|
my ($conn, $event) = @_;
|
|
|
|
|
|
|
|
|
|
if ($event->{to}[0] eq $conn->{channel}) {
|
|
|
|
|
my $wait = 24 * 3600 * (rand()+0.5);
|
|
|
|
|
my $nick = $event->{nick};
|
|
|
|
|
my $text = $event->{args}[0];
|
|
|
|
|
|
|
|
|
|
if ($nick ne $mynick && ($text =~ /pudding/ || $text =~ /brums/)) {
|
|
|
|
|
print Dumper($event);
|
|
|
|
|
sleep(rand(30));
|
|
|
|
|
print "=> $conn->{channel}\n";
|
|
|
|
|
$conn->privmsg($conn->{channel}, "$nick: " . pudding);
|
|
|
|
|
$conn->{lastpudding} = time();
|
|
|
|
|
} else {
|
|
|
|
|
my $wait = 24 * 3600 * (rand()-0.5);
|
|
|
|
|
my (undef, undef, undef, undef, undef, undef, $wday) = localtime(time());
|
|
|
|
|
if ($wday == $conn->{specialwday}) {
|
|
|
|
|
$wait = 6 * 3600 * (rand()+0.5);
|
|
|
|
|
$wait = 6 * 3600 * (rand()-0.5);
|
|
|
|
|
}
|
|
|
|
|
if (time() > $conn->{lastpudding} + $wait) {
|
|
|
|
|
print "=> $conn->{channel}\n";
|
|
|
|
|
$conn->privmsg($conn->{channel}, pudding);
|
|
|
|
|
$conn->{lastpudding} = time();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
sleep(rand(30));
|
|
|
|
|
print "=> $event->{nick}\n";
|
|
|
|
|
$conn->privmsg($event->{nick}, pudding);
|
|
|
|
|
}
|
|
|
|
|