logic mistake fix
This commit is contained in:
parent
6f827e1c7a
commit
d4ca82e5fd
@ -597,23 +597,27 @@ def get_user_guess(message, start_time):
|
||||
end_time = time.time()
|
||||
user_id = int(message.from_user.id)
|
||||
|
||||
found = False
|
||||
|
||||
if message.text.count(",") == 0:
|
||||
try:
|
||||
user_guess = float(message.text)
|
||||
found = True
|
||||
except ValueError:
|
||||
bot.send_message(chat_id=user_id, text="Please type a number (or float with '.' )")
|
||||
bot.register_next_step_handler(message, get_user_guess, start_time)
|
||||
return
|
||||
|
||||
if message.text.count(",") == 1:
|
||||
if message.text.count(",") == 1 and found is False:
|
||||
try:
|
||||
user_guess = float(message.text.replace(",", "."))
|
||||
found = True
|
||||
except ValueError:
|
||||
bot.send_message(chat_id=user_id, text="Please type a number of float")
|
||||
bot.register_next_step_handler(message, get_user_guess, start_time)
|
||||
return
|
||||
else:
|
||||
|
||||
if message.text.count(",") > 1 and found is False:
|
||||
bot.send_message(chat_id=user_id, text="Please type a number or float")
|
||||
bot.register_next_step_handler(message, get_user_guess, start_time)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user