Update quest/side quest view.
Quests/Side Quests have status listed. Completed quests only show a back button
This commit is contained in:
parent
74424526d6
commit
705b10abc9
25
bot.py
25
bot.py
|
@ -207,14 +207,21 @@ def quest(bot, update, player, qid, type):
|
||||||
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}"
|
||||||
"\n<b>📌 Priority:</b> " + ["Low", "Medium", "High"][x.imp-1]
|
"\n<b>📌 Priority:</b> " + ["Low", "Medium", "High"][x.imp-1]
|
||||||
+ "\n<b>📘 Difficulty:</b> " + ["Low", "Medium", "High"][x.diff-1])
|
+ "\n<b>📘 Difficulty:</b> " + ["Low", "Medium", "High"][x.diff-1]
|
||||||
|
+ "\n<b>" + ["❎", "✅"][x.state] + " Status:</b> "
|
||||||
|
+ ["Incomplete", "Complete"][x.state])
|
||||||
|
|
||||||
|
if x.state == 1:
|
||||||
|
player.set_state('bo', 0)
|
||||||
|
custom_keyboard = [["Back"]]
|
||||||
|
elif x.state == 0:
|
||||||
|
state = {"quest": "eq", "side_quest": "esq"}[type]
|
||||||
|
player.set_state(state, qid)
|
||||||
|
custom_keyboard = [
|
||||||
|
["Mark as done"],
|
||||||
|
["Edit Name", "Change Priority", "Change Difficulty"],
|
||||||
|
["Back"]]
|
||||||
|
|
||||||
state = {"quest": "eq", "side_quest": "esq"}[type]
|
|
||||||
player.set_state(state, qid)
|
|
||||||
custom_keyboard = [
|
|
||||||
["Mark as done"],
|
|
||||||
["Edit Name", "Change Priority", "Change Difficulty"],
|
|
||||||
["Back"]]
|
|
||||||
reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard)
|
reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard)
|
||||||
chat_id = update.message.chat_id
|
chat_id = update.message.chat_id
|
||||||
bot.send_message(chat_id=chat_id, text=text, parse_mode="HTML",
|
bot.send_message(chat_id=chat_id, text=text, parse_mode="HTML",
|
||||||
|
@ -270,6 +277,7 @@ def message_handling(bot, update, db):
|
||||||
# qi / sqi: (Side) Quest importance: User has entered difficulty,
|
# qi / sqi: (Side) Quest importance: User has entered difficulty,
|
||||||
# importance requested
|
# importance requested
|
||||||
# eq / qsq: Edit Quest / Side Quest. the user press /Q_\d+ or /SQ_\d+
|
# eq / qsq: Edit Quest / Side Quest. the user press /Q_\d+ or /SQ_\d+
|
||||||
|
# bo: Back Only
|
||||||
|
|
||||||
if state["state"] == "none":
|
if state["state"] == "none":
|
||||||
if text == "add quest":
|
if text == "add quest":
|
||||||
|
@ -304,6 +312,9 @@ def message_handling(bot, update, db):
|
||||||
send_status(bot, update, player)
|
send_status(bot, update, player)
|
||||||
if text == "mark as done":
|
if text == "mark as done":
|
||||||
mark_as_done(bot, update, player, state["extra"], "side_quest")
|
mark_as_done(bot, update, player, state["extra"], "side_quest")
|
||||||
|
elif state["state"] == "bo":
|
||||||
|
player.set_state('none', 0)
|
||||||
|
send_status(bot, update, player)
|
||||||
|
|
||||||
|
|
||||||
db = sqlite3.connect("questable.db", check_same_thread=False)
|
db = sqlite3.connect("questable.db", check_same_thread=False)
|
||||||
|
|
Loading…
Reference in New Issue