1
0
Fork 0

mehr pudding weniger bugs

master
puddingbrumsel 17 years ago
parent f5f7adac4b
commit a18968e8a2

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