diff --git a/cogs/liveupdate.py b/cogs/liveupdate.py index 9ddf4b0..1b02a14 100644 --- a/cogs/liveupdate.py +++ b/cogs/liveupdate.py @@ -68,9 +68,9 @@ async def livegameworker(self,serverid,userid,channelid,messageid,gameid,offset) embed.add_field(name="Outs",value="🔴🔴") case _: embed.add_field(name="Outs",value="⭕⭕") - embed.add_field(name="Batting",value=data["entries"][-1]["batter"], inline=True) - embed.add_field(name="Pitching",value=data["entries"][-1]["pitcher"], inline=True) - embed.add_field(name="On Deck",value=data["entries"][-1]["on_deck"], inline=True) + embed.add_field(name="Batting",value=f"{data["entries"][-1]["batter"]}.", inline=True) + embed.add_field(name="Pitching",value=f"{data["entries"][-1]["pitcher"]}.", inline=True) + embed.add_field(name="On Deck",value=f"{data["entries"][-1]["on_deck"]}.", inline=True) embed.add_field(name=f"Last 7 events",value=finalstr[-1024:],inline=False) embed.set_thumbnail(f"https://insertapp.net/mmolbbot/assets/diamond_{data["entries"][-1]["on_1b"]}_{data["entries"][-1]["on_2b"]}_{data["entries"][-1]["on_3b"]}.png") embed.set_footer(text=f"Embed too big? Need historical data? consider classic mode.") @@ -537,9 +537,14 @@ class liveupdate(commands.Cog): try: await self.bot.wait_until_ready() async with aiohttp.ClientSession() as session: - game = await session.get("https://mmolb.com/api/spotlight") - game = await game.json() - gameid = game["game_id"] + try: + game = await session.get("https://mmolb.com/api/spotlight") + game = await game.json() + gameid = game["game_id"] + except KeyError: + game = await session.get("https://mmolb.com/api/event-games") + game = await game.json() + gameid = game["games"][-1]["game_id"] data = await session.get(f"https://mmolb.com/api/game/{gameid}") data = await data.json() res = await self.bot.db.execute("SELECT serverid,channelid,classic FROM spotlightsubscriptions") diff --git a/cogs/team.py b/cogs/team.py index 9152f51..c4f4d3c 100644 --- a/cogs/team.py +++ b/cogs/team.py @@ -216,7 +216,7 @@ class TeamView(nextcord.ui.View): embed = ogmsg[0] teamid = embed.footer.text data = requests.get(f"https://mmolb.com/api/team/{teamid}").json() - history = requests.get(f"https://freecashe.ws/api/games?team={teamid}&season=2").json()["items"] + history = requests.get(f"https://freecashe.ws/api/games?team={teamid}&season=3").json()["items"] color = tuple(int(data["Color"][i:i+2], 16) for i in (0, 2, 4)) embed = nextcord.Embed(title=f"Last ten games for the {data["Location"]} {data["Name"]} {data["Emoji"]}", colour = nextcord.Color.from_rgb(color[0], color[1], color[2])) embed.set_footer(text=teamid)