From 404bda88f49c1dd9d9d251ecc9346b8e17a3cd47 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Fri, 24 Mar 2017 12:56:05 +0100 Subject: [PATCH] TODO --- grandbot.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/grandbot.py b/grandbot.py index a63de24b..adec8658 100644 --- a/grandbot.py +++ b/grandbot.py @@ -135,11 +135,13 @@ Sintassi: `/leggi `""" entry_number = random.randrange(len(entries)) else: # ...or a specific one - entry_number = arguments[0] + # TODO: check if the entry actually exists + # TODO: check if the first argument is a number + entry_number = int(arguments[0]) # Split the timestamp from the text entry = entries[entry_number].split("|", 1) # Parse the timestamp - date = datetime.datetime.fromtimestamp(entry[0]).isoformat() + date = datetime.datetime.fromtimestamp(int(entry[0])).isoformat() # Get the text text = entry[1] # Sanitize the text to prevent TelegramErrors @@ -167,11 +169,13 @@ async def leggi_discord(bot, message, arguments): entry_number = random.randrange(len(entries)) else: # ...or a specific one - entry_number = arguments[0] + # TODO: check if the entry actually exists + # TODO: check if the first argument is a number + entry_number = int(arguments[0]) # Split the timestamp from the text entry = entries[entry_number].split("|", 1) # Parse the timestamp - date = datetime.datetime.fromtimestamp(entry[0]).isoformat() + date = datetime.datetime.fromtimestamp(int(entry[0])).isoformat() # Get the text text = entry[1] # Sanitize the text to prevent TelegramErrors