mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-22 18:52:40 +01:00
Plugin/Wordle: fix not detecting duplicate letters
This commit is contained in:
parent
26a2b36122
commit
5d3507421e
@ -953,6 +953,7 @@ sub add_message_to_output_queue($self, $channel, $message, $delay = 0) {
|
||||
hostmask => $message->{hostmask},
|
||||
output => $message->{message},
|
||||
command => $message->{command},
|
||||
keyword => $message->{keyword},
|
||||
checkflood => $message->{checkflood}
|
||||
};
|
||||
|
||||
|
@ -127,6 +127,7 @@ sub wordle($self, $context) {
|
||||
host => 'localhost',
|
||||
hostmask => "$botnick!wordle\@localhost",
|
||||
command => 'wordle',
|
||||
keyword => 'wordle',
|
||||
checkflood => 1,
|
||||
message => "$context->{nick} started a custom $result",
|
||||
};
|
||||
@ -284,7 +285,6 @@ sub guess_wordle($self, $channel, $guess) {
|
||||
|
||||
for (my $i = 0; $i < @wordle; $i++) {
|
||||
if ($guess[$i] eq $wordle[$i]) {
|
||||
$seen{$guess[$i]}++;
|
||||
$correct++;
|
||||
push @result, "*$guess[$i]*";
|
||||
$self->{$channel}->{letters}->{$guess[$i]} = LETTER_CORRECT;
|
||||
@ -307,7 +307,10 @@ sub guess_wordle($self, $channel, $guess) {
|
||||
$self->{$channel}->{letters}->{$guess[$i]} = LETTER_PRESENT;
|
||||
} else {
|
||||
push @result, "$guess[$i]";
|
||||
$self->{$channel}->{letters}->{$guess[$i]} = LETTER_INVALID;
|
||||
|
||||
if ($self->{$channel}->{letters}->{$guess[$i]} == 0) {
|
||||
$self->{$channel}->{letters}->{$guess[$i]} = LETTER_INVALID;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ use PBot::Imports;
|
||||
# These are set by the /misc/update_version script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 4714,
|
||||
BUILD_REVISION => 4715,
|
||||
BUILD_DATE => "2024-03-09",
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user