Do a variation of the weekday introduction prefix
Also introduce a fallback emoji, in case no emojis were found for the
menu 😱
And fix a small text formatting bug in an error message.
This commit is contained in:
parent
5c41cda184
commit
ba052f30de
|
@ -95,7 +95,7 @@ def get_photo_url(menu: str):
|
|||
except JSONDecodeError:
|
||||
sys.stderr.write("Unable to parse JSON from Craiyon response:\n")
|
||||
sys.stderr.write(f"{response.text}\n")
|
||||
sys.stderr.write("Waited for {datetime.datetime.now() - craiyon_start}.")
|
||||
sys.stderr.write(f"Waited for {datetime.datetime.now() - craiyon_start}.")
|
||||
return None
|
||||
|
||||
return (f"https://img.craiyon.com/{image}", translation)
|
||||
|
@ -161,9 +161,9 @@ else:
|
|||
"flag-kr": ["korea"],
|
||||
"hushed": ["surprise", "surprice"],
|
||||
"building_construction": ["byg selv", "byg-selv", "bygselv"],
|
||||
"fish": ["fisk", "laks", "rødspætte", "sej ", "kulmule"],
|
||||
"fish": ["fisk", "laks", "rødspætte", "sej ", "kulmule", "brosme"],
|
||||
"shrimp": ["reje"],
|
||||
"pig2": ["skinke", "gris", "nakkefilet", "flæsk"],
|
||||
"pig2": ["skinke", "gris", "nakkefilet", "flæsk", "pork"],
|
||||
"cow": ["hakkebøf"],
|
||||
"cow2": ["kalv", "okse"],
|
||||
"chicken": ["kylling", "chicken"],
|
||||
|
@ -204,6 +204,7 @@ else:
|
|||
"apple": ["æble"],
|
||||
"peanuts": ["peanut"],
|
||||
"baguette_bread": ["flute"],
|
||||
"the_horns": ["diablo"],
|
||||
"wave": ["farvel"],
|
||||
"gift_heart": ["valentines"],
|
||||
"stars::fish::shrimp::lemon": ["stjerneskud"],
|
||||
|
@ -216,8 +217,8 @@ else:
|
|||
emojis = f":{': :'.join(emojis)}:"
|
||||
sys.stdout.write(f"Emojis determined: {emojis}\n")
|
||||
else:
|
||||
emojis = ""
|
||||
sys.stdout.write("No emojis determined.\n")
|
||||
emojis = random.choice([":cook:", ":knife_fork_plate:"])
|
||||
sys.stdout.write("No emojis determined. Using a fallback emoji.\n")
|
||||
|
||||
# Pick an introduction for the menu.
|
||||
tokens = {
|
||||
|
@ -262,7 +263,11 @@ else:
|
|||
]
|
||||
)
|
||||
if random.randint(0, 2) == 0:
|
||||
introduction = "Det er {weekday} og " + introduction
|
||||
introduction = (
|
||||
random.choice(["Det er", "Så blev det"])
|
||||
+ " {weekday} og "
|
||||
+ introduction
|
||||
)
|
||||
else:
|
||||
introduction = introduction.capitalize()
|
||||
introduction = introduction.format(**tokens)
|
||||
|
|
Loading…
Reference in a new issue