2026-08-13 03:41:47 -07:00
|
|
|
package tgbot
|
|
|
|
|
|
2026-08-15 06:27:02 -07:00
|
|
|
// updateNumericInput applies one number-pad key: -2 clears, -1 backspaces, and 0..9 append.
|
|
|
|
|
// Callers retain their own validation and keyboard labels.
|
2026-08-13 03:41:47 -07:00
|
|
|
func updateNumericInput(value, key int) int {
|
|
|
|
|
switch key {
|
|
|
|
|
case -2:
|
|
|
|
|
return 0
|
|
|
|
|
case -1:
|
|
|
|
|
if value > 0 {
|
|
|
|
|
return value / 10
|
|
|
|
|
}
|
|
|
|
|
return value
|
|
|
|
|
default:
|
|
|
|
|
return value*10 + key
|
|
|
|
|
}
|
|
|
|
|
}
|