diff --git a/lib/PBot/Plugin/WordMorph.pm b/lib/PBot/Plugin/WordMorph.pm index d8c75e05..0130c78a 100644 --- a/lib/PBot/Plugin/WordMorph.pm +++ b/lib/PBot/Plugin/WordMorph.pm @@ -35,7 +35,7 @@ sub unload { } use constant { - USAGE => 'Usage: wordmorph start [steps to solve [word length]] | custom | solve | show | hint [from direction] | giveup', + USAGE => 'Usage: wordmorph start [steps to solve [word length]] | custom | solve | hint [from direction] | check | show | giveup', NO_MORPH_AVAILABLE => "There is no word morph available. Use `wordmorph start [steps to solve [word length]]` to create one.", DB_UNAVAILABLE => "Word morph database not available.", LEFT => 0, @@ -56,6 +56,20 @@ sub wordmorph { my $channel = $context->{from}; given ($command) { + when ('check') { + if (!@args || @args > 1) { + return 'Usage: wordmorph check ; check if a word exists in the Word Morph database'; + } + + return DB_UNAVAILABLE if not $self->{db}; + + if (not exists $self->{db}->{length $args[0]}->{$args[0]}) { + return "I do not know this word `$args[0]`."; + } else { + return "Yes, `$args[0]` is a word I know."; + } + } + when ('hint') { if (not defined $self->{$channel}->{morph}) { return NO_MORPH_AVAILABLE; diff --git a/lib/PBot/VERSION.pm b/lib/PBot/VERSION.pm index ca2ea9b6..a0e0da63 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 => 4581, - BUILD_DATE => "2022-09-04", + BUILD_REVISION => 4582, + BUILD_DATE => "2022-09-06", }; sub initialize {}