Make all categories lower case to avoid KeyErrors (#1475)

This commit is contained in:
Bibo-Joshi 2019-08-18 17:39:29 +02:00 committed by Noam Meltzer
parent 9d005d5124
commit 24546bda67

View file

@ -62,13 +62,13 @@ def start(update, context):
def regular_choice(update, context): def regular_choice(update, context):
text = update.message.text text = update.message.text.lower()
context.user_data['choice'] = text context.user_data['choice'] = text
if context.user_data.get(text): if context.user_data.get(text):
reply_text = 'Your {}, I already know the following ' \ reply_text = 'Your {}, I already know the following ' \
'about that: {}'.format(text.lower(), context.user_data[text.lower()]) 'about that: {}'.format(text, context.user_data[text])
else: else:
reply_text = 'Your {}? Yes, I would love to hear about that!'.format(text.lower()) reply_text = 'Your {}? Yes, I would love to hear about that!'.format(text)
update.message.reply_text(reply_text) update.message.reply_text(reply_text)
return TYPING_REPLY return TYPING_REPLY