fix: continue registration if user submits valid number for age
This commit is contained in:
parent
55a5a3e5d6
commit
a31350c6fc
1 changed files with 11 additions and 4 deletions
|
@ -16,7 +16,7 @@ fun Router<*>.routing() {
|
||||||
handle {
|
handle {
|
||||||
val keyboard = inlineKeyboard {
|
val keyboard = inlineKeyboard {
|
||||||
row {
|
row {
|
||||||
button(update.message!!.from!!.firstName, "username")
|
button(message.from!!.firstName, "username")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,9 +52,16 @@ fun Router<*>.routing() {
|
||||||
text {
|
text {
|
||||||
handle {
|
handle {
|
||||||
val age = message.text!!
|
val age = message.text!!
|
||||||
data.set("age", age)
|
|
||||||
setState(StartStates.WaitingCity)
|
try {
|
||||||
message.answer("Well, in which city do you live?")
|
age.toInt()
|
||||||
|
|
||||||
|
data.set("age", age)
|
||||||
|
setState(StartStates.WaitingCity)
|
||||||
|
message.answer("Well, in which city do you live?")
|
||||||
|
} catch (e: NumberFormatException) {
|
||||||
|
message.answer("Wrong input! Age must be a valid number!")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue