Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Odzywki.pm reacts from time to time

  • Loading branch information...
commit 1cb5306a9420f4ae0181a1ee38202d84987ad1f1 1 parent 22e4467
Tadeusz Sośnierz authored
Showing with 6 additions and 3 deletions.
  1. +6 −3 plugins/Odzywki.pm
9 plugins/Odzywki.pm
View
@@ -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;
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.