First try at adding weather to game history command

This commit is contained in:
kevroded 2021-01-05 23:52:23 -05:00
parent 9f6f74f1e9
commit e9abc7befd
3 changed files with 5 additions and 3 deletions

View File

@ -71,7 +71,8 @@ def initialcheck():
Team_1 text NOT NULL,
Team_1_Score integer,
Team_2 text NOT NULL,
Team_2_Score integer
Team_2_Score integer,
Weather text NOT NULL
);"""
if conn is not None:

View File

@ -64,7 +64,8 @@ def update_loop():
if state["update_pause"] == 1:
state["update_emoji"] = "🍿"
if this_game.over:
db.cache_history(this_game.teams['home'].name, this_game.teams["home"].score, this_game.teams['away'].name, this_game.teams['away'].score)
db.cache_history(this_game.teams['home'].name, this_game.teams["home"].score, this_game.teams['away'].name, this_game.teams['away'].score,
this_game.weather_text)
state["display_inning"] -= 1
state["display_top_of_inning"] = False
winning_team = this_game.teams['home'].name if this_game.teams['home'].score > this_game.teams['away'].score else this_game.teams['away'].name

View File

@ -1175,7 +1175,7 @@ async def history_pages(msg, all_games, search_term=None):
embed.set_footer(text = f"Page {page+1} of {page_max}")
for i in range(0,25):
try:
embed.add_field(name=str(all_games[i+25*page]["Team1"])+' at '+str(all_games[i+25*page]["Team2"]), value=str(all_games[i+25*page]["Team1Score"])+' to '+str(all_games[i+25*page]["Team2Score"]))
embed.add_field(name=str(all_games[i+25*page]["Team1"])+' at '+str(all_games[i+25*page]["Team2"]), value=str(all_games[i+25*page]["Team1Score"])+' to '+str(all_games[i+25*page]["Team2Score"]) + '\nWeather: '+str(all_games[i+25*page]['Weather']))
except:
break
pages.append(embed)