mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-22 18:52:40 +01:00
Plugin/Wordle: add info
command; minor tweak to start
error-handling
This commit is contained in:
parent
d29a60978e
commit
71a4c4c331
@ -29,7 +29,7 @@ sub unload($self) {
|
||||
}
|
||||
|
||||
use constant {
|
||||
USAGE => 'Usage: wordle start [length [wordlist]] | custom <word> <channel> [wordlist] | guess <word> | letters | show | giveup',
|
||||
USAGE => 'Usage: wordle start [length [wordlist]] | custom <word> <channel> [wordlist] | guess <word> | letters | show | info | giveup',
|
||||
NO_WORDLE => 'There is no Wordle yet. Use `wordle start` to begin a game.',
|
||||
|
||||
DEFAULT_LIST => 'american',
|
||||
@ -152,6 +152,14 @@ sub wordle($self, $context) {
|
||||
return $self->show_wordle($channel, 1);
|
||||
}
|
||||
|
||||
when ('info') {
|
||||
if (not defined $self->{$channel}->{wordle}) {
|
||||
return NO_WORDLE;
|
||||
}
|
||||
|
||||
return "Current wordlist: $self->{$channel}->{wordlist} ($self->{$channel}->{length}); guesses attempted: $self->{$channel}->{guess_count}\n";
|
||||
}
|
||||
|
||||
when ('giveup') {
|
||||
if (not defined $self->{$channel}->{wordle}) {
|
||||
return NO_WORDLE;
|
||||
@ -168,10 +176,6 @@ sub wordle($self, $context) {
|
||||
return "Invalid arguments; Usage: wordle start [word length [wordlist]]";
|
||||
}
|
||||
|
||||
if (defined $self->{$channel}->{wordle} && $self->{$channel}->{correct} == 0) {
|
||||
return "There is already a Wordle underway! Use `wordle show` to see the current progress or `wordle giveup` to end it.";
|
||||
}
|
||||
|
||||
my $length = DEFAULT_LENGTH;
|
||||
|
||||
my $wordlist = $args[1] // DEFAULT_LIST;
|
||||
@ -191,6 +195,10 @@ sub wordle($self, $context) {
|
||||
$length = $args[0];
|
||||
}
|
||||
|
||||
if (defined $self->{$channel}->{wordle} && $self->{$channel}->{correct} == 0) {
|
||||
return "There is already a Wordle underway! Use `wordle show` to see the current progress or `wordle giveup` to end it.";
|
||||
}
|
||||
|
||||
return $self->make_wordle($channel, $length, undef, $wordlist);
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,8 @@ use PBot::Imports;
|
||||
# These are set by the /misc/update_version script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 4800,
|
||||
BUILD_DATE => "2024-10-06",
|
||||
BUILD_REVISION => 4801,
|
||||
BUILD_DATE => "2024-10-15",
|
||||
};
|
||||
|
||||
sub initialize {}
|
||||
|
Loading…
Reference in New Issue
Block a user