3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-23 11:12:42 +01:00

Plugins/WordMorph: validate word length (#69)

This commit is contained in:
Ckat 2022-10-01 16:49:15 +00:00 committed by GitHub
parent 9d420fd5c9
commit 7bec49c4ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,7 +63,9 @@ sub wordmorph {
return DB_UNAVAILABLE if not $self->{db}; return DB_UNAVAILABLE if not $self->{db};
if (not exists $self->{db}->{length $args[0]}->{$args[0]}) { if (length($args[0]) > 7) {
return "$args[0] is too long, max allowed is 7.";
} elsif (not exists $self->{db}->{length $args[0]}->{$args[0]}) {
return "I do not know this word `$args[0]`."; return "I do not know this word `$args[0]`.";
} }
@ -79,7 +81,9 @@ sub wordmorph {
return DB_UNAVAILABLE if not $self->{db}; return DB_UNAVAILABLE if not $self->{db};
if (not exists $self->{db}->{length $args[0]}->{$args[0]}) { if (length($args[0]) > 7) {
return "$args[0] is too long, max allowed is 7.";
} elsif (not exists $self->{db}->{length $args[0]}->{$args[0]}) {
return "I do not know this word `$args[0]`."; return "I do not know this word `$args[0]`.";
} else { } else {
return "Yes, `$args[0]` is a word I know."; return "Yes, `$args[0]` is a word I know.";