mirror of
https://github.com/pragma-/pbot.git
synced 2025-02-02 07:24:09 +01:00
$randomnick now limited to nicks who have spoken in last 2 hours
This commit is contained in:
parent
cf4478c1a4
commit
a21b27a11f
@ -164,7 +164,8 @@ sub random_nick {
|
||||
$channel = lc $channel;
|
||||
|
||||
if (exists $self->{nicklist}->{$channel}) {
|
||||
my @nicks = keys $self->{nicklist}->{$channel};
|
||||
my $now = gettimeofday;
|
||||
my @nicks = grep { $now - $self->{nicklist}->{$channel}->{$_}->{timestamp} < 3600 * 2 } keys $self->{nicklist}->{$channel};
|
||||
my $nick = $nicks[rand @nicks];
|
||||
return $self->{nicklist}->{$channel}->{$nick}->{nick};
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user