From 819f44836a892885c2ec3bb63faf5250d6a23d4c Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 27 Jan 2016 15:41:57 +0100 Subject: [PATCH] Controllo errori durante /roll --- bot.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 05572878..491be3f1 100644 --- a/bot.py +++ b/bot.py @@ -297,7 +297,10 @@ while True: print("@" + username + ": /roll") cmd = text.split(' ', 1) if len(cmd) >= 2: - m = int(cmd[1]) + try: + m = int(cmd[1]) + except ValueError: + telegram.sendmessage(chr(9888) + " Il numero specificato non รจ un intero.") else: m = 100 n = random.randrange(m) + 1