Permalink
Browse files

Odzywki.pm reacts from time to time

  • Loading branch information...
1 parent 22e4467 commit 1cb5306a9420f4ae0181a1ee38202d84987ad1f1 @tadzik committed May 20, 2010
Showing with 6 additions and 3 deletions.
  1. +6 −3 plugins/Odzywki.pm
View
9 plugins/Odzywki.pm
@@ -2,6 +2,7 @@ package Odzywki;
use Tie::RegexpHash;
tie my %db, 'Tie::RegexpHash';
+$lastresponse = 0;
%db = (
qr/.*kurwa.*/i => \&kurwa,
@@ -19,9 +20,11 @@ sub init {
sub pubmsg {
my ($bot, $data) = @_;
- return if int(rand(2));
- if (my $resp = $db{$data->{msg}}) {
- return "$data->{nick}: " . &$resp;
+ if (time - $lastresponse > 120) {
+ if (my $resp = $db{$data->{msg}}) {
+ $lastresponse = time;
+ return "$data->{nick}: " . &$resp;
+ }
}
}

0 comments on commit 1cb5306

Please sign in to comment.