From 7d7bba643e17bf19b8584036648a7bb6cf4cdd5f Mon Sep 17 00:00:00 2001 From: n Date: Sat, 1 Feb 2025 16:48:31 -0600 Subject: [PATCH] Parse data --- bot.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index c74a595..b486bc3 100644 --- a/bot.py +++ b/bot.py @@ -75,10 +75,33 @@ async def make_choice(room, message): quoteImage = fetch.fetchQuote(id) quoteData = fetch.fetchQuoteData(id) + def formatData(data): + dataToFormat = data + created = str(data['created']) + description = str(data['desc']) + imageid = str(data['iid']) + ocr = str(data['ocr']) + score = str(data['score']) + return created, description, imageid, ocr, score + if debugMode == False: - message1 = ("Data: " + str(quoteData)) + created, description, imageid, ocr, score = formatData(quoteData) + message1 = (f""" + Created: {created} + Description: {description} + Image ID: {imageid} + OCR (Tesseract): {ocr} + Rating: {score} + """) else: - message1 = (quoteData) + created, description, imageid, ocr, score = formatData(quoteData) + message1 = (f""" + Created: {created} + Description: {description} + Image ID: {imageid} + OCR (Tesseract): {ocr} + Rating: {score} + """) message2 = (f""" Command recived (DEBUG). (We're supposed to fetch quote number {id} now.)