Fix a bug in the teapot

This commit is contained in:
Howard Abrams 2025-02-02 00:14:02 -08:00
parent 37f3e8d479
commit 6197dd9d92

View file

@ -83,12 +83,12 @@ class Teapot(Object):
def do_make_tea(self, drinker, args):
words = Token(args)
tea_choice = [tea for tea in TEA_TYPES.keys() if words.contains(tea)][0]
if tea_choice:
self.db.tea_type = tea_choice
elif words.empty():
self.db.tea_type = random.choice(TEA_TYPES.keys())
if words.empty() or words.contains("tea"):
self.db.tea_type = random.choice(list(TEA_TYPES.keys()))
else:
tea_choice = [tea for tea in TEA_TYPES.keys() if words.contains(tea)]
if len(tea_choice) > 0:
self.db.tea_type = tea_choice[0]
else:
self.db.tea_type = "unknown"
desc = TEA_TYPES[self.db.tea_type]