Spaces:
Building
Building
Update sportbet.py
Browse files- sportbet.py +6 -6
sportbet.py
CHANGED
@@ -28,8 +28,8 @@ async def fetch_nfl_scores():
|
|
28 |
data = await response.json()
|
29 |
events = data['sectionList'][0]['events']
|
30 |
|
31 |
-
# Check if any game in this week is upcoming
|
32 |
-
if any(game['eventStatus']
|
33 |
current_week = week
|
34 |
scores = data
|
35 |
break
|
@@ -43,10 +43,10 @@ async def show_nfl_games(interaction: discord.Interaction):
|
|
43 |
return
|
44 |
|
45 |
events = scores.get('sectionList', [])[0].get('events', [])
|
46 |
-
upcoming_games = [game for game in events if game.get('eventStatus')
|
47 |
|
48 |
if not upcoming_games:
|
49 |
-
await interaction.followup.send("No NFL games available for betting this week.", ephemeral=False)
|
50 |
return
|
51 |
|
52 |
view = GameSelect(upcoming_games, "NFL")
|
@@ -68,9 +68,9 @@ class SportSelect(discord.ui.Select):
|
|
68 |
if selected_sport == "NHL":
|
69 |
scores = await fetch_nhl_scores()
|
70 |
events = scores.get('sectionList', [])[0].get('events', [])
|
71 |
-
upcoming_games = [game for game in events if game.get('eventStatus') ==
|
72 |
if not upcoming_games:
|
73 |
-
await interaction.followup.send("No NHL games available for betting today.", ephemeral=False)
|
74 |
return
|
75 |
view = GameSelect(upcoming_games, "NHL")
|
76 |
await interaction.followup.send("Select a game to bet on:", view=view, ephemeral=False)
|
|
|
28 |
data = await response.json()
|
29 |
events = data['sectionList'][0]['events']
|
30 |
|
31 |
+
# Check if any game in this week is upcoming
|
32 |
+
if any(game['eventStatus'] == 1 for game in events):
|
33 |
current_week = week
|
34 |
scores = data
|
35 |
break
|
|
|
43 |
return
|
44 |
|
45 |
events = scores.get('sectionList', [])[0].get('events', [])
|
46 |
+
upcoming_games = [game for game in events if game.get('eventStatus') == 1] # 1: Scheduled
|
47 |
|
48 |
if not upcoming_games:
|
49 |
+
await interaction.followup.send("No upcoming NFL games available for betting this week.", ephemeral=False)
|
50 |
return
|
51 |
|
52 |
view = GameSelect(upcoming_games, "NFL")
|
|
|
68 |
if selected_sport == "NHL":
|
69 |
scores = await fetch_nhl_scores()
|
70 |
events = scores.get('sectionList', [])[0].get('events', [])
|
71 |
+
upcoming_games = [game for game in events if game.get('eventStatus') == 1]
|
72 |
if not upcoming_games:
|
73 |
+
await interaction.followup.send("No upcoming NHL games available for betting today.", ephemeral=False)
|
74 |
return
|
75 |
view = GameSelect(upcoming_games, "NHL")
|
76 |
await interaction.followup.send("Select a game to bet on:", view=view, ephemeral=False)
|