Skip to content

Commit

Permalink
Merge branch 'master' of github.com:tadzik/a8bot
Browse files Browse the repository at this point in the history
  • Loading branch information
lessmian committed May 20, 2010
2 parents 6525316 + 1cb5306 commit 5a0bae0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions plugins/Odzywki.pm
Expand Up @@ -2,6 +2,7 @@ package Odzywki;
use Tie::RegexpHash; use Tie::RegexpHash;


tie my %db, 'Tie::RegexpHash'; tie my %db, 'Tie::RegexpHash';
$lastresponse = 0;


%db = ( %db = (
qr/.*kurwa.*/i => \&kurwa, qr/.*kurwa.*/i => \&kurwa,
Expand All @@ -19,9 +20,11 @@ sub init {


sub pubmsg { sub pubmsg {
my ($bot, $data) = @_; my ($bot, $data) = @_;
return if int(rand(2)); if (time - $lastresponse > 120) {
if (my $resp = $db{$data->{msg}}) { if (my $resp = $db{$data->{msg}}) {
return "$data->{nick}: " . &$resp; $lastresponse = time;
return "$data->{nick}: " . &$resp;
}
} }
} }


Expand Down

0 comments on commit 5a0bae0

Please sign in to comment.