Now third game work!

This commit is contained in:
Stefano Assenzo 2022-09-05 16:59:09 +02:00
parent 8e8d4bf587
commit 3e3b9e854d
1 changed files with 12 additions and 3 deletions

15
main.py
View File

@ -44,9 +44,17 @@ def comingsoon(message):
future_games_startdate2 = response['nextGames'][1]['promotions']['upcomingPromotionalOffers'][0]['promotionalOffers'][0]['startDate']
future_games_price2 = response['nextGames'][1]['price']['totalPrice']['fmtPrice']['originalPrice']
#image_futuregames3 = response['nextGames'][0]['keyImages'][2]['url'] # Third image future games
#future_games3 = response['nextGames'][2]['title'] # Third title future games
#future_games_description3 = response['nextGames'][2]['description'] # Third description future games
try:
image_futuregames3 = response['nextGames'][0]['keyImages'][2]['url'] # Third image future games
future_games3 = response['nextGames'][2]['title'] # Third title future games
future_games_description3 = response['nextGames'][2]['description'] # Third description future games
future_games_startdate3 = response['nextGames'][1]['promotions']['upcomingPromotionalOffers'][0]['promotionalOffers'][0]['startDate']
future_games_price3 = response['nextGames'][1]['price']['totalPrice']['fmtPrice']['originalPrice']
title_description_3 = future_games3 + "\n\n<b>About:</b>\n" + future_games_description3 + "\n" + "\n<b>Start Date:</b>\n" + future_games_startdate3 + "\n" + "\n<b>Price:</b>\n" + future_games_price3 + "" + "Free" # Send title, description, start date and price second future game
img_3 = bot.send_photo(message.chat.id, image_futuregames3) # Send image third future games
send_message = bot.send_message(chat_id, title_description_2, parse_mode="HTML") # Send all
except IndexError:
print("No third game")
#Send notification to user
title_description_1 = future_games1 + "\n\n<b>About:</b>\n" + future_games_description1 + "\n" + "\n<b>Start Date:</b>\n" + future_games_startdate1 + "\n" + "\n<b>Price:</b>\n" + future_games_price1 + "" + "Free" # Send title, description, start date and price first future game
@ -56,4 +64,5 @@ def comingsoon(message):
title_description_2 = future_games2 + "\n\n<b>About:</b>\n" + future_games_description2 + "\n" + "\n<b>Start Date:</b>\n" + future_games_startdate2 + "\n" + "\n<b>Price:</b>\n" + future_games_price2 + "" + "Free" # Send title, description, start date and price second future game
img_2 = bot.send_photo(message.chat.id, image_futuregames2) # Send image second future games
send_message = bot.send_message(chat_id, title_description_2, parse_mode="HTML") # Send all
bot.polling()