mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-16 16:20:59 +00:00
aecbad3ab1
Co-authored-by: n0ctal <293235942+n0ctal@users.noreply.github.com>
18 lines
355 B
Go
18 lines
355 B
Go
package tgbot
|
|
|
|
// updateNumericInput applies one number-pad key: -2 clears, -1 backspaces, and 0..9 append.
|
|
// Callers retain their own validation and keyboard labels.
|
|
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
|
|
}
|
|
}
|