diff --git a/source/bot.py b/source/bot.py index 540fa6a..fdf7af2 100644 --- a/source/bot.py +++ b/source/bot.py @@ -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