mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-08-14 07:10:58 +00:00
238e4bb314
Co-authored-by: n0ctal <293235942+n0ctal@users.noreply.github.com>
19 lines
423 B
Go
19 lines
423 B
Go
package tgbot
|
|
|
|
// updateNumericInput applies one key from the shared inline number pad.
|
|
// Key -2 clears the value, -1 removes the last decimal digit, and 0..9 append
|
|
// a digit. 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
|
|
}
|
|
}
|