Send error if Quest/Side Quest not found.

This commit is contained in:
Ceda EI 2018-11-03 19:04:06 +05:30
parent df944ed6ac
commit 2cdc6cae09
1 changed files with 11 additions and 6 deletions

17
bot.py
View File

@ -197,12 +197,17 @@ def list_quests(bot, update, player, type):
def quest(bot, update, player, qid, type): def quest(bot, update, player, qid, type):
if type == "quest": try:
x = questable.get_quest(player.DB, player.CHAT_ID, qid) if type == "quest":
elif type == "side_quest": x = questable.get_quest(player.DB, player.CHAT_ID, qid)
x = questable.get_side_quest(player.DB, player.CHAT_ID, qid) elif type == "side_quest":
else: x = questable.get_side_quest(player.DB, player.CHAT_ID, qid)
raise ValueError('Not quest or side_quest') except Exception:
chat_id = update.message.chat_id
text = ("<b>❗️ Could not find " +
{"quest": "Quest", "side_quest": "Side Quest"}[type] + "</b>")
bot.send_message(chat_id=chat_id, text=text, parse_mode="HTML")
return
text = ("<b>🗺 " + {"quest": "Quest", "side_quest": "Side Quest"}[type] text = ("<b>🗺 " + {"quest": "Quest", "side_quest": "Side Quest"}[type]
+ f":</b> {x.name}" + f":</b> {x.name}"