diff --git a/lib/PBot/Plugin/Wordle.pm b/lib/PBot/Plugin/Wordle.pm index 758efdd7..75016f9e 100644 --- a/lib/PBot/Plugin/Wordle.pm +++ b/lib/PBot/Plugin/Wordle.pm @@ -13,6 +13,7 @@ use PBot::Imports; use PBot::Core::Utils::IsAbbrev; use Storable qw(dclone); +use Time::HiRes qw/time/; use Time::Duration; use JSON::XS; use utf8; @@ -379,6 +380,10 @@ sub wordle($self, $context) { my $gameid = $self->gameid($args[2], $context, 1) // 'main'; my $game = $gameid ne 'main' ? "($gameid) " : ''; + if ($gameid !~ /^[a-zA-Z0-9_]{1,16}$/) { + return "Invalid game-id `$gameid`; must be [a-zA-Z0-9_]{1,16}"; + } + $self->{players}->{$channel}->{$context->{message_account}}->{gameid} = $gameid; if (defined $self->{games}->{$channel}->{$gameid}->{wordle} @@ -420,6 +425,10 @@ sub wordle($self, $context) { my $gameid = $self->gameid($args[3], $context, 1) // 'main'; my $game = $gameid ne 'main' ? "($gameid) " : ''; + if ($gameid !~ /^[a-zA-Z0-9_]{1,16}$/) { + return "Invalid game-id `$gameid`; must be [a-zA-Z0-9_]{1,16}"; + } + if (defined $self->{games}->{$custom_channel}->{$gameid}->{wordle} && !$self->{games}->{$custom_channel}->{$gameid}->{solved} && !$self->{games}->{$custom_channel}->{$gameid}->{givenup}) { @@ -570,6 +579,10 @@ sub gameid($self, $gameid, $context, $newgame = 0) { $gameid = $self->{players}->{$channel}->{$context->{message_account}}->{gameid}; return $gameid if defined $gameid; } + + if (exists $self->{games}->{$channel}->{main}) { + return 'main'; + } } else { if (!exists $self->{games}->{$channel}->{$gameid} && !$newgame) { return undef; @@ -909,7 +922,7 @@ sub check_games($self) { my $botnick = $self->{pbot}->{registry}->get_value('irc', 'botnick'); foreach my $channel (keys $self->{games}->%*) { foreach my $gameid (keys $self->{games}->{$channel}->%*) { - if ($now - $self->{games}->{$channel}->{$gameid}->{guess_time} > 60 * 60 * 24 * 3) { + if ($now - $self->{games}->{$channel}->{$gameid}->{guess_time} > 60 * 60 * 24) { my $wordle = join '', $self->{games}->{$channel}->{$gameid}->{wordle}->@*; my $state; diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index 227c3eb1..f8677f7b 100644 --- a/lib/PBot/VERSION.pm +++ b/lib/PBot/VERSION.pm @@ -25,8 +25,8 @@ use PBot::Imports; # These are set by the /misc/update_version script use constant { BUILD_NAME => "PBot", - BUILD_REVISION => 4922, - BUILD_DATE => "2025-10-22", + BUILD_REVISION => 4923, + BUILD_DATE => "2025-11-05", }; sub initialize {}