forked from n/quotes-bot-python
Parse data
This commit is contained in:
parent
0306704d69
commit
7d7bba643e
1 changed files with 25 additions and 2 deletions
27
bot.py
27
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.)
|
||||
|
|
Loading…
Add table
Reference in a new issue