Send XP earned when marked as done.

Changed send_status to take a prefix message that is send after name and
before the details
This commit is contained in:
Ceda EI 2018-11-03 19:18:28 +05:30
parent 2cdc6cae09
commit bbc97d4d4d
1 changed files with 3 additions and 3 deletions

6
bot.py
View File

@ -144,7 +144,7 @@ def add_imp(bot, update, player, type, qid):
send_status(bot, update, player) send_status(bot, update, player)
def send_status(bot, update, player): def send_status(bot, update, player, prefix=""):
name = str(update.message.from_user.first_name) name = str(update.message.from_user.first_name)
if update.message.from_user.last_name: if update.message.from_user.last_name:
name += " " + str(update.message.from_user.last_name) name += " " + str(update.message.from_user.last_name)
@ -154,7 +154,7 @@ def send_status(bot, update, player):
total_side_quests = len(player.get_side_quests(None)) total_side_quests = len(player.get_side_quests(None))
completed_side_quests = len(player.get_side_quests(1)) completed_side_quests = len(player.get_side_quests(1))
text = (f'<b>{name}</b>\n\n' text = (f'<b>{name}</b>\n\n' + prefix +
f'<b>🔥 XP:</b> {points}\n' f'<b>🔥 XP:</b> {points}\n'
f'<b>⭐️ Quests:</b> {completed_quests}/{total_quests}\n' f'<b>⭐️ Quests:</b> {completed_quests}/{total_quests}\n'
f'<b>💠 Side Quests:</b> {completed_side_quests}/' f'<b>💠 Side Quests:</b> {completed_side_quests}/'
@ -261,7 +261,7 @@ def mark_as_done(bot, update, player, qid, type):
points = (55 if type == "quest" else 0) + 10*x.imp + 15*x.diff points = (55 if type == "quest" else 0) + 10*x.imp + 15*x.diff
player.add_points(points) player.add_points(points)
player.set_state('none', 0) player.set_state('none', 0)
send_status(bot, update, player) send_status(bot, update, player, f"<b>🌟 Earned {points} XP</b>\n\n")
chat_id = update.message.chat_id chat_id = update.message.chat_id
custom_keyboard = [ custom_keyboard = [
['Add Quest', 'Add Side Quest'], ['Add Quest', 'Add Side Quest'],