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:
parent
9d420fd5c9
commit
7bec49c4ed
@ -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.";
|
||||||
|
Loading…
Reference in New Issue
Block a user